react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Not able to change bottom tabs icons and text at runtime theme change

Open pankajsoftyoi opened this issue 1 year ago • 0 comments

when i am using 'styled-components' to update UI with mode change at runtime other screen components able to update, But not able to change bottom tabs icons and text at runtime, Every time i need to close app after change theme mode (dark/light) Ex: import { withTheme } from 'styled-components';

Here is sample code for bottom tab integration: Forcefully i need to pass constant variable for theme mode check, is there any other option for update bottom tabs icons and text at runtime with theme change listener?

export const setBottomTab = async () => {
  Navigation.setRoot({
    root: {
      bottomTabs: {
        children: [
          {
            stack: {
              children: [
                {
                  component: { name: Route.Home, options: topBarDefaultOptions },
                },
              ],
              options: {
                bottomTab: {
                  icon: isIOS
                    ? IS_IN_DARK_MODE
                      ? {
                        uri: 'ic_explore_inactive_tab_darkmode_ios',
                        scale: 6
                      }
                      : {
                        uri: 'ic_explore_inactive_tab_ios',
                        scale: 6
                      }
                    : IS_IN_DARK_MODE
                    ? images.exploreInActiveDarkModeTab
                    : images.exploreInActiveTab,
                  text: 'Explore',
                  ...tabDefaultOptions,
                  selectedIcon: isIOS ? {
                    uri: 'ic_explore_active_tab_ios',
                    scale: 6
                  } : images.exploreActiveTab,
                },
              },
            },
          },

https://wix.github.io/react-native-navigation/docs/style-theme Screenshot 2022-08-03 at 5 58 53 PM

pankajsoftyoi avatar Aug 03 '22 12:08 pankajsoftyoi