React Native Reanimated版本识别异常求助:触摸失效多步排查未解决
解决Reanimated版本不匹配导致的触摸功能异常问题
确认版本严格匹配
查清楚当前使用的Expo SDK对应的react-native-reanimated精确版本(比如Expo SDK 49对应reanimated 3.3.0),执行指定版本安装命令:npm install react-native-reanimated@x.x.x # 或 yarn add react-native-reanimated@x.x.x彻底清除缓存并重启
- 清除包管理器缓存:
npm cache clean --force或yarn cache clean - 清除Expo Metro缓存并重启项目:
expo r -c - 若为裸React Native项目,重新安装iOS依赖:
cd ios && pod install && cd ..,再重新运行项目
- 清除包管理器缓存:
检查Babel配置正确性
确保babel.config.js中Reanimated插件放在最后一位:module.exports = { presets: ['babel-preset-expo'], plugins: ['react-native-reanimated/plugin'], };验证GestureHandler配置
在项目入口文件(如App.js)最顶部导入并初始化GestureHandler:import 'react-native-gesture-handler';更新Expo Go客户端
确保手机上的Expo Go应用是最新版本,与本地Expo SDK版本保持一致
内容的提问来源于stack exchange,提问作者heejung Kwon
相关产品推荐
相关产品推荐

