How to define entry point for react native app

if you are using Expo, you have to specify the entrypoint in your app.json file like this: { “expo”: { “entryPoint”: “./src/app/index.js” } } then, inside that file you need to register the app with Expo.registerRootComponent(YOUR_MAIN_APP_COMPONENT) import Expo from ‘expo’ … class App extends Component { … } export default Expo.registerRootComponent(App); this way you can … Read more

‘Stack.Navigator’ cannot be used as a JSX component

You will need to fix the version for @types/react package because many react libraries have dependency set as @types/react : “*”, which will take the latest version of the package. (I suppose they just released version 18) To do that you can add this in your package.json if you use yarn “resolutions”: { “@types/react”: “17.0.43” … Read more

NativeModule: AsyncStorage is null, with @RNC/AsyncStorage

This error can be rectified by linking the module like mentioned above but linking does not work if your app is Expo Managed (created via expo-cli). Assuming your app is Expo managed, instead of using the AsyncStorage from Facebook RN Documentation: import AsyncStorage from ‘@react-native-community/async-storage’; Do: import { AsyncStorage } from ‘react-native’; Check documentation here: … Read more

Calling locally hosted server from Expo App

You can get the IP address at runtime using the Expo manifest: import Constants from “expo-constants”; const { manifest } = Constants; const api = (typeof manifest.packagerOpts === `object`) && manifest.packagerOpts.dev ? manifest.debuggerHost.split(`:`).shift().concat(`:3000`) : `api.example.com`; This will set api constant to the address of your local development machine in development mode and to whatever address … Read more