子组件
componentDidMount() {
this.props.oneRef(this);
}
_showModal=()=>{
this.setState({ isVisible: true })
}
父组件
<Child
oneRef={this.oneRef}
/>
oneRef=(ref)=>{
this.waitAudit = ref
}
<TouchableOpacity
style={{ height: 35, paddingRight: 10, paddingLeft: 10 }}
onPress={()=>{
that.waitAudit && that.waitAudit._showModal()
}}
>
</TouchableOpacity>
网友评论