Navigator passProps

写了一下passProps,发现获取不到

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

改:

<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}
                />;
        }
    }}
/>
Comments
Write a Comment