Closed cid8600 closed 7 years ago
Same issue here. Using react-native-router-flux handle onPress event.
Just FYI, your tabs are empty - and the React Native error means that it needs 1 (just and exactly 1) child entry. Make sure you, within each tab, adds a
`<Tab ...>
`
or you could use an external component (with import MainView from '..')
`<Tab ..>
`
I am getting this same problem, and doing what @iptrix said does nothing, I don't get the error anymore but it stays on the same page and doesn't go to my LoginScreen
.
<TabNavigator>
<TabNavigator.Item
selected={this.state.selectedTab === 'Login'}
title="Login"
renderIcon={() => <Image source={require('../img/Home.png')} style={styles.icon} />}
onPress={() => this.setState({ selectedTab: 'Login' })}>
<LoginScreen />
</TabNavigator.Item>
@dragonbanshee can you give the code of tab navigator in react native android.I use the code which is avialabe here but this is not work in react native android
@cid8600 @DavidKongDesheng @iptrix
Hi there , we'll provide a runnable example in short to help you out getting started.
must have a child;
@dragonbanshee maybe your component is uppercase, and selectedTab is lowercase。it's your careless
When I only have one tab, the bar renders fine. If I add another tab, I get the error : React.Children.only expected to receive a single React element child
Here is the snippet:
Wrapping the
<Tab>
items in a<View>
removes the error, but the items don't show up.