Skip to content

Commit cb05220

Browse files
author
Bruno Martínez
committed
callback function to know edit mode and hide dropdown toggle option
1 parent 5b3d583 commit cb05220

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function SelectBox({
2828
listEmptyLabelStyle,
2929
selectedItemStyle,
3030
removeItemsSelected,
31+
editStatus,
3132
listEmptyText = 'No results found',
3233
...props
3334
}) {
@@ -134,6 +135,7 @@ function SelectBox({
134135
}
135136
const {
136137
selectIcon,
138+
noEditable,
137139
label,
138140
inputPlaceholder = 'Select',
139141
hideInputFilter,
@@ -227,9 +229,11 @@ function SelectBox({
227229
</TouchableOpacity>
228230
)}
229231
</View>
230-
<TouchableOpacity onPress={onPressShowOptions()} hitSlop={hitSlop}>
231-
{selectIcon ? selectIcon : <Icon name={showOptions ? 'upArrow' : 'downArrow'} fill={arrowIconColor} />}
232-
</TouchableOpacity>
232+
{noEditable ? null :
233+
<TouchableOpacity onPress={onPressShowOptions()} hitSlop={hitSlop}>
234+
{selectIcon ? selectIcon : <Icon name={showOptions ? 'upArrow' : 'downArrow'} fill={arrowIconColor} />}
235+
</TouchableOpacity>
236+
}
233237
</View>
234238
{/* Options wrapper */}
235239
{showOptions && (
@@ -309,6 +313,7 @@ function SelectBox({
309313
}
310314

311315
function onPressShowOptions() {
316+
editStatus ? editStatus(showOptions) : null
312317
return () => setShowOptions(!showOptions)
313318
}
314319
}

0 commit comments

Comments
 (0)