I encountered an issue with React Native with Expo when styling React Native Paper that I'm trying to understand.
I created a code sample with the issue: https://gitlab.com/mszymczakowski/react-native-paper-theming-issue
When I export the const with custom theme from App.tsx
file, then import and try to use it in HomeScreen.tsx
I'm getting a type error undefined is not an object (evaluating '_App.customTheme.colors')
.
Moving the const with custom theme to another .ts
file seems to fix the issue - I can use it both in App.tsx
and HomeScreen.tsx
: https://gitlab.com/mszymczakowski/react-native-paper-theming-issue/-/tree/theme-fix
But as I mentioned I'd like to understand what's happening here and why there's an error in one approach but not in second one.
Thanks in advance