-
-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RN 0.70 crashes #381
Comments
Patched it quickly this way: diff --git a/node_modules/react-native-inappbrowser-reborn/utils.js b/node_modules/react-native-inappbrowser-reborn/utils.js
index 9fe6085..c7ca6e8 100644
--- a/node_modules/react-native-inappbrowser-reborn/utils.js
+++ b/node_modules/react-native-inappbrowser-reborn/utils.js
@@ -5,22 +5,24 @@
import invariant from 'invariant';
import {
- processColor,
+ AppState,
Linking,
+ NativeModules,
Platform,
- AppState,
- NativeModules
+ processColor
} from 'react-native';
+
import type {
+ AuthSessionResult,
BrowserResult,
+ InAppBrowserOptions,
RedirectEvent,
- RedirectResult,
- AuthSessionResult,
- InAppBrowserOptions
+ RedirectResult
} from './types';
export const RNInAppBrowser = NativeModules.RNInAppBrowser;
+let _redirectListener = null
let _redirectHandler: ?(event: RedirectEvent) => void;
type AppStateStatus = typeof AppState.currentState
@@ -33,7 +35,7 @@ function waitForRedirectAsync(returnUrl: string): Promise<RedirectResult> {
}
};
- Linking.addEventListener('url', _redirectHandler);
+ _redirectListener = Linking.addEventListener('url', _redirectHandler);
});
}
@@ -42,17 +44,19 @@ function waitForRedirectAsync(returnUrl: string): Promise<RedirectResult> {
*/
function handleAppStateActiveOnce(): Promise<void> {
return new Promise(function (resolve) {
+ let listener=null
+
// Browser can be closed before handling AppState change
if (AppState.currentState === 'active') {
return resolve();
}
function handleAppStateChange(nextAppState: AppStateStatus) {
if (nextAppState === 'active') {
- AppState.removeEventListener('change', handleAppStateChange);
+ listener.remove()
resolve();
}
}
- AppState.addEventListener('change', handleAppStateChange);
+ listener = AppState.addEventListener('change', handleAppStateChange);
});
}
@@ -137,7 +141,9 @@ export async function openAuthSessionPolyfillAsync(
export function closeAuthSessionPolyfillAsync(): void {
if (_redirectHandler) {
- Linking.removeEventListener('url', _redirectHandler);
+ _redirectListener.remove()
+
+ _redirectListener = null
_redirectHandler = null;
}
} |
Can confirm, I got the same error on 0.70.2. Could fix the crash with your patch on version 3.6.3, thanks for that!. Would be nice if this could be merged in a new release soon. |
Ran into this problem as well, would love to have this merged in to avoid applying a patch. |
Also crashed, here is my logcat: 11-28 16:42:56.014 10270 10313 E AndroidRuntime: ob.e: Subscriber class d8.c and its super classes have no public methods with the @Subscribe annotation
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at ob.p.a(Unknown Source:58)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at ob.c.p(Unknown Source:6)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at d8.c.l(Unknown Source:14)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at d8.c.k(Unknown Source:352)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at com.proyecto26.inappbrowser.RNInAppBrowserModule.open(Unknown Source:10)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:148)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:147)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at com.facebook.jni.NativeRunnable.run(Native Method)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:808)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:101)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at android.os.Looper.loop(Looper.java:166)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
11-28 16:42:56.014 10270 10313 E AndroidRuntime: at java.lang.Thread.run(Thread.java:784) UPDATE: I reallized that my problem may caused by ProGuard, and fixed it through modify |
Running in the same issue on android. Any plans on fixing this? 🤔 Same error in logs:
|
Hey folks, thanks for reporting this issue! Let me try ASAP! <3 |
any news guys? |
this has been fixed in this PR if I'm not wrong : #297 It handles both appstate and linking compatibility. What am I missing? |
RN 0.70 deprecated:
AppState.removeEventListener: https://reactnative.dev/docs/appstate#removeeventlistener
Linking.removeEventListener: https://reactnative.dev/docs/linking#removeeventlistener
Both are used in utils.js and cause crashes on Android.
The text was updated successfully, but these errors were encountered: