1+ import { LIST_MODE } from 'constants' ;
12import React , {
23 useMemo ,
34 useCallback ,
@@ -6,9 +7,12 @@ import React, {
67
78import {
89 Text ,
10+ TouchableOpacity
911} from 'react-native' ;
1012
11- import { TouchableOpacity } from 'react-native-gesture-handler' ;
13+ import {
14+ TouchableOpacity as TouchableOpacityGestureHandler
15+ } from 'react-native-gesture-handler' ;
1216
1317function RenderListItem ( {
1418 rtl,
@@ -35,6 +39,7 @@ function RenderListItem({
3539 disabledItemContainerStyle,
3640 disabledItemLabelStyle,
3741 categorySelectable,
42+ listMode,
3843 onPress,
3944 THEME
4045} ) {
@@ -147,14 +152,20 @@ function RenderListItem({
147152 onPress ( item , custom ) ;
148153 } , [ onPress , parent , categorySelectable , label , value , custom ] ) ;
149154
155+ const _TouchableOpacity = useMemo ( ( ) => {
156+ if ( listMode === LIST_MODE . MODAL )
157+ return TouchableOpacity ;
158+ return TouchableOpacityGestureHandler ;
159+ } , [ listMode ] ) ;
160+
150161 return (
151- < TouchableOpacity style = { _listItemContainerStyle } onPress = { __onPress } disabled = { selectable === false || disabled } >
162+ < _TouchableOpacity style = { _listItemContainerStyle } onPress = { __onPress } disabled = { selectable === false || disabled } >
152163 { IconComponent }
153164 < Text style = { _listItemLabelStyle } >
154165 { label }
155166 </ Text >
156167 { _TickIconComponent }
157- </ TouchableOpacity >
168+ </ _TouchableOpacity >
158169 ) ;
159170}
160171
@@ -175,6 +186,8 @@ const areEqual = (nextProps, prevProps) => {
175186 return false ;
176187 if ( nextProps . categorySelectable !== prevProps . categorySelectable )
177188 return false ;
189+ if ( nextProps . listMode !== prevProps . listMode )
190+ return false ;
178191 if ( nextProps . rtl !== prevProps . rtl )
179192 return false ;
180193 if ( nextProps . theme !== prevProps . theme )
0 commit comments