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

从父组件调用Form组件中的用户自定义函数 #2843

Closed
strommmm opened this issue Aug 25, 2016 · 7 comments
Closed

从父组件调用Form组件中的用户自定义函数 #2843

strommmm opened this issue Aug 25, 2016 · 7 comments
Assignees

Comments

@strommmm
Copy link

本地环境

  • antd 版本: 1.10.0
  • 操作系统及其版本:osx ei caption 10.11.6
  • 浏览器及其版本: nwjs 51.0.2704.106

你做了什么?

引入了antd的Modal和Form,
自己构建的一个基于Modal的Component,用Form.create({withRef: true})(Modal)包裹
在其父组件中用ref找到对应的组件, 无法在该组件里找到原Component中的用户自定义的函数
在之前的版本中(1.6.5),可以在ref中的wrappedComponent中找到对应函数

你期待的结果是:

可以找到 用Form创建的组件中的用户自定义的函数

实际上的结果:

找不到用户自定义的函数

可重现的在线演示

@codecoldsun
Copy link

也遇到了同样的问题,现在只能通过._reactInternalInstance._renderedComponent._instance方式来获取
业务模拟的在线代码:
http://codepen.io/coldSun/pen/RRXYZg

@benjycui
Copy link
Contributor

@EvilsZero 可以给个能反映出问题的 demo 么。。还有步骤。

@codecoldsun
Copy link

抱歉哈,您看这个可以吗?

本地环境

  • codePen配置:同antd官网codePen配置

做的处理

  • 创建两个组件Dialog和App,
  • Dialog包含了基础组件Modal,
  • 其中App包括了子组件Dialog和两个按钮,按钮用以触发打开Dialog里的Modal

期待的结果:

通过App的函数打开Dialog里的Modal

实际上的结果:

只有第一个按钮可以,第二个无法打开

在线演示

http://codepen.io/coldSun/pen/jrNApm

@benjycui
Copy link
Contributor

@codecoldsun
Copy link

其余条件不变,做了withRef的补充,仍然出现问题

在线地址:

http://codepen.io/coldSun/pen/xExxqp

@benjycui benjycui self-assigned this Sep 1, 2016
@benjycui
Copy link
Contributor

这儿改坏了 #2534

@lock
Copy link

lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants