android - mqt_native_modules react.common.JavascriptException: TypeError: undefined is not an object (评估 'w.default.chapterContent[c].content')
问题描述
当我单击新视图时,React Native 应用程序崩溃。但是,堆栈跟踪显示没有导致我的代码,所以我不知道如何调试。有人可以指出我正确的方法,或者让我知道我是否应该向 React Native 报告错误?
错误和完整的堆栈跟踪:
FATAL EXCEPTION: mqt_native_modules
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Process: com.myappname, PID: 6115
04-21 17:47:34.000 6115 6143 E AndroidRuntime: com.facebook.react.common.JavascriptException: TypeError: TypeError: undefined is not an object (evaluating 'w.default.chapterContent[c].content')
04-21 17:47:34.000 6115 6143 E AndroidRuntime:
04-21 17:47:34.000 6115 6143 E AndroidRuntime: This error is located at:
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in c
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in AndroidHorizontalScrollContentView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in AndroidHorizontalScrollView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in E
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in z
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in _
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in u
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in o
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTScrollView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in E
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in n
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in l
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in s
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in u
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in C
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in n
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in E
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in n
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in H
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in L
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in h
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in v
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in h
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in _
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in N
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in n
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in D
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in h
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in c
04-21 17:47:34.000 6115 6143 E AndroidRuntime:
04-21 17:47:34.000 6115 6143 E AndroidRuntime: This error is located at:
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in N
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in n
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in D
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in h
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in RCTView
04-21 17:47:34.000 6115 6143 E AndroidRuntime: in c, stack:
04-21 17:47:34.000 6115 6143 E AndroidRuntime: renderItem@628:716
04-21 17:47:34.000 6115 6143 E AndroidRuntime: value@632:19530
04-21 17:47:34.000 6115 6143 E AndroidRuntime: value@247:22532
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Cr@90:49183
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Ji@90:70549
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Ki@90:71041
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Ua@90:77455
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Na@90:76778
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Ie@90:84181
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Me@90:13520
04-21 17:47:34.000 6115 6143 E AndroidRuntime: Oe@90:13693
04-21 17:47:34.000 6115 6143 E AndroidRuntime: receiveTouches@90:14462
04-21 17:47:34.000 6115 6143 E AndroidRuntime: value@28:3311
04-21 17:47:34.000 6115 6143 E AndroidRuntime: <unknown>@28:822
04-21 17:47:34.000 6115 6143 E AndroidRuntime: value@28:2565
04-21 17:47:34.000 6115 6143 E AndroidRuntime: value@28:794
04-21 17:47:34.000 6115 6143 E AndroidRuntime:
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
04-21 17:47:34.000 6115 6143 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
我尝试过的: 1. 我用谷歌搜索了 mqt_native_modules,发现很多人认为问题出在 React/React Native 上。有没有办法找出我的 React Native 是否也有问题,或者我应该只提交一个错误?2. 我搜索了我的存储库,w.default.chapterContent[c].content
但最接近的片段是const { content } = ContentService.chapterContent[chapterId];
和this.chapterContent[doc.id]
这是其中一个组件:
import { StyleSheet, Text, ScrollView } from 'react-native';
import ContentService from '../services/ContentService';
export default class Conclusion extends React.Component {
constructor() {
super();
const { chapterId } = ContentService.chapterDataMap['conclusion'];
const { content } = ContentService.chapterContent[chapterId];
this.state = { content };
}
render() {
const { content } = this.state;
return (
<ScrollView style={styles.scrollView}>
<Text style={styles.module}>{content}</Text>
</ScrollView>
);
}
}
该服务适用于 iOS。
解决方案
已解决:这确实不是代码问题。我正在与一个团队合作,同时拆分 Android 和 iOS 的职责。iOS 端已经输入了必要的数据,但我们使用的是不同的 Firebase 帐户。
推荐阅读
- java - 使用服务生成器将数据库数据显示到数据表
- algorithm - 分布式算法的空间复杂度
- angular - Angular 5 中具有不同输入的反应式表单和数学运算
- python - 从两列(标签、文本)数据源进行文本分类从哪里开始?
- jquery - 在打字稿中使用 $.get 的成功回调时无法将数据绑定到类变量
- datetimepicker - 如何将最小日期设置为 datetimepicker
- c - 如何在 GTK+ 中隐藏一个 .ui 文件并显示另一个 .ui 文件
- android - 在 android 应用程序中使用 React Native 模块作为视图布局
- ios - 如何更改集合视图单元格大小并添加填充?
- javascript - 使用 javascript 更改自定义字段的值后,如何将其保存到 wordpress 的 user_meta?