computerjazz / react-native-draggable-flatlist

A drag-and-drop-enabled FlatList for React Native
MIT License
1.94k stars 406 forks source link

Cannot read property 'configs' of undefined #498

Open wonderlul opened 1 year ago

wonderlul commented 1 year ago

Describe the bug When I'm adding the flag enableLayoutAnimationExperimental I'm receiving this error:

Screenshot_1692085255

To Reproduce Here's how implementation looks like:

<NestableDraggableFlatList
     data={data}
     onDragEnd={onDragEnd}
     keyExtractor={item => item.id}
     renderItem={renderItem}
     enableLayoutAnimationExperimental
     itemLayoutAnimation={Layout.duration(400)}
 />

I've also tried with animationConfig but without results neither.

Platform & Dependencies

Additional context If any other information is required, please inform. Have a good one everyone!

wonderlul commented 1 year ago

PS. While we're at it - is it possible to programmatically disable layout animation on demand within JS? We have list of items with order that you can change not only with drag & drop. I would like to disable layout animation when doing drag & drop and enable doing other activity.

moa-os commented 1 year ago

any soultion regarding this?

wonderlul commented 1 year ago

Screenshot 2023-08-28 at 15 47 33

@moa-os

I did this patch (so basically just commented out the useEffect). I'm sure it isn't optimal but I didn't have time to reflect on that at that time.

angusryer commented 1 year ago

Same error here.

Commenting out the useEffect on line 131 in node_modules/react-native-draggable-flatlist/src/components/CellRendererComponent.tsx--as @wonderlul suggests does make the error go away, but at what cost I'm not sure.

My implementation is a NestableScrollView with a NestableDraggableList inside, where I'm triggering a list of items to be resorted programmatically, causing the itemLayoutAnimation to fire.

This is my npx react-native info:

System:
  OS: macOS 13.5.1
  CPU: (8) arm64 Apple M1
  Memory: 293.70 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.1
    path: ~/.nvm/versions/node/v18.16.1/bin/node
  Yarn:
    version: 3.2.2
    path: ~/.yarn/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.1/bin/npm
  Watchman:
    version: 2023.07.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/angusryer/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.1
      - iOS 16.1
      - macOS 13.0
      - tvOS 16.1
      - watchOS 9.1
  Android SDK:
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 14.1/14B47b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/angusryer/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

And my package.json versions:

"react-native-draggable-flatlist": "^4.0.1",
"react-native-reanimated": "^3.4.2",
"react-native-gesture-handler": "^2.12.1",
adorum commented 11 months ago

Any news on this issue?

stephenseager commented 10 months ago

Also seeing this error, any updates? Seems the comment below, found within CellRendererComponent, needs to be addressed? // NOTE: Keep an eye on reanimated LayoutAnimation refactor: // https://github.com/software-mansion/react-native-reanimated/pull/3332/files // We might have to change the way we register/unregister LayouAnimations: // - get native module: https://github.com/software-mansion/react-native-reanimated/blob/cf59766460d05eb30357913455318d8a95909468/src/reanimated2/NativeReanimated/NativeReanimated.ts#L18 // - register layout animation for tag: https://github.com/software-mansion/react-native-reanimated/blob/cf59766460d05eb30357913455318d8a95909468/src/reanimated2/NativeReanimated/NativeReanimated.ts#L99