I am getting this error and I am having a lot of trouble fixing this.
What I am trying to do here is have 3 different screens and have a tabbar that navigates to eac
In my vase I was on react-native 0.46.4
and had something like import MainContainer from './app'
where the app
directory had a shared index.js
file amongst Android and iOS, but React Native wasn't detecting an index.js
inside app
. Once I switched to import MainContainer from './app/index.js'
it worked.
Change your SwitchView definition to
export default class SwitchView extends Component...
This is probably caused by some JS module export/import issues in your program, typically for one of the two reasons listed below:
I ran into similar error, but in my case, it is not caused by export
but caused by import
, and I used the import
statement incorrectly to import something that doesn't exist in the module.
In my case, the import
was incorrectly written as:
import { MyComponent } from './MyComponents/MyComponent'
while actually it should be:
import MyComponent from './MyComponents/MyComponent'
And it drove me crazy and took me a whole day to figure it out and I hope this will save several hours for some people.
this error can be resolved by using Defualt
instead of export use export default
I faced this issue only for the packages installed. Previously I wrote as
import WebView from 'react-native-webview-messaging/WebView';
I changed to
import { WebView } from 'react-native-webview-messaging/WebView';
This error comes when you are trying to access a component which is not exported. In my case, I forgot to export a component and I was accessing it.