Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

popup组件,popup show后不会根据父组件state实时render。 #1121

Closed
handoudou opened this issue Apr 10, 2017 · 6 comments
Closed
Labels

Comments

@handoudou
Copy link

handoudou commented Apr 10, 2017

antd-mobile version(antd-mobile版本):1.0.8

Browser (or mark react-native) and its version(浏览器或react-native版本): 浏览器

What did you do? Please provide steps to re-produce your problem.(请提供复现步骤)
使用了Popup弹出层

What do you expected?(预期的正常效果)

popup show后父组件state可以实时render。

What happen?(发生了何种非正常现象)

popup show后父组件state不能更改render。

Re-producible online demo (可复现的在线demo)

官网dome

      Popup.show(
        <div>{ children }</div>,
        { animationType: 'slide-up', maskProps, maskClosable: true, onMaskClose: maskClose }
      );

现状

popup show后不会实时render。
目前children子组件可以修改本身的state,但是调用popup的父组件没有办法动态修改show出来的组件。这样一旦popup show后父组件的state动态修改不会实时render。

期望

popup show后父组件的state动态可以动态实时render。或者提供一个popup.update()的方法进行修改

@paranoidjk
Copy link
Contributor

#635

@paranoidjk
Copy link
Contributor

Popup.show(content) 是函数调用,按现有的实现可能比较难搞 Update 这种事情,也不优雅 。

https://github.com/ant-design/ant-design-mobile/blob/master/components/popup/index.web.tsx#L74

@handoudou
Copy link
Author

@paranoidjk 可以发现已经show的时候再次调用popup.show只修改展示的内容,这样不行吗?

@paranoidjk
Copy link
Contributor

@silentcloud 最初设计的时候 API 是模仿RN设计的吗?

@paranoidjk
Copy link
Contributor

@handoudou 下个大版本我们可能来改这个组件的API和实现,目前你需要rerender的话,想办法把数据源封装在content内部,把 content 写成 class 来自己控制渲染。

@paranoidjk
Copy link
Contributor

@handoudou track progress at #1125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants