File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ declare module 'react-native-dropdown-picker' {
196196 containerStyle ?: StyleProp < ViewStyle > ;
197197 customItemContainerStyle ?: StyleProp < ViewStyle > ;
198198 customItemLabelStyle ?: StyleProp < TextStyle > ;
199+ clearSearchFieldOnSelect ?: boolean ;
199200 customItemValueDelimiter ?: string ;
200201 disableBorderRadius ?: boolean ;
201202 disabledItemContainerStyle ?: StyleProp < ViewStyle > ;
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ function Picker({
8484 containerStyle = { } ,
8585 customItemContainerStyle = { } ,
8686 customItemLabelStyle = { } ,
87+ clearSearchFieldOnSelect = false ,
8788 customItemValueDelimiter = '-' ,
8889 disableBorderRadius = true ,
8990 disabled = false ,
@@ -350,6 +351,19 @@ function Picker({
350351 if ( mode === MODE . SIMPLE ) badgeFlatListRef . current = null ;
351352 } , [ mode ] ) ;
352353
354+ /**
355+ * clear search field on item select.
356+ */
357+ useEffect ( ( ) => {
358+ if (
359+ clearSearchFieldOnSelect == true &&
360+ multiple == true &&
361+ searchText . length > 0
362+ ) {
363+ setSearchText ( '' ) ;
364+ }
365+ } , [ value ] ) ;
366+
353367 /**
354368 * onPressClose.
355369 */
You can’t perform that action at this time.
0 commit comments