I'm bizarrely getting an error that a local file import can't be resolved by React Native.
Unable to resolve module `./components/MyComponent" from ".//App.js`: could not resolve `/Users/myusername/Desktop/mylibrary/components/MyComponent' as a file nor as a folder","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]},"type":"bundling_error"}" mylibrary/App.js:
import React from 'react'; import { View, Text, StyleSheet, ScrollView, AsyncStorage, } from 'react-native'; import MyComponent from './components/MyComponent'; mylibrary/components/MyComponent.jsx:
import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; export default class MyComponent extends React.Component { render() { <View> {this.props.children} </View> } } I tried renaming the file to be lowercase (mycomponent.jsx), and it didn't make a difference. I also tried restarting my simulator and resetting the cache, and it also didn't help.
importstatement by default try to import.jsfiles, try renamingMyComponent.jsxtoMyComponent.js