From f1bd8bd9adc45fb5d66a22b03dc50adbeb33694e Mon Sep 17 00:00:00 2001 From: Cong Pham Date: Fri, 3 May 2024 07:53:19 +0700 Subject: [PATCH 1/3] 40211 handle conflict mapview event on android --- .../DraggableList/index.android.tsx | 30 +++++++++++++++++++ .../{index.native.tsx => index.ios.tsx} | 0 .../MapView/responder/index.android.ts | 11 +++++++ 3 files changed, 41 insertions(+) create mode 100644 src/components/DraggableList/index.android.tsx rename src/components/DraggableList/{index.native.tsx => index.ios.tsx} (100%) create mode 100644 src/components/MapView/responder/index.android.ts diff --git a/src/components/DraggableList/index.android.tsx b/src/components/DraggableList/index.android.tsx new file mode 100644 index 000000000000..7d1add9d3da1 --- /dev/null +++ b/src/components/DraggableList/index.android.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import DraggableFlatList from 'react-native-draggable-flatlist'; +import type {FlatList} from 'react-native-gesture-handler'; +import useThemeStyles from '@hooks/useThemeStyles'; +import { View } from 'react-native'; +import type {DraggableListProps} from './types'; + +function DraggableList({renderClone, shouldUsePortal, ListFooterComponent, ...viewProps}: DraggableListProps, ref: React.ForwardedRef>) { + const styles = useThemeStyles(); + return ( + + + {ListFooterComponent && ( + + {ListFooterComponent} + + )} + + ); +} + +DraggableList.displayName = 'DraggableList'; + +export default React.forwardRef(DraggableList); diff --git a/src/components/DraggableList/index.native.tsx b/src/components/DraggableList/index.ios.tsx similarity index 100% rename from src/components/DraggableList/index.native.tsx rename to src/components/DraggableList/index.ios.tsx diff --git a/src/components/MapView/responder/index.android.ts b/src/components/MapView/responder/index.android.ts new file mode 100644 index 000000000000..e1907e786733 --- /dev/null +++ b/src/components/MapView/responder/index.android.ts @@ -0,0 +1,11 @@ +import { PanResponder } from 'react-native'; + +const InterceptPanResponderCapture = PanResponder.create({ + onStartShouldSetPanResponder: () => true, + onStartShouldSetPanResponderCapture: () => true, + onMoveShouldSetPanResponder: () => true, + onMoveShouldSetPanResponderCapture: () => true, + onPanResponderTerminationRequest: () => false, +}); + +export default InterceptPanResponderCapture; From d3730090e02bc025cd7b233565d9841a7f04fd05 Mon Sep 17 00:00:00 2001 From: Cong Pham Date: Sat, 4 May 2024 01:24:42 +0700 Subject: [PATCH 2/3] fix eslint --- src/components/DraggableList/index.android.tsx | 8 ++------ src/components/MapView/responder/index.android.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/DraggableList/index.android.tsx b/src/components/DraggableList/index.android.tsx index 7d1add9d3da1..61527544abea 100644 --- a/src/components/DraggableList/index.android.tsx +++ b/src/components/DraggableList/index.android.tsx @@ -1,8 +1,8 @@ import React from 'react'; +import {View} from 'react-native'; import DraggableFlatList from 'react-native-draggable-flatlist'; import type {FlatList} from 'react-native-gesture-handler'; import useThemeStyles from '@hooks/useThemeStyles'; -import { View } from 'react-native'; import type {DraggableListProps} from './types'; function DraggableList({renderClone, shouldUsePortal, ListFooterComponent, ...viewProps}: DraggableListProps, ref: React.ForwardedRef>) { @@ -16,11 +16,7 @@ function DraggableList({renderClone, shouldUsePortal, ListFooterComponent, .. // eslint-disable-next-line react/jsx-props-no-spreading {...viewProps} /> - {ListFooterComponent && ( - - {ListFooterComponent} - - )} + {ListFooterComponent && {ListFooterComponent}} ); } diff --git a/src/components/MapView/responder/index.android.ts b/src/components/MapView/responder/index.android.ts index e1907e786733..9cbcde11ca7b 100644 --- a/src/components/MapView/responder/index.android.ts +++ b/src/components/MapView/responder/index.android.ts @@ -1,11 +1,11 @@ -import { PanResponder } from 'react-native'; +import {PanResponder} from 'react-native'; const InterceptPanResponderCapture = PanResponder.create({ - onStartShouldSetPanResponder: () => true, - onStartShouldSetPanResponderCapture: () => true, - onMoveShouldSetPanResponder: () => true, - onMoveShouldSetPanResponderCapture: () => true, - onPanResponderTerminationRequest: () => false, + onStartShouldSetPanResponder: () => true, + onStartShouldSetPanResponderCapture: () => true, + onMoveShouldSetPanResponder: () => true, + onMoveShouldSetPanResponderCapture: () => true, + onPanResponderTerminationRequest: () => false, }); export default InterceptPanResponderCapture; From f69525ffdbed44f371909ded3eb3f7cc3a9e1f71 Mon Sep 17 00:00:00 2001 From: Cong Pham Date: Sat, 4 May 2024 15:34:42 +0700 Subject: [PATCH 3/3] update condition check isValidElement --- src/components/DraggableList/index.android.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DraggableList/index.android.tsx b/src/components/DraggableList/index.android.tsx index 61527544abea..30bf7c927bd9 100644 --- a/src/components/DraggableList/index.android.tsx +++ b/src/components/DraggableList/index.android.tsx @@ -16,7 +16,7 @@ function DraggableList({renderClone, shouldUsePortal, ListFooterComponent, .. // eslint-disable-next-line react/jsx-props-no-spreading {...viewProps} /> - {ListFooterComponent && {ListFooterComponent}} + {React.isValidElement(ListFooterComponent) && {ListFooterComponent}} ); }