【问题标题】:cannot read property handleSetJSResponder of null error in react native v0.70.3cannot read property handleSetJSResponder of null error in react native v0.70.3
【发布时间】:2022-12-21 21:10:38
【问题描述】:

我已将我的 React Native 版本从 0.64.2 升级到 0.70.3,并相应地升级了软件包。

运行IOS debugging(react-native run-ios)时,react-native-gesture-handler出现上述错误。如果您有任何解决此问题的方法或任何建议,请与我分享。

添加了所有详细信息(代码、屏幕截图)以详细检查,在此先感谢。

请通过共享示例代码或解决步骤来帮助我解决问题。

以下是项目中使用的包列表,

{
  "name": "projectSetup",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-community/cli": "^9.2.1",
    "@react-native-community/datetimepicker": "^6.5.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^9.3.5",
    "@react-native-masked-view/masked-view": "^0.2.8",
    "axios": "^1.1.3",
    "lodash": "^4.17.21",
    "react": "18.1.0",
    "react-native": "^0.70.3",
    "react-native-android-location-enabler": "^1.2.2",
    "react-native-calendars": "^1.1275.0",
    "react-native-camera": "^4.2.1",
    "react-native-device-info": "^10.2.1",
    "react-native-elements": "^3.4.2",
    "react-native-fast-image": "^8.6.1",
    "react-native-flexbox-grid": "^0.3.2",
    "react-native-geocoding": "^0.5.0",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "^2.7.1",
    "react-native-image-crop-picker": "^0.38.0",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-image-picker": "^4.10.0",
    "react-native-maps": "^1.3.2",
    "react-native-month-selector": "^1.4.0",
    "react-native-onesignal": "^4.4.1",
    "react-native-paper": "^4.12.5",
    "react-native-qrcode-scanner": "^1.5.5",
    "react-native-reanimated": "^2.11.0",
    "react-native-safe-area-context": "^3.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-signature-capture": "^0.4.12",
    "react-native-sound": "^0.11.2",
    "react-native-sound-player": "^0.13.2",
    "react-native-svg": "^13.4.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-view-pdf": "^0.14.0",
    "react-native-webview": "^11.23.1",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-redux": "^7.1.1",
    "redux": "^4.2.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.4.1",
    "rn-fetch-blob": "^0.12.0",
    "socket.io-client": "^4.5.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

App.js代码

import React from "react";
import {View, Text, StyleSheet, LogBox, TouchableOpacity} from "react-native";


class App extends React.Component {
    render() {
        return (
            <View style={{flex:1}}>
                <TouchableOpacity
                    onPress={()=> {
                        Alert.alert('Hello...', 'kk')
                    }}
                    style={{height:200,backgroundColor:'red',alignItems:'center',justifyContent:'center'}}>
                    <Text>Welcome Praveen</Text>
                </TouchableOpacity>
            </View>
        );
    }
}
export default App;

**错误 [react-native-gesture-handler] 未找到 react-native-gesture-handler 模块。确保您在本机平台上运行您的应用程序并且您的代码已正确链接(cd ios && pod install && cd ..)。

安装说明请参考https://docs.swmansion.com/react-native-gesture-handler/docs/#installation**

npx react-native-info 的输出

info Fetching system and libraries information...
System:
    OS: macOS 13.0
    CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
    Memory: 37.48 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.10.0 - /usr/local/bin/node
    Yarn: 1.22.19 - ~/node_modules/.bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
    Watchman: 2022.10.03.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9014738
    Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: ^9.2.1 => 9.2.1 
    react: 18.1.0 => 18.1.0 
    react-native: ^0.70.3 => 0.70.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

【问题讨论】:

    标签: android ios firebase react-native react-native-gesture-handler


    【解决方案1】:

    安装 react-native-gesture-handler 然后在你的根文件夹中添加 react-native.config.js 文件 在其中添加此代码:

    module.exports = {
    project: {
    ios: {},
    android: {},
    },
    };
    

    然后在你的终端运行这个命令 npx 反应本机资产 现在重新安装你的应用程序

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-08
      • 2021-07-29
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 1970-01-01
      • 2018-12-21
      • 1970-01-01
      相关资源
      最近更新 更多