我可以将手柄功能作为道具传递给路由器中的其他屏幕吗?

问题描述 投票:4回答:1

每个人。我正在学习React-native,但遇到了一个问题。我想在执行功能Actions.about()时将句柄功能作为道具传递给路线中的其他屏幕。

下面是我的路线代码。

<Router>
    <Scene key = "root">
        <Scene key = "home" component = {Home} title = "Home" initial = {true} />
        <Scene key = "about" component = {About} title = "About" />
        <Scene key = "login" component = {Login} title = "LOG IN" />
    </Scene>
</Router>

这是我的职责。

function handleConfirm(value) {
    Actions.about(handleDo = this.handleDo);
}

然后,我想在Actions组件中访问此handleDo。让我们想象this.handleDo是用于更改Home组件中的某些状态值的。

感谢您的回答。

javascript react-native
1个回答
0
投票
Actions.about({ param1: 'hello', param2: 'world' });

关于]

this.props.param1//return hello
© www.soinside.com 2019 - 2024. All rights reserved.