Skip to content

Commit 9fa20a5

Browse files
Gerardo Pachecocbravobernal
Gerardo Pacheco
authored andcommitted
[Mobile] - BottomSheetSelectControl - Add empty fallback option (WordPress#60333)
* Mobile - BottomSheetSelectControl - Add empty fallback option if the selected option couldn't be found * Update Changelog
1 parent 10b7760 commit 9fa20a5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/components/src/mobile/bottom-sheet-select-control/index.native.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import { BottomSheet } from '@wordpress/components';
1616
*/
1717
import styles from './style.scss';
1818

19+
const EMPTY_OPTION = {
20+
label: '',
21+
};
22+
1923
const BottomSheetSelectControl = ( {
2024
label,
2125
icon,
@@ -34,9 +38,9 @@ const BottomSheetSelectControl = ( {
3438
};
3539
};
3640

37-
const selectedOption = items.find(
38-
( option ) => option.value === selectedValue
39-
);
41+
const selectedOption =
42+
items.find( ( option ) => option.value === selectedValue ) ??
43+
EMPTY_OPTION;
4044

4145
const goBack = () => {
4246
setShowSubSheet( false );

packages/react-native-editor/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ For each user feature we should also add a importance categorization label to i
1010
-->
1111

1212
## Unreleased
13+
- [*] Add empty fallback option for the BottomSheetSelectControl component
1314

1415
## 1.116.0
1516
- [**] Highlight color formatting style improvements [#57650]

0 commit comments

Comments
 (0)