skip to Main Content

I was trying to solve : Invariant Violation: "main" has not been registered

Uninstalled react-native-gesture-handler, react-native-reanimated, node_modules and package-lock before reinstalling everything (npm & npx expo)

Now i can start the app but all my local images disappeared

That’s how i define an image : <Image source={require(‘../Images/infirmière.png’)} style={styles.img}/> (All images are still in the folder Images)

Never happened to me before, does someone know what’s going on ?

2

Answers


  1. Chosen as BEST ANSWER

    The app loads and the images don't show

    Package.json

    {
      "name": "gestioninventaire",
      "version": "1.0.0",
      "main": "node_modules/expo/AppEntry.js",
      "scripts": {
        "start": "expo start",
        "android": "expo start --android",
        "ios": "expo start --ios",
        "web": "expo start --web"
      },
      "dependencies": {
        "@react-native-community/masked-view": "^0.1.11",
        "@react-native-firebase/app": "^18.7.3",
        "@react-native-firebase/firestore": "^18.7.3",
        "@react-native/js-polyfills": "^0.74.0",
        "@react-navigation/bottom-tabs": "^6.5.7",
        "@react-navigation/material-top-tabs": "^6.6.2",
        "@react-navigation/native": "^6.1.6",
        "@react-navigation/native-stack": "^6.9.12",
        "@react-navigation/stack": "^6.3.20",
        "@rneui/base": "^4.0.0-rc.7",
        "@rneui/themed": "^4.0.0-rc.7",
        "expo": "^50.0.8",
        "expo-font": "~11.1.1",
        "expo-linear-gradient": "~12.1.2",
        "expo-status-bar": "~1.4.4",
        "firebase": "^10.7.1",
        "react": "18.2.0",
        "react-native": "0.71.8",
        "react-native-element-dropdown": "^2.9.0",
        "react-native-pager-view": "6.1.2",
        "react-native-safe-area-context": "4.5.0",
        "react-native-screens": "~3.20.0",
        "react-native-svg": "13.4.0",
        "react-native-svg-transformer": "^1.0.0",
        "react-native-tab-view": "^3.5.1",
        "typescript": "^4.9.4",
        "react-native-gesture-handler": "~2.14.0",
        "react-native-reanimated": "~3.6.2"
      },
      "devDependencies": {
        "@babel/core": "^7.20.0"
      },
      "private": true
    }

    From one of my files :

    import { View, StyleSheet, SafeAreaView, Text, TextInput, StatusBar, Image, TouchableOpacity, Alert } from 'react-native';

    const styles = StyleSheet.create({
        container: {
            flex: 1,
        },
        View:{
            flex: 1,
            paddingTop: StatusBar.currentHeight,
            alignItems: "center",
            justifyContent: 'center'
        },
        img:{
            width: 300,
            height: 300,
          },
          
          //following style
          
         })


  2. Please define "Dissapeared". The app loads and the images just dont show? Or are you getting an error that the image(s) cannot be found? Please also include code that shows your package.json, how you are importing the image component and the styles.img object.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search