reactjs - React Native:如何从按钮传递道具?
问题描述
知道如何将道具从按钮传递到通过引用访问的组件吗?
组件:<RBSheet ref={refRBSheet} > </RBSheet>
来电按钮:<Button title="open" onPress={() => refRBSheet.current.open()} />
解决方案
您必须使用React.forward
ref 传递ref prop to other components
.
有关更多信息,请阅读此内容。
推荐阅读
- getstream-io - Getstream - 如何根据评论反应显示时间线提要?
- python - Tensorflow:我可以直接在烧瓶中运行我的 tensorflow 模型吗?
- python - AttributeError:“人”对象没有属性“名称”
- node.js - 使用 Node Js 使用 API 时如何在标头中传递 API 密钥授权?
- python - 在 xgboost 上使用 shap 时出现 UnicodeDecodeError
- c - 如何在c中执行乘法?
- vue.js - 使用 vue js 添加外部脚本的 Adobe 分析
- php - 此代码有什么问题,它会生成错误除以零
- flutter - 如何在颤动中更改包装在标签内的容器的颜色
- php - 行大小问题 - 长度已满时不返回值(100 个字符)