Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native android自定义组件UI崩溃,出现致命异常:mqt_native_模块_Android_React Native - Fatal编程技术网

React native android自定义组件UI崩溃,出现致命异常:mqt_native_模块

React native android自定义组件UI崩溃,出现致命异常:mqt_native_模块,android,react-native,Android,React Native,我正在尝试按照中指定的步骤进行操作 经过一番努力,我编译了android端代码,但无论我在js文件中输入了什么样的类型,我总是会遇到以下崩溃: 错误:找不到变量:PropTypes\n堆栈:\n index.android.bun…:52892\n需要index.android.bun…:254\n index.android.bun…:1429\n需要 index.android.bun…:254\n需要index.android.bun…:200\n 全球的code@index…:52898

我正在尝试按照中指定的步骤进行操作

经过一番努力,我编译了android端代码,但无论我在js文件中输入了什么样的类型,我总是会遇到以下崩溃:

错误:找不到变量:PropTypes\n堆栈:\n index.android.bun…:52892\n需要index.android.bun…:254\n index.android.bun…:1429\n需要
index.android.bun…:254\n需要index.android.bun…:200\n 全球的code@index…:52898\n URL:index.android.bundle\n 行:52892\n消息:找不到变量:PropTypes'

我的js代码如下所示:

var { requireNativeComponent } = require('react-native');

var icon = {   
    name: 'IconTextView',   
    propTypes: {
      fontFamily: PropTypes.string   
    },
};

module.exports = requireNativeComponent('RCTIconTextView', icon);
我有什么遗漏吗?有人能给我举个有效的例子吗

解决了的: 最后,我让javascript端使用以下代码:

var { requireNativeComponent } = require('react-native');
var React = require('react-native');

var icon = {
  name: 'IconTextView',
  propTypes: {
    fontFamily: React.PropTypes.string,
    scaleX:     React.PropTypes.number,
    scaleY:     React.PropTypes.number,
    translateX: React.PropTypes.number,
    translateY: React.PropTypes.number,
    rotation:   React.PropTypes.number,
    opacity:    React.PropTypes.number,
    backgroundColor: React.PropTypes.number,
  },
};

module.exports = requireNativeComponent('RCTIconTextView', icon);

对于因React native read on中的mqt_native_模块错误而来此hhread的人:

我发帖是想让你知道这个bug是由于旧安卓手机上的子视图数量受到限制而引起的。(最多16-20个视图)

请参见这两个问题:和


很明显,它已被修复,所以让我们等待它。

我收到了相同的问题。你找到解决办法了吗?是的,我找到了。你也需要做出反应。请参阅我所附的代码段。