Skip to content

Commit 4c510a0

Browse files
author
Bruno Martínez
committed
callback function to know edit mode and hide dropdown toggle option
1 parent 6f7597a commit 4c510a0

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
@@ -27,6 +27,7 @@ function SelectBox({
2727
multiListEmptyLabelStyle,
2828
listEmptyLabelStyle,
2929
selectedItemStyle,
30+
editStatus,
3031
listEmptyText = 'No results found',
3132
...props
3233
}) {
@@ -129,6 +130,7 @@ function SelectBox({
129130
}
130131
const {
131132
selectIcon,
133+
noEditable,
132134
label,
133135
inputPlaceholder = 'Select',
134136
hideInputFilter,
@@ -221,9 +223,11 @@ function SelectBox({
221223
</TouchableOpacity>
222224
)}
223225
</View>
224-
<TouchableOpacity onPress={onPressShowOptions()} hitSlop={hitSlop}>
225-
{selectIcon ? selectIcon : <Icon name={showOptions ? 'upArrow' : 'downArrow'} fill={arrowIconColor} />}
226-
</TouchableOpacity>
226+
{noEditable ? null :
227+
<TouchableOpacity onPress={onPressShowOptions()} hitSlop={hitSlop}>
228+
{selectIcon ? selectIcon : <Icon name={showOptions ? 'upArrow' : 'downArrow'} fill={arrowIconColor} />}
229+
</TouchableOpacity>
230+
}
227231
</View>
228232
{/* Options wrapper */}
229233
{showOptions && (
@@ -303,6 +307,7 @@ function SelectBox({
303307
}
304308

305309
function onPressShowOptions() {
310+
editStatus ? editStatus(showOptions) : null
306311
return () => setShowOptions(!showOptions)
307312
}
308313
}

0 commit comments

Comments
 (0)