xotahal / react-native-material-ui

Highly customizable material design components for React Native
MIT License
3.78k stars 611 forks source link

Facing error while using theme #485

Open cksharma11 opened 3 years ago

cksharma11 commented 3 years ago

Hey,

I'm trying to use the library but getting error Not able to identify what can be the issue image

node: 12.18.0 npm: 6.14 OS: Mac

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import React from 'react';
import Dashboard from './components/Dashboard/Dashboard';
import Login from './components/Login/Login';
import Signup from './components/Signup/Signup';
import SubService from './components/SubService/SubService';
import { SCREENS } from './screens/screens';

import { COLOR, ThemeContext, getTheme } from 'react-native-material-ui';

// you can set your style right here, it'll be propagated to application
const uiTheme = {
  palette: {
    primaryColor: COLOR.green500,
  },
  toolbar: {
    container: {
      height: 50,
    },
  },
};

const Stack = createStackNavigator();

export default function App() {
  return (
    <ThemeContext.Provider value={getTheme(uiTheme)}>
      <NavigationContainer>
        <Stack.Navigator>
          <Stack.Screen name={SCREENS.home} component={Login} />
          <Stack.Screen name={SCREENS.signup} component={Signup} />
          <Stack.Screen name={SCREENS.dashboard} component={Dashboard} />
          <Stack.Screen name={SCREENS.subService} component={SubService} />
        </Stack.Navigator>
      </NavigationContainer>
    </ThemeContext.Provider>
  );
}