iOS模拟器无法正确滚动(M1+ReactNative项目)
在 M1 MacBook Pro 的模拟器上运行我的 React Native 项目。ScrollViews 在模拟器中不能正确滚动。Big Sur 和 M1 的这个设置只有一个问题。适用于其他计算机和真实设备。
当我滑动时,视图会滚动,但它需要很大的“力”,并且视图在我滚动时似乎滞后。此外,它会在我松开按钮时立即停止(不会按预期继续滚动)。
还有其他人遇到这个问题吗?
设置:
- M1 mac
- 罗塞塔航站楼
- Xcode 12.2、CoreSimulator 732.18.0.2(iPhone 11、iOS 14.0)
- 反应本机 0.63.2
回答
不运行arm64图像时,iOS 模拟器中似乎有一个带有滚动事件的错误。请参阅:https : //developer.apple.com/forums/thread/668488
我遇到了同样的问题,编译arm64解决了这个问题。
为此,您需要:
-
打开并使用 XCode 进行编译而不是
react-native run-ios. -
或者,通过
nvm install 15. 确保终端中的arch和都node -p process.arch打印arm64.
请注意,由于此问题,您需要禁用 FlipperPodfile才能编译到arm64模拟器目标:https : //github.com/facebook/flipper/issues/1758
附加信息:https : //github.com/facebook/react-native/pull/30543#issuecomment-740161332
-
Thanks for your comment, although it didn't helped solving this issue for me.
For everyone that has this issue still: https://stackoverflow.com/a/65511051/9899193 <- this worked for me perfectly (it's basically running the simulator app in rosetta)