react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.45k stars 273 forks source link

[Fabric] [iOS] Fix app crash when selecting an empty value #567

Closed bernhardoj closed 1 month ago

bernhardoj commented 1 month ago

Selecting an item with an empty value crashes the app because we convert an empty string to null, https://github.com/react-native-picker/picker/blob/7b7a95f4fe842d0a0c696310f9f10a8267247227/ios/RNCPickerComponentView.mm#L51

and it crashes here. https://github.com/react-native-picker/picker/blob/7b7a95f4fe842d0a0c696310f9f10a8267247227/ios/RNCPicker.mm#L160

Test

  1. Run the example app with RCT_NEW_ARCH_ENABLED enabled
  2. Add a picker item with an empty value to the example
  3. Scroll the picker to select the item with an empty value
Naturalclar commented 1 month ago

:tada: This PR is included in version 2.7.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

bernhardoj commented 1 month ago

Great, thanks!