reactjs - react-navigation: Include a Component in each screen -
i'm using stacknavigator
redux
below. cleanest way include component
screens? i've tried adding child component
both appwithnavigationstate
, appnavigator
no luck.
<provider store={store}> <appwithnavigationstate /> </provider> const appnavigator = stacknavigator({ login: { screen: login }, main: { screen: main }, }, { headermode: 'none', } }) const appwithnavigationstate = ({ dispatch, router }) => { return( <appnavigator navigation={addnavigationhelpers({ dispatch, state: router })} /> ) }; const mapstatetoprops = (state) => ({ state, }); export default connect(mapstatetoprops)(appwithnavigationstate);
you can try add sibling component rather adding child component. try example below.
example
const appwithnavigationstate = ({ dispatch, router }) => { return( <view> <appnavigator navigation={addnavigationhelpers({ dispatch, state: router })} /> <defaultcomponentforeachscreen /> </view> ) };
Comments
Post a Comment