undefined is not an object (evaluating #39;this.props.navigator.push#39;) while QRcode reading library(当QRcode读取库时,未定义不是对象(计算#39;this.pros.Navigator.Push)
本文介绍了当QRcode读取库时,未定义不是对象(计算';this.pros.Navigator.Push的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用REACT Native读取QRcode 然后我安装库这是我的代码
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
NavigatorIOS,
} = React;
var QRCodeScreen = require('./QRCodeScreen');
var cameraApp = React.createClass({
render: function() {
return (
<NavigatorIOS
style={styles.container,{ width:100,height:500}}
initialRoute={{
title: 'Index',
backButtonTitle: 'Back',
component: Index,
}}
/>
);
}
});
var Index = React.createClass({
render: function() {
return (
<View style={styles.contentContainer}>
<TouchableOpacity onPress={this._onPressQRCode} >
<Text>Read QRCode</Text>
</TouchableOpacity>
</View>
);
},
_onPressQRCode: function() {
this.props.navigator.push({
component: QRCodeScreen,
title: 'QRCode',
passProps: {
onSucess: this._onSucess,
},
});
},
_onSucess: function(result) {
console.log(result);
},
});
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
contentContainer: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}
});
AppRegistry.registerComponent('MyFirstReactapril', () => cameraApp);
但是我收到了这个错误
未定义不是对象(计算‘this.pros.Navigator.ush’)
我不知道它出了什么问题,请帮帮忙。 或者有没有图书馆可以读取QRCode并给我提供链接或字符串?
推荐答案
NavigatorIOS组件只能在iOS下使用。您需要使用可在Android和iOS中运行的Navigator组件。
这篇关于当QRcode读取库时,未定义不是对象(计算';this.pros.Navigator.Push的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:当QRcode读取库时,未定义不是对象(计算';this.pros.Navigator.Push


基础教程推荐
猜你喜欢
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01