ivopr / tamagui-expo

An Expo template with Tamagui
270 stars 22 forks source link

Different kind of issues when upgrading to Expo SDK 50 #52

Closed dxloop closed 9 months ago

dxloop commented 11 months ago

Repo:

Upgrade to Expo SDK 50

npm install expo@50
npm install expo-router@3
npx expo install --fix

Remove require of expo-router babel plugin in babel.config.js

Error 1

error: node_modules\expo-router\_ctx.android.js: node_modules\expo-router\_ctx.android.js:Invalid call at line <unknown>: undefined
First argument of `require.context` should be a string denoting the directory to require

Error 2

node_modules\expo-router\build\qualified-entry.js: Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.
  18 | function App() {
  19 |     return (<head_1.Head.Provider>
> 20 |       <ExpoRoot_1.ExpoRoot context={_ctx_1.ctx}/>
     |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  21 |     </head_1.Head.Provider>);
  22 | }
  23 | exports.App = App;

Config

process.env.TAMAGUI_TARGET = "native"; // Don't forget to specify your TAMAGUI_TARGET here

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      [
        "transform-inline-environment-variables",
        // NOTE: include is optional, you can leave this part out
        {
          include: ["TAMAGUI_TARGET", "EXPO_ROUTER_APP_ROOT"]
        }
      ],
      [
        "@tamagui/babel-plugin",
        {
          components: ["tamagui"],
          config: "./tamagui.config.ts",
          logTimings: true
        }
      ],
      "react-native-reanimated/plugin"
    ]
  };
};
ChronoByteCosmonaut commented 10 months ago

Same

ivopr commented 10 months ago

@GeorgiIvanovPXL @dxloop I'm not sure, but this seems similar to https://docs.expo.dev/router/reference/troubleshooting/

I'll wait till it comes out of beta to check it though.

dxloop commented 10 months ago

Remove transform ... package with target config then it should at least boot up. But then a new known issue arises reanimated does not work...

dxloop commented 10 months ago

@GeorgiIvanovPXL @dxloop I'm not sure, but this seems similar to https://docs.expo.dev/router/reference/troubleshooting/

I'll wait till it comes out of beta to check it though.

Cool, they released it. I will give it tomorrow a try...

dxloop commented 10 months ago

Having other issues now 👀

 WARN  [Reanimated] Couldn't determine the version of the native part of Reanimated.
    See `https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#couldnt-determine-the-version-of-the-native-part-of-reanimated` for more details.
    [STACK TRACE.....................]

 ERROR  Warning: Cannot update a component (`Button`) while rendering a different component (`Button`). To locate the bad setState() call inside `Button`, follow the stack trace as described in https://react.dev/link/setstate-in-render
    in Button
    in Unknown (created by Themed(Anonymous))
    in Theme (created by Themed(Anonymous))
    in Themed(Anonymous) (at app/index.tsx:19)
    in RCTView (created by YStack)
    in YStack (at app/index.tsx:18)
    in RCTView (created by MyStack)
    in MyStack (at app/index.tsx:10)
    in Home (at useScreens.js:112)
    in Unknown (at useScreens.js:116)
    in Suspense (at useScreens.js:115)
    in Route (at useScreens.js:131)
    in Route(index) (at SceneView.tsx:132)
anthonyn60 commented 10 months ago

With reanimated locked at 3.3.0, my iOS app won't even build (yoga/style/Style.h not found).

Upgrading to 3.6.2 gets it through to the build, but then there's the following issue when you run the app: NativeViewGestureHandler must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/installation for more details.

Also confirming that removing the environment variable transform causes the ctx problems to go away. I think's because it conflicts with the default which causes the env variable required in the ctx to evaluate to null.

I've reverted back to Expo 49 in the meantime. Thanks for looking into this!

ivopr commented 9 months ago

took some time, but it is upgraded.

there were some things I couldn't find a way to correct though.

custom components made with tamagui's styled are complaining about having Element as children instead of string but everything works.