react-native点击子组件触发父组件的方法

class类组件

<THButton clickPress={()=>alert(1)} style={{borderRadius: 20}}>获取验证码</THButton>
  btnSubimt=()=>{
      alert(11)
  }

<TouchableOpacity onPress={this.props.clickPress} activeOpacity={.8} style={{width: "100%",overflow:'hidden', ...this.props.style}}><Text>确定</Text></TouchableOpacity>

 

函数式组件

 

 子

 

 

 



posted @ 2022-08-29 14:29  龙卷风吹毁停车场  阅读(153)  评论(0)    收藏  举报