运行反应原生,服务器返回错误

时间:2018-03-12 23:22:00

标签: react-native

import React from 'react';
import {
  Image,
  Platform,
  ScrollView,
  StyleSheet,
  Text,

  View,
} 
from 'react-native';


 export default class HomeScreen extends Component<{}> {
 render() {
    return(  
    <view style={styles.container}>
      <Text>  My Name Is John </Text> </view> 


      );
 }

const styles = StyleSheet.create({
  container:{
    background :'blue',
    flex: 1,
    alignItems: 'center',
  }
});

//I got this error below

开发服务器返回响应错误代码:500

网址:http://packager.ep-qma.akinolajohn.blanco.exp.direct/node_modules/expo/AppEntry.bundle?platform=android&dev=true&strict=false&minify=false&hot=false&assetPlugin=C:\ Users \ OLUWAGBEMIGA \ Desktop \ John%20Akinola \ blanco \ node_modules \ expo \ tools \ hashAssetFiles

Body:
{"type":"TransformError","snippet":"  22 |  }\n  23 | \n> 24 | const styles = StyleSheet.create({\n     |       ^\n  25 |   container:{\n  26 |     background :'blue',\n  27 |     flex: 1,","lineNumber":24,"column":6,"filename":"C:\\Users\\OLUWAGBEMIGA\\Desktop\\John Akinola\\blanco\\screens\\HomeScreen.js","errors":[{"filename":"C:\\Users\\OLUWAGBEMIGA\\Desktop\\John Akinola\\blanco\\screens\\HomeScreen.js","lineNumber":24}]}
processBundleResult
    BundleDownloader.java:239
access$100
    BundleDownloader.java:42
execute
    BundleDownloader.java:171
emitChunk
    MultipartStreamReader.java:69
readAllParts
    MultipartStreamReader.java:116
onResponse
    BundleDownloader.java:159
c
    RealCall.java:135
run
    NamedRunnable.java:32
runWorker
    ThreadPoolExecutor.java:1133
run
    ThreadPoolExecutor.java:607
run
    Thread.java:761

1 个答案:

答案 0 :(得分:0)

尝试以下代码,您忘记关闭导出代码:

import React from 'react';
import {
  Image,
  Platform,
  ScrollView,
  StyleSheet,
  Text,

  View,
} 
from 'react-native';


 export default class HomeScreen extends React.Component{
 render() {
    return(  
    <view style={styles.container}>
      <Text>  My Name Is John </Text> </view> 


      );
 }
}

const styles = StyleSheet.create({
  container:{
    background :'blue',
    flex: 1,
    alignItems: 'center',
  }
});