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
When items passed to <Picker /> is an empty array (e.g. due to filtering using Search), app crashes.
This is due to the fact that in PickerItemsList.tsx when initializing wheelPickerValue on line 38 it's assumed that if items is defined, there is at least one item:
an extra ? for optional chaining will solve the issue:
items?.[0]?.value
Workaround
Don't pass an empty array as items. Instead you can pass a null for example.
Related to
Components
Demo
Docs
Typings
Steps to reproduce
Expected behavior
App doesn't crash
Actual behavior
App crashes with an error
TypeError: Cannot read property 'value' of undefined
This error is located at:
in PickerItemsList (at picker/index.js:193)
in RCTView (at View.js:116)
in View (at view/index.js:92)
in View (at modal/index.js:81)
in RCTView (at View.js:116)
in View (at AppContainer.js:127)
More Info
Code snippet
<Picker items={[]} />
Screenshots/Video
Environment
React Native version: 0.73.2
React Native UI Lib version: 7.16.0
Affected platforms
Android
iOS
Web
The text was updated successfully, but these errors were encountered:
Description
When
items
passed to<Picker />
is an empty array (e.g. due to filtering using Search), app crashes.This is due to the fact that in
PickerItemsList.tsx
when initializingwheelPickerValue
on line38
it's assumed that ifitems
is defined, there is at least one item:an extra
?
for optional chaining will solve the issue:Workaround
Don't pass an empty array as
items
. Instead you can pass anull
for example.Related to
Steps to reproduce
Expected behavior
App doesn't crash
Actual behavior
App crashes with an error
More Info
Code snippet
Screenshots/Video
Environment
0.73.2
7.16.0
Affected platforms
The text was updated successfully, but these errors were encountered: