@@ -163,6 +163,7 @@ function Picker({
163163 closeOnBackPressed = false ,
164164 extendableBadgeContainer = false ,
165165 onSelectItem = ( item ) => { }
166+ customItemValueDelimiter = '-' ,
166167} ) {
167168 const [ necessaryItems , setNecessaryItems ] = useState ( [ ] ) ;
168169 const [ searchText , setSearchText ] = useState ( '' ) ;
@@ -233,11 +234,11 @@ function Picker({
233234 setNecessaryItems ( state => {
234235 return [ ...state ] . map ( item => {
235236 const _item = items . find ( x => x [ _schema . value ] === item [ _schema . value ] ) ;
236-
237+
237238 if ( _item ) {
238239 return { ...item , ..._item } ;
239240 }
240-
241+
241242 return item ;
242243 } ) ;
243244 } ) ;
@@ -251,15 +252,15 @@ function Picker({
251252 setNecessaryItems ( state => {
252253 if ( value === null || ( Array . isArray ( value ) && value . length === 0 ) )
253254 return [ ] ;
254-
255+
255256 let _state = [ ...state ] . filter ( item => value . includes ( item [ _schema . value ] ) ) ;
256257
257258 const newItems = value . reduce ( ( accumulator , currentValue ) => {
258259 const index = _state . findIndex ( item => item [ _schema . value ] === currentValue ) ;
259260
260261 if ( index === - 1 ) {
261262 const item = items . find ( item => item [ _schema . value ] === currentValue ) ;
262-
263+
263264 if ( item ) {
264265 return [ ...accumulator , item ] ;
265266 }
@@ -282,7 +283,7 @@ function Picker({
282283 state . push ( item ) ;
283284 }
284285 }
285-
286+
286287 setNecessaryItems ( state ) ;
287288 }
288289
@@ -405,7 +406,7 @@ function Picker({
405406 } ) ;
406407 } else {
407408 const index = sortedItems . findIndex ( item => item [ _schema [ "value" ] ] === value ) ;
408-
409+
409410 if ( index > - 1 )
410411 flatListRef . current ?. scrollToIndex ?. ( {
411412 index,
@@ -454,7 +455,7 @@ function Picker({
454455 } else {
455456 if ( disableLocalSearch )
456457 return sortedItems ;
457-
458+
458459 const values = [ ] ;
459460 const normalizeText = ( text ) => text . normalize ( "NFD" ) . replace ( / [ \u0300 - \u036f ] / g, "" ) ;
460461
@@ -485,7 +486,7 @@ function Picker({
485486 if ( ( results . length === 0 || results . findIndex ( item => String ( item [ _schema . label ] ) . toLowerCase ( ) === searchText . toLowerCase ( ) ) === - 1 ) && addCustomItem ) {
486487 results . push ( {
487488 [ _schema . label ] : searchText ,
488- [ _schema . value ] : searchText . replace ( ' ' , '-' ) ,
489+ [ _schema . value ] : customItemValueDelimiter ? searchText . replace ( ' ' , customItemValueDelimiter ) : searchText ,
489490 custom : true
490491 } ) ;
491492 }
@@ -583,7 +584,7 @@ function Picker({
583584
584585 if ( isNull )
585586 return null ;
586-
587+
587588 try {
588589 return necessaryItems . find ( item => item [ _schema . value ] === _value ) ;
589590 } catch ( e ) {
@@ -602,11 +603,11 @@ function Picker({
602603 if ( multiple )
603604 if ( item . length > 0 ) {
604605 let mtext = _multipleText ;
605-
606+
606607 if ( typeof mtext !== 'string' ) {
607608 mtext = mtext [ item . length ] ?? mtext . n ;
608609 }
609-
610+
610611 return mtext . replace ( '{count}' , item . length ) ;
611612 } else
612613 return fallback ;
@@ -1022,7 +1023,7 @@ function Picker({
10221023 const _itemKey = useMemo ( ( ) => {
10231024 if ( itemKey === null )
10241025 return _schema . value ;
1025-
1026+
10261027 return itemKey ;
10271028 } , [ itemKey , _schema ] ) ;
10281029
@@ -1115,7 +1116,7 @@ function Picker({
11151116 </ View >
11161117 ) ;
11171118 }
1118-
1119+
11191120 return < BadgeListEmptyComponent /> ;
11201121 } , [ __renderBadge , extendableBadgeContainerStyle , extendableBadgeItemContainerStyle ] ) ;
11211122
@@ -1124,10 +1125,10 @@ function Picker({
11241125 * @returns {JSX.Element }
11251126 */
11261127 const BadgeBodyComponent = useMemo ( ( ) => {
1127- if ( extendableBadgeContainer ) {
1128+ if ( extendableBadgeContainer ) {
11281129 return < ExtendableBadgeContainer selectedItems = { selectedItems } />
11291130 }
1130-
1131+
11311132 return (
11321133 < FlatList
11331134 ref = { setBadgeFlatListRef }
@@ -1702,7 +1703,7 @@ function Picker({
17021703 const onRequestCloseModal = useCallback ( ( ) => {
17031704 setOpen ( false ) ;
17041705 } , [ ] ) ;
1705-
1706+
17061707 /**
17071708 * The dropdown flatlist component.
17081709 * @returns {JSX.Element }
@@ -1740,7 +1741,7 @@ function Picker({
17401741 const DropDownScrollViewComponent = useMemo ( ( ) => {
17411742 return (
17421743 < ScrollView ref = { scrollViewRef } nestedScrollEnabled = { true } stickyHeaderIndices = { stickyHeaderIndices } { ...scrollViewProps } >
1743- { _items . map ( ( item , index ) => {
1744+ { _items . map ( ( item , index ) => {
17441745 return (
17451746 < Fragment key = { item [ _itemKey ] } >
17461747 { index > 0 && ItemSeparatorComponent ( ) }
0 commit comments