react-native - 功能组件中的自定义抽屉 screenProps
问题描述
我正在尝试将我的状态从父组件传递给子组件。
到目前为止,它看起来像这样,但我知道它不是正确的方法,但我似乎无法理解它是如何工作的。
<Drawer.Screen
name="Home"
component={Home}
screenProps={{
ref: ref,
setRef: setRef,
dataSourceCords: dataSourceCords,
setDataSourceCords: setDataSourceCords,
scrollHandler: scrollHandler
}}
/>
然后在子组件中我试图这样称呼它们:
export default function Home ({ setRef, dataSourceCords, setDataSourceCords, scrollHandler})
我对这一切都很陌生,所以可能是一些非常基本的理解,但我似乎无法让它工作,我发现的所有示例都使用类组件。提前感谢您的帮助!
解决方案
推荐阅读
- android - 在 Android Studio 中使用带有 Flutter 的 Git 出现多个警告和错误
- c# - Roslyn SemanticModel.GetTypeInfo(SyntaxNode node).Type 返回 null
- reactjs - 触发模态关闭按钮
- php - 如何向 WooCommerce Shipping 区域添加自定义字段?
- javascript - 使用 getRange() 和 getValue 搜索并返回数据
- active-directory - 如何修改 AD 模板以获取密钥加密密钥使用情况?
- c# - 单选按钮问题,根据其答案(是或否)生成下一个问题或询问一组详细信息以填写
- cakephp - 从我的视图中的另一个控制器渲染视图
- java - 此方法引发两个不同的异常。man 如何捕获两个异常并将两种异常类型捕获的异常打印到控制台?
- angular - TypeError:[某些功能]不是角度服务中的功能