[5.0.0-rc.2] TypeError: undefined is not an object (evaluating 't.colors') with material-bottom-tabs
See original GitHub issueCurrent behaviour
TypeError: undefined is not an object (evaluating 't.colors')
This error is located at:
in MaterialBottomTabViewInner (created by MaterialBottomTabView)
in RCTView (at View.js:32)
in View (created by SafeAreaInsetsContext)
in SafeAreaProviderCompat (created by MaterialBottomTabView)
in MaterialBottomTabView (created by MaterialBottomTabNavigator)
in Unknown (created by MaterialBottomTabNavigator)
in MaterialBottomTabNavigator (at Home.tsx:15)
in RCTView (at View.js:32)
in View (at Home.tsx:13)
in Home (created by SceneView)
in StaticContainer
in EnsureSingleNavigator (created by SceneView)
in SceneView (created by SceneView)
in RCTView (at View.js:32)
in View (created by DebugContainer)
in DebugContainer (created by MaybeNestedStack)
in MaybeNestedStack (created by SceneView)
in RNSScreen (at createAnimatedComponent.js:211)
in AnimatedComponent (at createAnimatedComponent.js:264)
in AnimatedComponentWrapper (created by Screen)
in MaybeFreeze (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
in RNSScreenStack (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaInsetsContext)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator (at App.tsx:40)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (at App.tsx:39)
in App (at my-app/index.js:26)
in ThemeProvider (created by Provider)
in RCTView (at View.js:32)
in View (created by Portal.Host)
in Portal.Host (created by Provider)
in Provider (at my-app/index.js:25)
in ApolloProvider (at my-app/index.js:24)
in ErrorBoundary (at my-app/index.js:23)
in MyApp (at renderApplication.js:50)
in RCTView (at View.js:32)
in View (at AppContainer.js:92)
in RCTView (at View.js:32)
in View (at AppContainer.js:119)
in AppContainer (at renderApplication.js:43)
in MyApp(RootComponent) (at renderApplication.js:60)
Expected behaviour
No error, it was working with react-native-paper v4.12.1
Code sample
import {MD2LightTheme as DefaultTheme, Provider as PaperProvider} from 'react-native-paper';
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: 'blue',
},
};
<Tab.Screen
name="Foo"
component={Foo}
options={{
tabBarLabel: 'Foo',
tabBarIcon: ({color}) => (
<MaterialCommunityIcons name="home" color={color} size={26} />
),
}}
/>
Your Environment
software | version |
---|---|
ios or android | android 12 |
react-native | 0.68.2 |
react-native-paper | 5.0.0-rc.2 |
node | 16.15.1 |
npm or yarn | npm 8.11.0 |
expo sdk | no |
Issue Analytics
- State:
- Created a year ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Undefined is not an object (evaluating 's.colors.red')
The code I use 'color.red': import React, { PureComponent } from 'react'; import { StyleSheet, View, Image } from 'react-native'; import ...
Read more >Material Bottom Tabs Navigator
A material-design themed tab bar on the bottom of the screen that lets you switch between different routes with animation. Routes are lazily...
Read more >Cannot Read Property 'Installcorefunctions' of Undefined
[5.0.0rc.2] TypeError: undefined is not an object evaluating 't.colors' with materialbottomtabs Current behaviour Expected behaviour Code sample Your.
Read more >undefined is not an object evaluating navigation.navigate
Since upgrading to react native 0.63.2, I'm now getting undefined is not an object when using any navigation outside of the tab bar....
Read more >修复TypeError: undefined is not an object (evaluating 'context ...
修复 TypeError: undefined is not an object (evaluating 'context._currentValue = currentValue') 的报错. 把 package.js 里面 react 和 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has been fixed on both the react-native-paper side in version 5.0.0-rc.4 and on the react-navigation side after this commit I tried this in my application and it’s working correctly so far. (The example app on react-navigation still isn’t using v5, though)
Ok, I’ve found the problem - we have to update the
material-bottom-tabs
since it’s using old paper version and using themesDefaultTheme
andDarkTheme
which don’t exist in paper anymore.