You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using Expo Router with Stack navigation, enabling headerSearchBarOptions in the Stack Screen options causes the app to crash immediately upon tapping the search bar. This issue only occurs in Release mode on iOS devices with KeyboardProvider.
Error Message:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<_UISearchBarSearchContainerView 0x15ac1d880> valueForUndefinedKey:]: this class is not key value coding-compliant for the key nativeId.'***
1- Set up an Expo Router project with Stack navigation
2- Wrap your layout with KeyboardProvider
3- Enable headerSearchBarOptions in Stack.Screen options
4- Build the app in Release mode
5- Tap on the search bar
Smartphone (please complete the following information):
## 📜 Description
Fixed a crash when you tap on search input inside a header (native
stack).
## 💡 Motivation and Context
When accessing `nativeId` property in classes where it's not available
(for example `UISearchBarSearchContainerView`, but I assume other UIKit
classes as well), we will get a crash:
> *** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<_UISearchBarSearchContainerView 0x15ac1d880>
valueForUndefinedKey:]: this class is not key value coding-compliant for
the key nativeId.'***
To overcome this problem I added a check whether this property is
defined, and if it is defined, only then we query an actual value.
Tested in `FabricExample` and it resolves a crash 🤞
Closes#784
## 📢 Changelog
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### iOS
- check if view responds to `nativeId` selector before querying
`nativeId` value;
## 🤔 How Has This Been Tested?
Tested manually on iPhone 15 Pro (iOS 17.5) in native-stack example,
with adding next options:
```ts
headerSearchBarOptions: {
hideWhenScrolling: false,
placeholder: "Search",
},
```
And also tested Interactive keyboard on iOS (Fabric) to make sure it
works as before.
## 📸 Screenshots (if appropriate):
https://github.com/user-attachments/assets/f7393ec3-1ae7-4500-9fe4-e5857a302ec0
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
Describe the bug
When using Expo Router with Stack navigation, enabling headerSearchBarOptions in the Stack Screen options causes the app to crash immediately upon tapping the search bar. This issue only occurs in Release mode on iOS devices with KeyboardProvider.
Error Message:
Code snippet
To Reproduce
Steps to reproduce the behavior:
1- Set up an Expo Router project with Stack navigation
2- Wrap your layout with KeyboardProvider
3- Enable headerSearchBarOptions in Stack.Screen options
4- Build the app in Release mode
5- Tap on the search bar
Smartphone (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: