one icon indicating copy to clipboard operation
one copied to clipboard

fix(android): use `expo-platform` over `user-agent`

Open szymonrybczak opened this issue 1 year ago • 3 comments
trafficstars

For some reason on Android user-agent doesn't contain React or Expo keyword.

szymonrybczak avatar Apr 13 '24 23:04 szymonrybczak

@natew could you verify if that works in your setup? my is still breaking because of some strange react-native-screens imports problem (even after applying patch).

szymonrybczak avatar Apr 13 '24 23:04 szymonrybczak

Breaking on android? I think we patch just one of the files, does android have a specific platform file? That's one thing we need to get better support of in general.

natew avatar Apr 14 '24 00:04 natew

Hm, yea - after applying patch properly, Rollup doesn't give the error. But esbuild only resolves the first extension it found, so in our case it cause another problem - when we're fetching bundle for Android and we have:

    resolveExtensions: [
      '.ios.js',
      '.android.js',
    ]

it will pick Platform.ios.js and in react-native.js we'll have OS: "ios" which is the reason why it doesn't work. I guess we need to pass proper extension based on ?platform query param

szymonrybczak avatar Apr 14 '24 12:04 szymonrybczak