Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

params is undefined in custom Tabbar #3137

Closed
vit134 opened this issue Jul 20, 2018 · 1 comment
Closed

params is undefined in custom Tabbar #3137

vit134 opened this issue Jul 20, 2018 · 1 comment

Comments

@vit134
Copy link

vit134 commented Jul 20, 2018

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.31
  • react-native v0.55.2

Expected behaviour

I need to create custom tabBar, and in navigationState.routes.params i expect params of my scene but navigationState.routes.params is undefined

Actual behaviour

navigationState.routes.params is undefined

Steps to reproduce

const TabBar = ({ navigationState, jumpToIndex }) => {
    const routes = navigationState.routes;
    
    return (
        routes.map((el, i) => {
            return (
                <View key={i}><Text>{el.params ? el.params.title : 'no params'}</Text></View>
            );
        })
    )
}
<Scene 
    initial={this.props.first ? false : true} 
    key="tabbar" 
    tabs={true}
    tabBarStyle={styles.tabBarStyle} 
    tabBarComponent={TabBar}
    navigationBarStyle={styles.navigationBarStyle} 
    labelStyle={styles.label}
    activeTintColor={colorRed}>
    <Scene initial key="time" title="Time" component={Time} iconName="ios-clock" icon={TabIcon} hideNavBar/>
    <Scene  key="alarm" title="Alarm" iconName="ios-alarm" icon={TabIcon}>
        <Scene key="alarm" component={Alarm} title="Alarm" hideNavBar />
        <Scene key="alarmAdd" component={AlarmAdd} title="Add alarm" hideNavBar />
        <Scene key="alarmTitleModal" component={AlarmTitleModal} direction="vertical" title="Title" hideNavBar />
        <Scene key="alarmRepeatModal" component={AlarmRepeatModal} direction="vertical" hideNavBar />
    </Scene>
    <Scene  key="settings" title="Settings" iconName="ios-settings" icon={TabIcon} hideNavBar>
        <Scene initial key="settings-all" component={Settings} title="Settings" />
        <Scene key="settingsUser" component={SettingsUser} title="User settings" back={true} hideNavBar={false}/>
        <Scene key="settingsTime" component={SettingsTime} title="User time" back={true} hideNavBar={false}/>
        <Scene key="settingsFontColor" component={SettingsFontColor} title="Font color"/>
        <Scene key="settingsBrightness" component={SettingsBrightness} title="Brightness"/>
    </Scene>
</Scene>

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Please check latest version based on react navigation 2.x - 4.0.0-beta.40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants