帮助,我尝试代码应用程序,我似乎无法通过此错误。
jupyter notebook
我认为问题在于此块
var React = require('react-native');
var {
View,
Text,
StyleSheet
} = React;
var styles = StyleSheet.create({
mainContainer: {
flex: 1,
padding: 30,
marginTop: 65,
flexDirection: 'column',
justifyContent: 'center',
backgroundColor: '#48BBEC'
},
title: {
marginBottom: 20,
fontSize: 25,
textAlign: 'center',
color: '#fff'
},
searchInput: {
height: 50,
padding: 4,
marginRight: 5,
fontSize: 23,
borderWidth: 1,
borderColor: 'white',
borderRadius: 8,
color: 'white'
},
buttonText: {
fontSize: 18,
color: '#111',
alignSelf: 'center'
},
button: {
height: 45,
flexDirection: 'row',
backgroundColor: 'white',
borderColor: 'white',
borderWidth: 1,
borderRadius: 8,
marginBottom: 10,
marginTop: 10,
alignSelf: 'stretch',
justifyContent: 'center'
},
});
class Main extends React.Component{
render(){
return (
<View style={styles.mainContainer}>
<Text> Testing the Router </Text>
</View>
)
}
};
module.exports = Main;
错误信息是:SyntaxError /Users/tevinrivera/Rondeh/App/Components/Main.js:未终止的JSX内容(57:41)
答案 0 :(得分:0)
一切都很好看。尝试更改此代码
var React = require('react-native');
var {
View,
Text,
StyleSheet
} = React;
到这个
const React = require('React');
const ReactNative = require('react-native');
const{
StyleSheet,
View,
Text
} = ReactNative;
答案 1 :(得分:0)
你的进口是错误的。你需要从'react'导入React,以及从'react-native'导入View,Stylesheet等其他东西。
类似的东西会起作用:
import React from 'react';
import {
View,
Text,
StyleSheet
} from 'react-native';