3

i'm still a novice with React-native, and i'm currently building an app with it and react-native-router-flux, the documentation says that Actions.key should pass the object to the page with the [key]. but it does not seem to be working and i can't seem to get it to work

here is my router

const RouterComponent = () => {
    return (
        <Router sceneStyle={wholeApp.wrapper}>
            <Stack key='root' hideNavBar>
                <Drawer
                    key="drawerMenu"
                    contentComponent={SideMenu}
                    drawerIcon={sidebarButton}
                    navigationBarStyle={navBar.container}
                    titleStyle={navBar.text_navBarHeader}
                >
                    <Scene key='detailsPage' drawer={true} component={detailsPage} title='detailsPage' initial/>
                    <Scene key={screens.sales.CollectionIndex} drawer={true} component={CollectionIndex} title='Collection' />
                </Drawer>
            </Stack>
        </Router>
    );
};

in the page that does the calling (CollectionIndex), im using a secondary component to show my objects in a card:, here's what's in the card:

const CDCard = ({
    CD,
    type
}) => {
    const {
        name,
        star,
        rating
    } = CD;
    const onCDCardPress = () => {
        console.log(CD);
        Actions.detailsPage({CD, type});
    }
    return (
        <TouchableOpacity activeOpacity={0.55} onPress={onCDCardPress}>
            ...viewing the CD object's details ...

        </TouchableOpacity>
    );
};

export { CDCard };

my collection index then has a CDCard, passing a CD object and a string to it, but console logging in the details page after returning to it, it doesn't have the CD as a prop

I expect the details page to have a CD and type as props, but the moment it doesn't

AmSabba
  • 67
  • 5

0 Answers0