react-navigation tab navigator Screens' contents are not shown / the screens are blank issue -
i have problem react-navigation tab navigator. screens' contents not shown / screens blank. ideas ? navigator structure:
import { stacknavigator, tabnavigator } 'react-navigation'; import peoplelist './peoplelist'; import companylist './companylist'; import addperson './addperson'; const navigation = tabnavigator({ people: { screen: peoplelist }, person: { screen: addperson }, company: { screen: companylist }, }, { tabbaroptions: { activetintcolor: 'white', inactivetintcolor: '#80cbc4', swipeenabled: true, showlabel: false, style: { backgroundcolor: '#26a69a', }, }, }); export default navigation;
update:
this app.js file include render methods:
import react, {component} 'react'; import {stylesheet, text, view} 'react-native'; import firebase 'firebase'; import {provider} 'react-redux'; import {createstore} 'redux' import login './login'; import loader './loader'; import navigation './navigation'; import reducers '../reducers/peoplereducer'; const styles = stylesheet.create({ container: { flex: 1, justifycontent: 'center', alignitems: 'center', backgroundcolor: '#f5fcff' } }); const store = createstore(reducers); export default class app extends component { state = { loggedin: null }; componentwillmount() { firebase.initializeapp({ apikey: "xxxxxxxxxxxxxxxxxxx", authdomain: "xxxxxxxxxxxxxxxxxxx", databaseurl: "xxxxxxxxxxxxxxxxxxx", projectid: "xxxxxxxxxxxxxxxxxxx", storagebucket: "xxxxxxxxxxxxxxxxxxx", messagingsenderid: "xxxxxxxxxxxxxxxxxxx" }); firebase .auth() .onauthstatechanged((user) => { if (user) { this.setstate({loggedin: true}); } else { this.setstate({loggedin: false}); } }); } renderinitialview() { switch (this.state.loggedin) { case true: return <navigation/> /*exists above*/ case false: return <login/>; default: return <loader size="large"/>; } } render() { return ( <provider store={store}> <view style={styles.container}> {this.renderinitialview()} </view> </provider> ); } }
i'm sure goes first case of switch, got blank screen , don't know reason.
render() { return ( <provider store={store}> <view style={styles.container}> {this.renderinitialview()} </view> </provider> ); } }
remove tag navigation cannot wrapped in tag , this.
render() { return ( <provider store={store}> {this.renderinitialview()} </provider> ); } }
this work then.
Comments
Post a Comment