Closed
Description
Describe the bug
In my React Native app, on forms with a text input and Expo image picker, pressing a text input after opening/closing the image picker causes the app to crash. Simply wrapping the app in <KeyboardProvider>
is enough to cause this behaviour, without using any other components from react-native-keyboard-controller
.
Code snippet
Note, although this snippet uses react-hook-forms
, the crashing behaviour happens elsewhere in the app where this isn't used.
...
return (
<ScrollView
contentContainerStyle={styles.container}
style={styles.background}
showsVerticalScrollIndicator={false}
>
<View>
<Controller
control={control}
name={"bannerImage"}
render={renderBannerImagePicker}
/>
</View>
<View style={styles.formSection}>
<Label
required
text={i18n.t("screens.birdingGroupCreateChallenge.name")}
/>
<Controller name={"name"} control={control} render={renderName} />
</View>
</ScrollView>
App.tsx
...
return (
<KeyboardProvider>
<GestureHandlerRootView style={styles.gestureView}>
<LoginProvider
isLoggedIn={isLoggedIn && !!currentUser}
currentUser={currentUser}
>
<DatabaseProvider>
<ApolloProvider client={client}>
<CachePersistorProvider>
<SafeAreaProvider>
<ActionSheetProvider>
<SuggestionsProvider>
<FeedWeightingProvider>
<>
<Navigation />
<StatusBar style="dark" />
</>
</FeedWeightingProvider>
</SuggestionsProvider>
</ActionSheetProvider>
</SafeAreaProvider>
</CachePersistorProvider>
</ApolloProvider>
</DatabaseProvider>
</LoginProvider>
</GestureHandlerRootView>
</KeyboardProvider>
);
Error copied from Apple console on Macbook (iPhone connected by USB):
runOperations: -[_UIKeyboardArbiter retrieveClientDebugInformationWithCompletion:] Failed to access <_UIKeyboardArbiterClientHandle: 0x28080e470; PID 14229: com.chirpbirding.birda-dev <<UIKBArbiterClientFocusContext: 0x283970640; contextID = 2f109a25; sceneIdentity = com.apple.frontboard.systemappservices::FBSceneManager:sceneID%3Acom.chirpbirding.birda-dev-default >>; hosting PIDs {(
)}; level 5.000000; active YES [wants YES]; suppression 0; iav 0.000000; on screen YES; isAcquiringFocus: NO> remote service: Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 14229 on mach service named com.apple.UIKit.KeyboardManagement.hosted was invalidated: client is gone." UserInfo={NSDebugDescription=The connection from pid 14229 on mach service named com.apple.UIKit.KeyboardManagement.hosted was invalidated: client is gone.}
To Reproduce
Steps to reproduce the behavior:
- Go to a form with an image picker and text input
- Press the text input and type something - verify that it works correctly and doesn't crash
- Press the image picker. Picker opens
- Choose an image or press cancel (doesn't matter which). Returns to form
- Press text input. App crashes and closes immediately to the device desktop
Expected behavior
- Go to a form with an image picker and text input
- Press the text input and type something - verify that it works correctly and doesn't crash
- Press the image picker. Picker opens
- Choose an image or press cancel (doesn't matter which). Returns to form
- Press text input and type something - it works correctly and doesn't crash
Smartphone (please complete the following information):
- Desktop OS: [e.g. Windows 10, MacOS 10.15.5]
- Device: iPhone X
- OS: IOS 16.4.1
- RN version: 0.71.6
- RN architecture: old
- JS engine: Hermes
- Library version: 1.5.3 (also tried 1.4.4 to no avail)