reactjs - Ex-navigation Tab Bar background color change from particular screen -
i change background color of tab bar when changing tabs.
i tried changing state of tab bar when title of tab rendering it's not working because starts rendering infinity times , app crashes:
rendericon = (isselected, title) => { if (title === 'home') { } else if (title === 'profile') { if (isselected) { this.setstate({ isdefault: false }); return (<image style={{ width: 29, height: 24, margintop: 8, marginbottom: 1 }} source={images.profileselected} />); } return (<image style={{ width: 29, height: 24, margintop: 8, marginbottom: 1 }} source={images.profile} />); } render() { return ( <tabnavigation ref='tabber' id="main" navigatoruid="main" initialtab="getticket" tabbarstyle={this.state.isdefault ? styles.tabbargreen : styles.tabbarwhite} >
i tried screen change background color:
this.props.navigation.performaction(({ tabs, stacks }) => { tabs('main').tabbarstyle = { backgroundcolor: 'green' } });
but doesn't rerender tab bar because there no change in state , nothing happens. how can achieve that?
here example:
Comments
Post a Comment