Sunday 11 July 2021

Native base component's theme is not updating when the theme changes of the App

I am using native base + react-navigation in an app and need to change the theme of the app. As soon as I change the theme the react-navigation update that easily but the problem is that the native base component theme does not change. It looks odd to the user.

I had used this code to change the theme of the app

    <StyleProvider style={getTheme(theme === 'LIGHT' ? platform : material)}>
                <Container>
                    <NavigationContainer
                        theme={theme === 'LIGHT' ? DefaultTheme : MyThemeDark}>
                        <Stack.Navigator
                            initialRouteName={isProfile ? 'Root' : 'Selection'}>
                              ..................

                        </Stack.Navigator>
                    </NavigationContainer>
                </Container>
    </StyleProvider>

As I said React navigation theme is updating correctly but the native base theme is not updating.



from Native base component's theme is not updating when the theme changes of the App

No comments:

Post a Comment