react-native: [Android] Animated Event is not firing when useNativeDriver enabled

Description

This part of code will cause the Animated.Event to not be fired if the useNativeDriver is set to true and if event name starts with on, not sure why this code has been added in the first place.

https://github.com/facebook/react-native/blob/565a7439ac8af66ab9b15e28119388608fd287c5/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java#L826-L828

Version

0.71.1

Output of npx react-native info

System:
    OS: macOS 12.5.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 2.68 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.18.1 - ~/.me/versions/node/v16.18.1/bin/node
    Yarn: 1.22.19 - ~/.me/versions/node/v16.18.1/bin/yarn
    npm: 8.19.2 - ~/.nvme/versions/node/v16.18.1/bin/npm
    Watchman: 2023.01.23.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 30, 31, 32, 33
      Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
      System Images: android-30 | Google APIs ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-30 | Google Play Intel x86 Atom_64, android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.1 => 0.71.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Create a custom Animated view with an event name starts with on like onAnimatedEvent, pass the Animated.event with useNativeDriver as true in the config. the event never fires, change the event name to OnAnimatedEvent and it works as expected.

Snack, code example, screenshot, or link to a repository

https://github.com/N3TC4T/react_native_issue_36125

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (3 by maintainers)

Most upvoted comments

This might be an issue for Wix’s Interactable, can you reproduce with Animated.View?