react-native-keyboard-controller
react-native-keyboard-controller copied to clipboard
iOS -> App hanging for at least 2000 ms. App Hanging <compiler-generated> thunk for closure
Describe the bug Sentry reports that for some iOS users, the app hangs for 2000ms or more due to this library
Code snippet
import MyApp from "MyApp";
import React, { useEffect } from "react";
import "./src/localization/i18n";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
import * as Sentry from "@sentry/react-native";
import APIConstants from "models/APIConstants/API_CONSTANTS";
export const navigationIntegration = Sentry.reactNavigationIntegration({
enableTimeToInitialDisplay: true,
});
export const IGNORE_SENTRY_PASSPHRASE: string = "IGNORE SENTRY PASSPHRASE";
Sentry.init({
dsn: APIConstants.SENTRY_URL,
enabled: SENTRY_URL && !__DEV__ ? true : false,
// spotlight: __DEV__,
tracesSampleRate: 1.0,
integrations: [navigationIntegration],
sendDefaultPii: true,
ignoreErrors: [IGNORE_SENTRY_PASSPHRASE],
});
import { GoogleSignin } from "@react-native-google-signin/google-signin";
import { IOS_AUTH_CLIENTID, SENTRY_URL, WEB_CLIENT_AUTH_ID } from "@env";
import { useThemeStore } from "zustand/themes/useThemeStore";
import { KeyboardProvider } from "react-native-keyboard-controller";
const App = () => {
const backgroundColor = useThemeStore((state) => state.colors.background);
useEffect(() => {
configureGoogleSignin();
}, []);
const configureGoogleSignin = () => {
GoogleSignin.configure({
webClientId: WEB_CLIENT_AUTH_ID,
iosClientId: IOS_AUTH_CLIENTID,
});
};
return (
<SafeAreaProvider style={{ flex: 1, backgroundColor: backgroundColor }}>
<KeyboardProvider>
<GestureHandlerRootView>
<MyApp />
</GestureHandlerRootView>
</KeyboardProvider>
</SafeAreaProvider>
);
};
export default Sentry.wrap(App);
Expected behavior No app hangs.
Smartphone (please complete the following information):
- Device: iPhone
- OS: 22% on iOS 18.6.2, 14% on iOS 26.0.1, 10% on iOS 18.5, 8% on iOS 26.0, 6% on iOS 18.3.2, 6% on iOS 16.7.11, 33% on others
- RN version: 0.79.6
- RN architecture: OLD/legacy architecture
- JS engine: Hermes
- Library version: 1.18.2
Additional context
Stack trace
App Hanging: App hanging for at least 2000 ms.
libsystem_kernel 0x1ec112090 __psynch_cvwait
libsystem_pthread 0x225728fc0 _pthread_cond_wait
Foundation 0x199737720 -[NSCondition waitUntilDate:]
Foundation 0x199737668 -[NSConditionLock lockWhenCondition:beforeDate:]
UIKitCore 0x19e191674 -[UIKeyboardTaskQueue _lockWhenReadyForMainThread]
UIKitCore 0x19db4dbbc __80-[_UIKeyboardStateManager syncDocumentStateToInputDelegateWithExecutionContext:]_block_invoke_3
UIKitCore 0x19e1915cc -[UIKeyboardTaskQueue lockWhenReadyForMainThread]
UIKitCore 0x19e1921c4 -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished]
UIKitCore 0x19db3f114 -[_UIKeyboardStateManager _teardownExistingDelegate:forSetDelegate:force:delayEndInputSession:]
UIKitCore 0x19d511cc0 -[_UIKeyboardStateManager setDelegate:force:delayEndInputSession:]
UIKitCore 0x19d3e6fd8 -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:]
UIKitCore 0x19d61d0d8 -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:force:fromBecomeFirstResponder:]
UIKitCore 0x19d2b4014 -[UIResponder _finishResignFirstResponderFromBecomeFirstResponder:]
UIKitCore 0x19e627094 -[UITextField _finishResignFirstResponder]
UIKitCore 0x19d2b2b90 -[UIResponder resignFirstResponder]
MyAppMobile 0x1029b2fc8 closure in UIResponder.swizzleResignFirstResponder (UIResponderSwizzle.swift)
MyAppMobile 0x1029b2d74 thunk for closure (<compiler-generated>)
UIKitCore 0x19e626f84 -[UITextField resignFirstResponder]
MyAppMobile 0x1029b2828 closure in UIResponder.preloadKeyboardIfNeeded
MyAppMobile 0x102414cd4 thunk for closure (<compiler-generated>)
libdispatch 0x1a27a1244 _dispatch_call_block_and_release
libdispatch 0x1a27a2fa4 _dispatch_client_callout
libdispatch 0x1a27b1a30 _dispatch_main_queue_drain
libdispatch 0x1a27b1648 _dispatch_main_queue_callback_4CF
CoreFoundation 0x19aa5ebc8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
CoreFoundation 0x19aa5b1bc __CFRunLoopRun
CoreFoundation 0x19aaad280 CFRunLoopRunSpecific
GraphicsServices 0x1e7ced4bc GSEventRunModal
UIKitCore 0x19d5f2670 -[UIApplication _run]
UIKitCore 0x19d218e84 UIApplicationMain
MyAppMobile 0x10241448c main (main.m:8)
dyld 0x1c0cf1de4 start
libsystem_kernel 0x1ec112090 __psynch_cvwait
libsystem_pthread 0x225728fc0 _pthread_cond_wait
Foundation 0x199737720 -[NSCondition waitUntilDate:]
Foundation 0x199737668 -[NSConditionLock lockWhenCondition:beforeDate:]
UIKitCore 0x19e191674 -[UIKeyboardTaskQueue _lockWhenReadyForMainThread]
UIKitCore 0x19db4dbbc __80-[_UIKeyboardStateManager syncDocumentStateToInputDelegateWithExecutionContext:]_block_invoke_3
UIKitCore 0x19e1915cc -[UIKeyboardTaskQueue lockWhenReadyForMainThread]
UIKitCore 0x19e1921c4 -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished]
UIKitCore 0x19db3f114 -[_UIKeyboardStateManager _teardownExistingDelegate:forSetDelegate:force:delayEndInputSession:]
UIKitCore 0x19d511cc0 -[_UIKeyboardStateManager setDelegate:force:delayEndInputSession:]
UIKitCore 0x19d3e6fd8 -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:]
UIKitCore 0x19d61d0d8 -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:force:fromBecomeFirstResponder:]
UIKitCore 0x19d2b4014 -[UIResponder _finishResignFirstResponderFromBecomeFirstResponder:]
UIKitCore 0x19e627094 -[UITextField _finishResignFirstResponder]
UIKitCore 0x19d2b2b90 -[UIResponder resignFirstResponder]
MyAppMobile 0x1029b2fc8 closure in UIResponder.swizzleResignFirstResponder (UIResponderSwizzle.swift)
MyAppMobile 0x1029b2d74 thunk for closure (<compiler-generated>)
UIKitCore 0x19e626f84 -[UITextField resignFirstResponder]
MyAppMobile 0x1029b2828 closure in UIResponder.preloadKeyboardIfNeeded
MyAppMobile 0x102414cd4 thunk for closure (<compiler-generated>)
libdispatch 0x1a27a1244 _dispatch_call_block_and_release
libdispatch 0x1a27a2fa4 _dispatch_client_callout
libdispatch 0x1a27b1a30 _dispatch_main_queue_drain
libdispatch 0x1a27b1648 _dispatch_main_queue_callback_4CF
CoreFoundation 0x19aa5ebc8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
CoreFoundation 0x19aa5b1bc __CFRunLoopRun
CoreFoundation 0x19aaad280 CFRunLoopRunSpecific
GraphicsServices 0x1e7ced4bc GSEventRunModal
UIKitCore 0x19d5f2670 -[UIApplication _run]
UIKitCore 0x19d218e84 UIApplicationMain
MyAppMobile 0x10241448c main (main.m:8)
dyld 0x1c0cf1de4 start