react-native Performance Issues with useNativeDriver in React Native 0.74.1 of New Arch: Comparing Animation Smoothness and FlatList Scrolling

kpbwa7wx  于 5个月前  发布在  React
关注(0)|答案(4)|浏览(116)

描述

在我的React Native 0.74.1应用程序中,当页面上有复杂的动画时,如果将useNativeDriver设置为false,动画会平滑显示,而FlatList滚动也会流畅。然而,当我将useNativeDriver设置为true时,页面动画和FlatList滚动都会变得卡顿。

重现步骤

  1. yarn
  2. npm run android

React Native版本

0.74.1

受影响的平台

运行时-Android,运行时-iOS

领域

Fabric - 新渲染器

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

堆栈跟踪或日志

Shown in the following video.

可复现问题

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

截图和视频

旧架构:
https://github.com/facebook/react-native/assets/42827938/ae9ba77c-71b9-4901-bd2b-0c735658573f
新架构:
https://github.com/facebook/react-native/assets/42827938/d29cec27-672c-4e72-bf1b-d51ce57c5d92

fwzugrvs

fwzugrvs1#

为什么使用useNativeDriver:false会使动画效果大大提升,而useNativeDriver:true会导致动画和FlatList滚动变得卡顿。这确实是一件很奇怪的事情。

pbwdgjma

pbwdgjma2#

这个问题使动画卡住并停止。

wb1gzix0

wb1gzix03#

有人能解决这个问题吗?

vhmi4jdf

vhmi4jdf4#

不,这个问题任何人都无法解决。你呢?

相关问题