Skip to content

Commit

Permalink
fix: support react@16
Browse files Browse the repository at this point in the history
  • Loading branch information
silentcloud committed Sep 28, 2017
1 parent 70172b8 commit 65fd3a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rmc-dialog",
"version": "0.0.1-alpha.4",
"version": "1.0.1",
"description": "mobile dialog ui component for react",
"keywords": [
"react",
Expand Down
6 changes: 1 addition & 5 deletions src/DialogWrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ export default class DialogWrap extends React.Component<IDialogPropTypes, any> {
container.setAttribute('id', `${prefixCls}-container`);
document.body.appendChild(container);
}
ReactDOM.unstable_renderSubtreeIntoContainer(
this,
this.getComponent(visible),
container,
);
ReactDOM.render(this.getComponent(visible), container);

This comment has been minimized.

Copy link
@yesmeck

yesmeck Sep 28, 2017

Member

不用 ReactDOM.createPortal?

This comment has been minimized.

Copy link
@silentcloud

silentcloud Sep 28, 2017

Author Member

看这个 https://github.com/facebook/react/issues/10309#issuecomment-318433235, ReactDOM.createPortal 在这种场景下不行,我试了 @yesmeck

This comment has been minimized.

Copy link
@yesmeck

yesmeck Sep 28, 2017

Member

看这个 react-component/trigger#69

用 render 会有问题吧,ref 可能不对 ant-design/ant-design#5377 (comment)

This comment has been minimized.

Copy link
@silentcloud

silentcloud Sep 28, 2017

Author Member

这里不需要 ref , 目前没有需要暴露 ref 的场景,有的话,在 <Dialog {...props} visible={visible} onAnimateLeave={this.removeContainer} />; 这里面暴露应该也是可以的

This comment has been minimized.

Copy link
@yesmeck

yesmeck Sep 28, 2017

Member

组件里不需要 ref,但是用的人会可能用到 ref 啊。

This comment has been minimized.

Copy link
@silentcloud

silentcloud Sep 28, 2017

Author Member

那就给 dialog 加就好了 <Dialog ref={(el) => this.dialogRef = el} ,rmc 目前主要用给 antd-mobile 的,第三方要用这个,提 issue 再搞

This comment has been minimized.

Copy link
@yesmeck

yesmeck Sep 28, 2017

Member

不是这个意思,你看这个例子 https://codepen.io/NE-SmallTown/pen/GMJrWZ?&editors=001

This comment has been minimized.

Copy link
@yesmeck

yesmeck Sep 28, 2017

Member

Dialog 里元素的 ref 会 undefined。

}

render() {
Expand Down

1 comment on commit 65fd3a0

@silentcloud
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.