美文网首页
ReactNative Navigator传参

ReactNative Navigator传参

作者: Sollrei | 来源:发表于2016-08-25 11:10 被阅读0次

index.ios.js

<Navigator
    initialRoute={{
        name: 'home',
        component: Index
    }}
    renderScene={(route, navigator) => {
        let C = route.component;
        if (route.component) {
            return <C 
                {...route.passProps} 
                navigator={navigator} 
                title={route.name}
                />;
        }
    }}
/>

detail.js

<TouchableOpacity
    key={index}
    onPress={() =>
        this.props.navigator.push({
            title: '详情',
            component: Detail,
            passProps: {
                url: 'http://test'
            }
        })
    }
>
    <View>//这里是产品列表</View>    
</TouchableOpacity>

相关文章

网友评论

      本文标题:ReactNative Navigator传参

      本文链接:https://www.haomeiwen.com/subject/qmtasttx.html