New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 3.0.2 breaks compatability with refreshControl
and large titles (from react-native-navigation
)
#337
Comments
Additionally, this issue is still relevant in our production code as well. We have patched the source code to use the The patch looks like this (compiled files omitted for brevity): diff --git a/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx b/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx
index 9d9fcb1..ab3dc2a 100644
--- a/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx
+++ b/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx
@@ -8,6 +8,7 @@ import React, {
import {
ListRenderItem,
FlatListProps,
+ FlatList as RNFlatList,
NativeScrollEvent,
NativeSyntheticEvent,
LayoutChangeEvent,
@@ -94,6 +95,10 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
activationDistance: activationDistanceProp = DEFAULT_PROPS.activationDistance,
} = props;
+ //@ts-ignore
+ const RNAnimatedFlatList = Animated.createAnimatedComponent(RNFlatList) as typeof AnimatedFlatList;
+ const List = props.useReactNativeFlatList ? RNAnimatedFlatList : AnimatedFlatList;
+
const [activeKey, setActiveKey] = useState<string | null>(null);
const keyExtractor = useCallback(
@@ -398,7 +403,7 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
}}
/>
<PlaceholderItem renderPlaceholder={props.renderPlaceholder} />
- <AnimatedFlatList
+ <List
{...props}
CellRendererComponent={CellRendererComponent}
ref={flatListRef}
diff --git a/node_modules/react-native-draggable-flatlist/src/types.ts b/node_modules/react-native-draggable-flatlist/src/types.ts
index 039c5ea..54aa01a 100644
--- a/node_modules/react-native-draggable-flatlist/src/types.ts
+++ b/node_modules/react-native-draggable-flatlist/src/types.ts
@@ -33,6 +33,7 @@ export type DraggableFlatListProps<T> = Modify<
renderItem: RenderItem<T>;
renderPlaceholder?: RenderPlaceholder<T>;
simultaneousHandlers?: React.Ref<any> | React.Ref<any>[];
+ useReactNativeFlatList?: boolean;
} & Partial<DefaultProps>
>; |
Thanks for the excellent example! I've never used I'll Just a warning though, it seems like |
Thanks for the fix @computerjazz ! That does improve things. I have found another issue, I think. Normally, when the list is longer than your screen and you scroll up, the large title becomes small. It stays small unless you are at the top of the list. However, when you start dragging an item when the title is small, the tile becomes large again (which should not happen) and everything jumps down, which makes dragging the item feel clunky. It is not consistently broken, but most of the time it is. You can test this yourself by adding items to See video below: |
Hmm, seems like you are right. The issue might have been present in earlier versions, apologies. Nonetheless, is there any way to overcome this, you think? |
I'm not sure, and I don't see any documentation about how ScrollViews are supposed to interact with RNN (do you know where that's documented?). I'd open an issue on |
I have (finally) found the time to report this bug to |
Describe the bug
We have recently updated our
react-native-draggable-flatlist
version from 2.6.2 to 3.0.2. Since then, multiple issues have arisen with regards to compatibility withreact-native-navigtation
. Important to noteFlatList
from eitherreact-native-gesture-handler
orreact-native
. I have included examples below.The issues
➡ Video showcasing
react-native-draggable-flatlist
draggable.mp4
Expected outcome
It should behave exactly as when you would use
FlatList
from eitherreact-native-gesture-handler
orreact-native
.➡ Video showcasing
react-native-gesture-handler
'sFlatList
(This is the expected outcome)rngh.mp4
To Reproduce
A snack is not possible with
react-native-navigation
as it uses native libraries, but I have created a small repo with a minimally reproducible example which you can use to investigate the issue. You can find it here.Platform & Dependencies
react-native-draggable-flatlist
version: 3.0.2react-native-reanimated
: version: 2.2.3react-native-gesture-handler
: version: 1.10.3Additional context
Large titles is a design spec by Apple, see this link. You can enable this by setting the following options on your component:
Please let me know if I can provide any more information!
The text was updated successfully, but these errors were encountered: