Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix ReactActivity.getReactDelegate().reload() (#44223)
Summary: fixing some problem for `ReactActivity.getReactDelegate().reload()` from #43521: - the `reload()` does not work for bridge mode on release build ## Changelog: [ANDROID] [FIXED] - Fixed app reloading for `ReactActivity.getReactDelegate().reload()`. Pull Request resolved: #44223 Test Plan: tried to temporary change toast.show as reload and test from rn-tester ```diff --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.kt @@ -10,6 +10,7 @@ package com.facebook.react.modules.toast import android.view.Gravity import android.widget.Toast import com.facebook.fbreact.specs.NativeToastAndroidSpec +import com.facebook.react.ReactActivity import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.UiThreadUtil @@ -30,9 +31,11 @@ public class ToastModule(reactContext: ReactApplicationContext) : ) override public fun show(message: String?, durationDouble: Double) { - val duration = durationDouble.toInt() - UiThreadUtil.runOnUiThread( - Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) +// val duration = durationDouble.toInt() +// UiThreadUtil.runOnUiThread( +// Runnable { Toast.makeText(getReactApplicationContext(), message, duration).show() }) + val activity = reactApplicationContext.currentActivity as? ReactActivity + activity?.reactDelegate?.reload() } override public fun showWithGravity( ``` tried for different mode - [x] bridge mode + debug build - [x] bridgeless mode + debug build - [x] bridge mode + release build - [x] bridgeless mode + release build Reviewed By: fkgozali Differential Revision: D56795975 Pulled By: arushikesarwani94 fbshipit-source-id: 895eab1927ba6db748ebb32c0fd5313f19cf9d1b
- Loading branch information