facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.39k stars 24.36k forks source link

Performance Issues with useNativeDriver in React Native 0.74.1 of New Arch: Comparing Animation Smoothness and FlatList Scrolling #44514

Open Hao-yiwen opened 6 months ago

Hao-yiwen commented 6 months ago

Description

In my React Native 0.74.1 app using the new architecture, when there are complex animations on a page, the animations display smoothly and the FlatList scrolls fluidly if I set useNativeDriver=false. However, when I set useNativeDriver=true, both the page animations and FlatList scrolling become choppy.

Steps to reproduce

  1. yarn
  2. npm run android

React Native Version

0.74.1

Affected Platforms

Runtime - Android, Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx react-native info

System:
  OS: macOS 14.2.1
  CPU: (8) arm64 Apple M2
  Memory: 125.22 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.12.1
    path: ~/.nvm/versions/node/v18.12.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.12.1/bin/yarn
  npm:
    version: 8.19.2
    path: ~/.nvm/versions/node/v18.12.1/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.2.0
    path: /Users/yw.hao/.rvm/rubies/ruby-3.2.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

Shown in the following video.

Reproducer

https://github.com/Hao-yiwen/rn_0741

Screenshots and Videos

old Arch: https://github.com/facebook/react-native/assets/42827938/ae9ba77c-71b9-4901-bd2b-0c735658573f

new Arch: https://github.com/facebook/react-native/assets/42827938/d29cec27-672c-4e72-bf1b-d51ce57c5d92

Hao-yiwen commented 6 months ago

Why use useNativeDriver:false will make animated greatly,and useNativeDriver:true lead to animations and FlatList scrolling become choppy.This is really a strange thing.

Hao-yiwen commented 6 months ago

This question make animation Stuck and stopped.

talha105 commented 5 months ago

can anyone solve this?

Hao-yiwen commented 5 months ago

No, This question not be solve by anyone.Same you?