Skip to content

Commit

Permalink
Merge pull request #333 from hossein-zare/dev-5.x
Browse files Browse the repository at this point in the history
v5.1.18
  • Loading branch information
hossein-zare authored May 25, 2021
2 parents a0b92fc + 4895f50 commit 4d5b06c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-dropdown-picker",
"version": "5.1.17",
"version": "5.1.18",
"description": "A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.",
"keywords": [
"picker",
Expand Down
8 changes: 6 additions & 2 deletions src/components/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,10 @@ function Picker({
*/
const _searchContainerStyle = useMemo(() => ([
RTL_DIRECTION(rtl, THEME.searchContainer),
...[searchContainerStyle].flat()
]), [rtl, searchContainerStyle, THEME]);
...[searchContainerStyle].flat(), ! searchable && listMode === LIST_MODE.MODAL && {
flexDirection: 'row-reverse'
}
]), [rtl, listMode, searchable, searchContainerStyle, THEME]);

/**
* The search text input style.
Expand Down Expand Up @@ -1260,6 +1262,7 @@ function Picker({
disabledItemContainerStyle={_disabledItemContainerStyle}
disabledItemLabelStyle={_disabledItemLabelStyle}
categorySelectable={categorySelectable}
listMode={listMode}
onPress={onPressItem}
theme={theme}
THEME={THEME}
Expand Down Expand Up @@ -1287,6 +1290,7 @@ function Picker({
_value,
multiple,
categorySelectable,
listMode,
onPressItem,
theme,
THEME
Expand Down
19 changes: 16 additions & 3 deletions src/components/RenderListItem.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LIST_MODE } from 'constants';
import React, {
useMemo,
useCallback,
Expand All @@ -6,9 +7,12 @@ import React, {

import {
Text,
TouchableOpacity
} from 'react-native';

import { TouchableOpacity } from 'react-native-gesture-handler';
import {
TouchableOpacity as TouchableOpacityGestureHandler
} from 'react-native-gesture-handler';

function RenderListItem({
rtl,
Expand All @@ -35,6 +39,7 @@ function RenderListItem({
disabledItemContainerStyle,
disabledItemLabelStyle,
categorySelectable,
listMode,
onPress,
THEME
}) {
Expand Down Expand Up @@ -147,14 +152,20 @@ function RenderListItem({
onPress(item, custom);
}, [onPress, parent, categorySelectable, label, value, custom]);

const _TouchableOpacity = useMemo(() => {
if (listMode === LIST_MODE.MODAL)
return TouchableOpacity;
return TouchableOpacityGestureHandler;
}, [listMode]);

return (
<TouchableOpacity style={_listItemContainerStyle} onPress={__onPress} disabled={selectable === false || disabled}>
<_TouchableOpacity style={_listItemContainerStyle} onPress={__onPress} disabled={selectable === false || disabled}>
{IconComponent}
<Text style={_listItemLabelStyle}>
{label}
</Text>
{_TickIconComponent}
</TouchableOpacity>
</_TouchableOpacity>
);
}

Expand All @@ -175,6 +186,8 @@ const areEqual = (nextProps, prevProps) => {
return false;
if (nextProps.categorySelectable !== prevProps.categorySelectable)
return false;
if (nextProps.listMode !== prevProps.listMode)
return false;
if (nextProps.rtl !== prevProps.rtl)
return false;
if (nextProps.theme !== prevProps.theme)
Expand Down

0 comments on commit 4d5b06c

Please sign in to comment.