【问题标题】:React Native -- Attempting to change the getter of an unconfigurable property. (Device)React Native -- 试图改变一个不可配置属性的 getter。 (设备)
【发布时间】:2021-10-11 16:11:53
【问题描述】:

我创建了 react native 应用程序并添加了 Native 导航以在屏幕之间切换。之后,当我在设备上运行它时开始出现问题。

错误--

assets/routes/homeStack.js (680:882)
Attempting to change the getter of an unconfigurable property.
(Device)
  Evaluating module://react-navigation.js
  Evaluating module://react-navigation-stack.js
  Evaluating module://assets/routes/homeStack.js.js
  Evaluating module://App.js.js
  Loading module://App.js

但是当我在 web 上运行它时,它运行得很好,导航过程也很好。 这是导航堆栈文件。

import {createStackNavigator} from 'react-navigation-stack'
import {createAppContainer} from 'react-navigation'
import Buttons from '../../components/Buttons'
import Waiting from '../../components/Waiting'


const screens ={
  Home:{
    screen:Buttons
  },
  Wait:{
    screen:Waiting
  }
}

const HomeStack = createStackNavigator(screens);

export default createAppContainer(HomeStack);

我该如何解决这个问题? 完整的代码和在线模拟器在这里 - https://snack.expo.dev/@codewithbanchi/pincode

【问题讨论】:

    标签: reactjs react-native navigation


    【解决方案1】:

    在您的 package.json 中,这是代码。

    {
      "dependencies": {
        "expo-constants": "~11.0.2",
        "react-navigation": "4.1.1",
        "react-native-paper": "3.6.0",
        "react-native-screens": "~3.4.0",
        "react-navigation-stack": "*",
        "@react-navigation/native": "*",
        "react-native-vector-icons": "8.1.0",
        "react-native-gesture-handler": "~1.10.2",
        "@react-navigation/native-stack": "*",
        "react-native-safe-area-context": "3.2.0",
        "react-native-countdown-component": "*",
        "react-native-vector-icons/Feather": "*",
        "@react-native-community/masked-view": "0.1.10",
        "react-native-vector-icons/FontAwesome": "*",
        "react-native-vector-icons/Feather/Delete": "*"
      }
    }
    

    要解决此问题,请尝试删除此行以及上一行中的逗号。

    "react-native-vector-icons/Feather/Delete": "*"
    

    您的代码应如下所示。

    {
      "dependencies": {
        "expo-constants": "~11.0.2",
        "react-navigation": "4.1.1",
        "react-native-paper": "3.6.0",
        "react-native-screens": "~3.4.0",
        "react-navigation-stack": "*",
        "@react-navigation/native": "*",
        "react-native-vector-icons": "8.1.0",
        "react-native-gesture-handler": "~1.10.2",
        "@react-navigation/native-stack": "*",
        "react-native-safe-area-context": "3.2.0",
        "react-native-countdown-component": "*",
        "react-native-vector-icons/Feather": "*",
        "@react-native-community/masked-view": "0.1.10",
        "react-native-vector-icons/FontAwesome": "*"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-11-13
      • 2018-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-20
      • 2020-10-03
      • 2021-04-03
      • 1970-01-01
      相关资源
      最近更新 更多