[expo-dev-launcher][Android] Fix for "Can't toast on a thread that has not called Looper.prepare()" (#23706)# Why When the toggleJSSamplingProfiler() method is triggered, the application throws
[expo-dev-launcher][Android] Fix for "Can't toast on a thread that has not called Looper.prepare()" (#23706)# Why When the toggleJSSamplingProfiler() method is triggered, the application throws an exception "Can't toast on a thread that has not called Looper.prepare()". This happens because the Toast.makeText().show() method is being invoked from a non-UI thread. # How The solution involves using a Handler initialized with the Main Looper to post the toast operation on the main UI thread. By invoking the Toast.makeText().show() method inside the run() method of a Runnable posted to the main thread, we can ensure that the toast operation is performed on the main UI thread, thus preventing the exception from being thrown. # Test Plan Tested on Pixel 7 (real device) and on an Pixel 5 emulator, both running Android 13 # Checklist - [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
show more ...
[dev-launcher] fix hermes inspector connection issue (#22726)# Why fixes #20280 close ENG-8769 # How our original `stopInspector() -> startInspector()` is not reliable because of thread r
[dev-launcher] fix hermes inspector connection issue (#22726)# Why fixes #20280 close ENG-8769 # How our original `stopInspector() -> startInspector()` is not reliable because of thread race condition issue. looking into the [react-native code](https://github.com/facebook/react-native/blob/7f22db8ea034d1aed74103542b04af2a8a11caa1/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java#L207-L241), it posts task to background AsyncTask thread pool. so it could happen two different error cases: ### Case 1 with empty inspector targets `http://localhost:8081/json/list` returns empty array 1. openInspectorConnection() from ReactInstanceManager posted task 2. openInspectorConnection() from ReactInstanceManager executed in AsyncTask thread pool 3. closeInspectorConnection() from DevLauncherReactUtils posted task 4. openInspectorConnection() from DevLauncherReactUtils showing warning `Inspector connection already open, nooping.` and just returns. 5. closeInspectorConnection() from DevLauncherReactUtils executed in AsyncTask thread pool ### Case 2 with double inspector targets `http://localhost:8081/json/list` returns 6 items for bare-expo (2 + 1) x 2. 1. openInspectorConnection() from ReactInstanceManager posted task 2. closeInspectorConnection() from DevLauncherReactUtils posted task 3. openInspectorConnection() from DevLauncherReactUtils posted task 4. closeInspectorConnection() from DevLauncherReactUtils executed in AsyncTask thread pool 5. openInspectorConnection() from ReactInstanceManager executed in the AsyncTask thread pool 6. openInspectorConnection() from DevLauncherReactUtils executed in the AsyncTask thread pool that is my hypothesis, i did not confirm with logging. since it's a thread pool, so the out-of-order case may happen. # Test Plan tested on bare-expo and turning on `USE_DEV_CLIENT = true` in **MainApplication.java**
[dev-launcher][dev-menu] fix nightlies build error 0.73.0-nightly-20230515-066f0b76d (#22503)# Why fix react-native nightlies build error (0.73.0-nightly-20230515-066f0b76d) which was caused mai
[dev-launcher][dev-menu] fix nightlies build error 0.73.0-nightly-20230515-066f0b76d (#22503)# Why fix react-native nightlies build error (0.73.0-nightly-20230515-066f0b76d) which was caused mainly by [`DevInternalSettings` updated as package-private](https://github.com/facebook/react-native/commit/1a9e444b616300666) # How - move `DevLauncherInternalSettings` and `DevMenuDevSettings` into `com.facebook.react.devsupport` package, so that we can inherit the package-private `DevInternalSettings`. - introducing `DevLauncherInternalSettingsWrapper` and `DevMenuInternalSettingsWrapper` allows us to access the package-private `DevInternalSettings` - some misc changes i will leave in pr inline comments # Test Plan - test suite ci passed - test suite nightlies ci passed
[1/3] upgrade react-native 0.71 (#20799)# Why upgrade react-native 0.71 for sdk 48 close ENG-7192 # How - update package versions - `react: 18.1.0 -> 18.2.0` - `react-native 0.70.5
[1/3] upgrade react-native 0.71 (#20799)# Why upgrade react-native 0.71 for sdk 48 close ENG-7192 # How - update package versions - `react: 18.1.0 -> 18.2.0` - `react-native 0.70.5 -> 0.71.0` - `react-dom: 18.1.0 -> 18.2.0` - `react-test-renderer: 18.1.0 -> 18.2.0` - `react-native-web: 0.18.9 -> 0.18.10` - `babel-plugin-react-native-web: 0.18.9 -> 0.18.10` - `metro-react-native-babel-preset: 0.72.3 -> 0.73.5` - upgrade three project templates based on [upgrade-helper](https://react-native-community.github.io/upgrade-helper/?from=0.70.6&to=0.71.0) - bare-expo - expo-template-bare-minimum - fabric-tester (this is based on `npx expo prebuild --clean --no-install --template /path/to/expo-template-bare-minimum.tgz`) so it includes some inconsistent changes - [@expo/config-plugins]: support 0.71 template transform. the `namespace` in build.gradle and the files in `release` build variants - [fbjni] upgrade 0.3.0 to align 0.71 (also ndk version) - [expo-updates] move the `EX_UPDATES_NATIVE_DEBUG` `bundleInDebug` setup to templates. unfortunately, because RNGP setups the task dependencies pretty early. the original setup in expo-updates build.gradle is too late. note that the change doesn't reference any files from templates to expo-updates package. somehow it's not tightly coupled. - [native-tests / expo-modules-test-core / expo-modules-autolinking] fix ios unit test build error because jsc now in a dedicated podspec. in theory, the ios native unit test could now run on hermes as well. - for other details, please check commit histories one by one. # Test Plan - bare-expo ios / android - fabric ios / android - ci passed (except ios) - test-suite ios is broken for unknown reasons. it breaks only on github actions and hermes. for nightlies testing, i also [changed it to jsc](https://github.com/expo/expo/blob/1e029c89c4247802cc4880e27e116a6b4c71c502/tools/src/commands/SetupReactNativeNightly.ts#L287-L293) to make ci green. i'll try to follow up and investigate the root cause.