S
S
site_trouble2018-09-26 18:33:34
iOS
site_trouble, 2018-09-26 18:33:34

React-navigation lag when switching to another tab. How to fix?

Good afternoon. Given:

"react-native": "0.57.1"
"react-navigation": "^2.17.0"

I use createBottomTabNavigator:
const navigationOptions = ({ navigation }) => ({
  tabBarIcon: (options: TabBarIcon) => {
    const { routeName } = navigation.state;
    const icon = icons[routeName];
    return <Ionicons name={icon} size={25} color={options.tintColor} />;
  },
});

const RootNavigation = createBottomTabNavigator(
  {
    Home: {
      screen: HomeScreen,
    },
    Profile: {
      screen: ProfileScreen,
    },
    Cart: {
      screen: CartScreen,
    },
    Orders: {
      screen: OrdersScreen,
    },
  },
  {
    navigationOptions,
    tabBarOptions: {
      activeTintColor: '#025baa',
      inactiveTintColor: 'gray',
    },
  },
);

type Props = {};
export default class App extends Component<Props> {
  render() {
    return <RootNavigation />;
  }
}

Problem: when you click on the icon, there should be a transition to the tab that was clicked on, but the transition occurs only if you then click on the next tab, and then go to the previous clicked one.
Video: https://streamable.com/j5g34
What could be causing this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
site_trouble, 2018-09-27
@site_trouble

Issue resolved. The bug appears only on the emulator, on real devices everything works as intended.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question