morrowdigital / watermelondb-expo-plugin

119 stars 30 forks source link

Expo SDK 48 #12

Closed wtcosta closed 1 year ago

wtcosta commented 1 year ago

Tera suporte ao expo Sdk 48? Fiz a atualização aqui e deu o seguinte problema:

Expected package @expo/config-plugins@~6.0.0 Found invalid: @expo/config-plugins@5.0.4 @expo/config-plugins@5.0.4 (for more info, run: npm why @expo/config-plugins)

@expo/config-plugins@5.0.4 node_modules/@morrowdigital/watermelondb-expo-plugin/node_modules/@expo/config-plugins @expo/config-plugins@"^5.0.4" from @morrowdigital/watermelondb-expo-plugin@2.1.0 node_modules/@morrowdigital/watermelondb-expo-plugin @morrowdigital/watermelondb-expo-plugin@"^2.1.0" from the root project

brunokiafuka commented 1 year ago

Hi @wtcosta we have tested it against Expo SDK 48, is there a specific issue you are getting?

Can you please provide a reproducible example?

wtcosta commented 1 year ago

Quando eu rodo: $ expo-cli doctor Retorno: Expected package @expo/config-plugins@~6.0.0 Found invalid: @expo/config-plugins@5.0.4 @expo/config-plugins@5.0.4 (for more info, run: npm why @expo/config-plugins)

quando eu rodo: $ npm why @expo/config-plugins Retorno: @expo/config-plugins@5.0.4 node_modules/@morrowdigital/watermelondb-expo-plugin/node_modules/@expo/config-plugins @expo/config-plugins@"^5.0.4" from @morrowdigital/watermelondb-expo-plugin@2.1.0 node_modules/@morrowdigital/watermelondb-expo-plugin @morrowdigital/watermelondb-expo-plugin@"^2.1.0" from the root project

Imagino que a dependencia @expo/config-plugins precisa ser atualizada pra versão 6

brunokiafuka commented 1 year ago

We will update this. Yet, can you confirm it this is stopping you from running your project? - Before we push a fix for this.

Also can you try doing the following:

If the issue persists and it prevents from interacting with the app let us know so we can update the dependency on our end.

ManuelTS commented 1 year ago

I'm having the same issue I think, here my package.json dependencies:

  "dependencies": {
    "@expo/vector-icons": "13.0.0",
    "@morrowdigital/watermelondb-expo-plugin": "2.1.0",
    "@nozbe/watermelondb": "0.25.5",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-navigation/bottom-tabs": "6.5.7",
    "@react-navigation/native": "6.1.6",
    "@react-navigation/native-stack": "6.9.12",
    "axios": "1.3.4",
    "expo": "48.0.9",
    "expo-asset": "8.9.1",
    "expo-av": "13.2.1",
    "expo-build-properties": "0.5.1",
    "expo-camera": "13.2.1",
    "expo-constants": "14.2.1",
    "expo-dev-client": "2.1.6",
    "expo-font": "11.1.1",
    "expo-image-picker": "14.1.1",
    "expo-linking": "4.0.1",
    "expo-screen-orientation": "5.1.1",
    "expo-splash-screen": "0.18.1",
    "expo-status-bar": "1.4.4",
    "expo-system-ui": "2.2.1",
    "expo-updates": "0.16.3",
    "expo-web-browser": "12.1.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.4",
    "react-native-dotenv": "3.4.8",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "3.20.0",
    "react-native-signature-canvas": "4.5.0",
    "react-native-svg": "13.4.0",
    "react-native-web": "0.18.12",
    "react-native-webview": "11.26.0"
  },
  "devDependencies": {
    "@babel/core": "7.21.0",
    "@babel/eslint-parser": "7.19.1",
    "@babel/plugin-proposal-class-properties": "7.18.6",
    "@babel/plugin-proposal-decorators": "7.21.0",
    "@babel/plugin-transform-runtime": "7.21.0",
    "@expo/config-plugins": "6.0.1",
    "@expo/prebuild-config": "6.0.0",
    "@tsconfig/react-native": "2.0.3",
    "@types/jest": "29.4.0",
    "@types/react": "18.0.28",
    "@types/react-native": "0.71.3",
    "@types/react-test-renderer": "18.0.0",
    "@typescript-eslint/eslint-plugin": "5.54.0",
    "eslint": "8.35.0",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-n": "15.6.1",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "eslint-plugin-promise": "6.1.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-native": "4.0.0",
    "jest": "29.4.3",
    "jest-expo": "48.0.2",
    "prettier": "2.8.4",
    "react-test-renderer": "18.2.0",
    "typescript": "4.9.5"
  },
  "engines": {
    "node": "16.18.1",
    "npm": "8.19.2"
  },

npm view expo-cli:

expo-cli@6.3.2 
...
dist-tags:
latest: 6.3.2  next: 6.3.3

And npm why @expo/config-plugins | head -n 40 gives

@expo/config-plugins@6.0.1
node_modules/@expo/config-plugins
  dev @expo/config-plugins@"6.0.1" from the root project
  @expo/config-plugins@"~6.0.0" from @expo/cli@0.6.2
  node_modules/@expo/cli
    @expo/cli@"0.6.2" from expo@48.0.9
    node_modules/expo
      expo@"48.0.9" from the root project
      peer expo@"*" from expo-application@5.1.1
      node_modules/expo-application
        expo-application@"~5.1.1" from expo@48.0.9
      peer expo@"*" from expo-av@13.2.1
      node_modules/expo-av
        expo-av@"13.2.1" from the root project
      peer expo@"*" from expo-build-properties@0.5.1
      node_modules/expo-build-properties
        expo-build-properties@"0.5.1" from the root project
      peer expo@"*" from expo-camera@13.2.1
      node_modules/expo-camera
        expo-camera@"13.2.1" from the root project
      peer expo@"*" from expo-constants@14.2.1
      node_modules/expo-constants
        expo-constants@"14.2.1" from the root project
        expo-constants@"~14.2.1" from expo@48.0.9
        expo-constants@"~14.2.0" from expo-asset@8.9.1
        node_modules/expo-asset
          expo-asset@"8.9.1" from the root project
          expo-asset@"~8.9.1" from expo@48.0.9
        expo-constants@"~14.2.0" from expo-linking@4.0.1
        node_modules/expo-linking
          expo-linking@"4.0.1" from the root project
      peer expo@"*" from expo-dev-client@2.1.6
      node_modules/expo-dev-client
        expo-dev-client@"2.1.6" from the root project
      peer expo@"*" from expo-dev-launcher@2.1.6
      node_modules/expo-dev-launcher
        expo-dev-launcher@"2.1.6" from expo-dev-client@2.1.6
        node_modules/expo-dev-client
          expo-dev-client@"2.1.6" from the root project
      peer expo@"*" from expo-dev-menu@2.1.4

and when I start the app with expo start --android I get

Android Bundling complete 3031ms
 ERROR  ReferenceError: Property 'relation' doesn't exist, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

But I have in the app.json:

    "plugins": [
      [
        "expo-camera",
        {
          "cameraPermission": "Allow $(PRODUCT_NAME) to access your camera."
        }
      ],
      "@morrowdigital/watermelondb-expo-plugin",
      [
        "expo-build-properties",
        {
          "android": {
            "kotlinVersion": "1.6.10"
          }
        }
      ]
    ],

and my babel.config.js is

module.exports = (api) => {
  api.cache(true);
  return {
    presets: ['babel-preset-expo', 'module:metro-react-native-babel-preset'],
    plugins: [
      [
        'module:react-native-dotenv',
        {
          envName: 'APP_ENV',
          moduleName: '@env',
          path: '.env',
          safe: false,
          allowUndefined: true,
          verbose: false
        }
      ],
      [
        '@babel/plugin-proposal-decorators',
        {
          'legacy': true
        }
      ],
      ['@babel/plugin-proposal-class-properties', { 'loose': true }],
      [
        '@babel/plugin-transform-runtime',
        {
          'helpers': true,
          'regenerator': true
        }
      ]
    ]
  };
};

and my tsconfig.json is

{
  "extends": "@tsconfig/react-native/tsconfig.json",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "*": ["./*"],
    },
    "experimentalDecorators": true,
    "typeRoots": ["./types"]
  },
  "exclude": ["node_modules", "build", "babel.config.js"]
}

I tried to add watermelobDB by your example, but something is wrong and I don't know what or where.

ManuelTS commented 1 year ago

... and the expo doctor mentions the version conflict too: image so despite our issues but due to the expo doctor, I think this issue should be fixed anyways @brunokiafuka

ManuelTS commented 1 year ago

I followed the documentation 02 Learn to use Watermelon, however I'm getting the same issue for Android API 33 with the following dependencies:

...
  "dependencies": {
    "@expo/vector-icons": "13.0.0",
    "@morrowdigital/watermelondb-expo-plugin": "2.1.0",
    "@nozbe/watermelondb": "0.25.5",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-navigation/bottom-tabs": "6.5.7",
    "@react-navigation/native": "6.1.6",
    "@react-navigation/native-stack": "6.9.12",
    "axios": "1.3.4",
    "expo": "48.0.9",
    "expo-sqlite": "11.1.1",
    "expo-asset": "8.9.1",
    "expo-av": "13.2.1",
    "expo-build-properties": "0.5.1",
    "expo-camera": "13.2.1",
    "expo-constants": "14.2.1",
    "expo-dev-client": "2.1.6",
    "expo-font": "11.1.1",
    "expo-image-picker": "14.1.1",
    "expo-linking": "4.0.1",
    "expo-screen-orientation": "5.1.1",
    "expo-splash-screen": "0.18.1",
    "expo-status-bar": "1.4.4",
    "expo-system-ui": "2.2.1",
    "expo-updates": "0.16.3",
    "expo-web-browser": "12.1.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.4",
    "react-native-dotenv": "3.4.8",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "3.20.0",
    "react-native-signature-canvas": "4.5.0",
    "react-native-svg": "13.4.0",
    "react-native-web": "0.18.12",
    "react-native-webview": "11.26.0"
  },
  "devDependencies": {
    "@babel/core": "7.21.0",
    "@babel/eslint-parser": "7.19.1",
    "@babel/plugin-proposal-class-properties": "7.18.6",
    "@babel/plugin-proposal-decorators": "7.21.0",
    "@babel/plugin-transform-runtime": "7.21.0",
    "@expo/config-plugins": "6.0.1",
    "@expo/prebuild-config": "6.0.0",
    "@tsconfig/react-native": "2.0.3",
    "@types/jest": "29.4.0",
    "@types/react": "18.0.28",
    "@types/react-native": "0.71.3",
    "@types/react-test-renderer": "18.0.0",
    "@typescript-eslint/eslint-plugin": "5.56.0",
    "eslint": "8.35.0",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-n": "15.6.1",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "eslint-plugin-promise": "6.1.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-native": "4.0.0",
    "jest": "29.4.3",
    "jest-expo": "48.0.2",
    "prettier": "2.8.4",
    "react-test-renderer": "18.2.0",
    "typescript": "4.9.5"
  },
  "engines": {
    "node": "16.18.1",
    "npm": "8.19.2"
  },
  "private": true
}

Anyone an idea?

ManuelTS commented 1 year ago

I was able to resolve this issue by using the Expo Go method registerRootComponent and renaming my App.tsx file to Main.tsx. Reason is, the generated MainActivity.java#getMainComponentName() by expo run:android return always "main".

A fun bug, I use React Native and Expo Go to avoid developing Android natively with .java files and have to inspect .java files to resolve an bug obfuscated by react native, expo go, watermelonDB, and -plugin documentation as in there, solely the filename App.js|.tsx is used.

As probably many developers may be affected I link to the other issue on WatermelonDB: https://github.com/Nozbe/WatermelonDB/issues/1575

This only works for expo run, expo start still fails...

brunokiafuka commented 1 year ago

Upgraded @expo/config-plugins in latest release "@morrowdigital/watermelondb-expo-plugin": "^2.1.2"