不变违规:不变违规:尝试从未标记为“本机”的节点获取本机标记 - 反应导航更新导致崩溃
Posted
技术标签:
【中文标题】不变违规:不变违规:尝试从未标记为“本机”的节点获取本机标记 - 反应导航更新导致崩溃【英文标题】:Invariant Violation: Invariant Violation: Attempt to get native tag from node not marked as "native" - React Navigation update causing crash 【发布时间】:2018-08-23 13:05:44 【问题描述】:似乎是更新或其他不明确的内容导致我的应用程序崩溃。每当我加载动画的组件或视图(滚动视图、部分列表等)时,应用程序本身就会简单地崩溃并出现以下错误。
[tid:com.facebook.react.javascript] Invariant Violation: Invariant Violation: Attempt to get native tag from node not marked as "native"
This error is located at:
in AnimatedComponent (at StackViewCard.js:41)
in Card (at createPointerEventsContainer.js:26)
in Container (at StackViewLayout.js:506)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in StackViewLayout (at withOrientation.js:30)
in withOrientation (at StackView.js:40)
in RCTView (at View.js:43)
in Transitioner (at StackView.js:19)
in StackView (at createNavigator.js:59)
in Navigator (at createKeyboardAwareNavigator.js:11)
in KeyboardAwareNavigator (at createNavigationContainer.js:376)
in NavigationContainer (at SceneView.js:9)
in SceneView (at createTabNavigator.js:10)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in ResourceSavingScene (at createBottomTabNavigator.js:76)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in TabNavigationView (at createTabNavigator.js:135)
in NavigationView (at createNavigator.js:59)
in Navigator (at createNavigationContainer.js:376)
in NavigationContainer (at SceneView.js:9)
in SceneView (at StackViewLayout.js:481)
in RCTView (at View.js:43)
in AnimatedComponent (at StackViewCard.js:41)
in Card (at createPointerEventsContainer.js:26)
in Container (at StackViewLayout.js:506)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in StackViewLayout (at withOrientation.js:30)
in withOrientation (at StackView.js:40)
in RCTView (at View.js:43)
in Transitioner (at StackView.js:19)
in StackView (at createNavigator.js:59)
in Navigator (at createKeyboardAwareNavigator.js:11)
in KeyboardAwareNavigator (at createNavigationContainer.js:376)
in NavigationContainer (at App.js:36)
in Root (at renderApplication.js:32)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in AppContainer (at renderApplication.js:31)
到目前为止我已经尝试过:
删除 node_modules 和 npm install 以恢复它们 在 Google 上搜索到了奇怪而多样的结果 重新启动我的电脑 清除了 xcode 构建文件夹 使用 react native 自己建议的 react-native 更新程序尝试更新,如果这是问题(似乎已更新,仍然崩溃)我目前的规格等:
最新的 Mac OSX 最新的xcode 最新节点 + NPM 要测试的 iPhone 设备【问题讨论】:
【参考方案1】:答案显然是这里讨论的反应导航问题: https://github.com/react-navigation/react-navigation/issues/4886
我用
恢复了我的反应导航版本纱线添加 react-navigation@2.11.2
并重建,现在可以正常工作了。
【讨论】:
【参考方案2】:npm install react-navigation@2.11.2
它会很好用,我试过了,它很好用
【讨论】:
以上是关于不变违规:不变违规:尝试从未标记为“本机”的节点获取本机标记 - 反应导航更新导致崩溃的主要内容,如果未能解决你的问题,请参考以下文章