I have the following TabBarIOS.Item setup:
<TabBarIOS.Item
selected={this.state.selectedTab === 'tab1'}
title='Tab 1'
icon={require('./Components/Icons/IconImages/Tab1Icon.png')}
onPress={() => {
this.setState({
selectedTab: 'tab1'
});
}}>
<MyNavigatorIOS client={this.state.client} initialStep={this.state.initialStep} />
</TabBarIOS.Item>
I am trying to use the onPress
event to fire this.props.navigator.popToTop();
as per this example in the react native docs. The difference, however, is that I want the TabBarIOS onPress
event to fire popToTop()
and not the child MyNavigatorIOS
component. How can I accomplish this?
I had the same issue, what you can do is add a ref to your view and to the navigator inside of it, like so:
So the TabBar code looks like this: