-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Crashing on IOS after pressing TextInput after Expo Image Picker #155
Comments
@shedworth so you are experiencing the problem on For me it'll be hard to reproduce, because the setup looks complicated and I don't think I can craft proper repro just based on this information. |
@shedworth could you please check whether #157 fixes the problem or not? |
Still happening unfortunately :( |
@shedworth that's strange... I added I may suppose the problem is somewhere else, but in order to understand that I need to have a reproducible example 🙏 @shedworth just theoretically you can try to move call of |
## 📜 Description Use memoized `keyboardView` reference for removing observer. ## 💡 Motivation and Context Since `keyboardView` is a getter there are some chances that it may return a new reference to a view when we access it. In some cases it may be a problem, because it can return a reference to a view which doesn't contain an observer yet. As a result when we'll try to remove an observer from a view which doesn't have it -> we'll get a crash. To prevent a crash in `removeKVObserver` we start to use `_keyboardView` instead of `keyboardView`. It'll give us an access to old view and we can safely remove the observer. Fixes #155 Potentially also fixes: #152 ## 📢 Changelog ### iOS - use `_keyboardView` instead of `keyboardView` when remove observer; ## 🤔 How Has This Been Tested? Tested on iPhone 14 (simulator, iOS 16.2) using following code: ```tsx <Button title="show image picker" onPress={async () => { // You can also use as a promise without 'callback': const result = await launchImageLibrary(); }} /> ``` ## 📸 Screenshots (if appropriate): |Before|After| |------|-----| |<video src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/077f279e-f95b-4aea-ac09-41d8a7d4c846">|<video src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/e5a5e9aa-2204-42cc-b767-07d43053bf7d">| ## 📝 Checklist - [x] CI successfully passed
GitHub automatically closed this issue since PR that had a reference to this issue was merged. I've published |
@shedworth the similar problem was reported in #175 The reason why it couldn't be reproducible on my setup is the fact that I've used only iOS 16.2/16.3. However you were testing iOS 16.4 #175 was fixed and I published a new So feel free to re-test it too 😎 Hopefully the problem has fully gone 🤞 |
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 fromreact-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.App.tsx
Error copied from Apple console on Macbook (iPhone connected by USB):
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: