我正在使用React Native開發Android應用程序。我嘗試運行一個正在顯示的屏幕的簡單代碼,但我得到以下error。我嘗試關閉所有的命令行窗口和模擬器,並重新啓動React Native軟件包並運行它,但不起作用。該代碼下面提供:開發服務器返回響應錯誤代碼:500 - 反應原生
index.android.js:
import React, { Component} from 'react';
import {Text, View, AppRegistry,Button} from 'react-native';
import {StackNavigator} from 'react-navigation';
import dhrumil from '.\dhrumil.js';
export default class MainApp extends Component{
render(){
return(
<dhrumil />
);
}
}
const SimpleApp = StackNavigator({
Home: {screen: dhrumil }
});
AppRegistry.registerComponent("MainApp",()=>SimpleApp);
dhrumil.js:
import React, { Component} from 'react';
import {Text, View, AppRegistry,Button,StyleSheet} from 'react-native';
const dhrumil =() =>{
return(
<View style={styles.container}>
<Text style={styles.texter}>Hello World!</Text>
<Button
onPress={() => navigate('dharmin')}
title="Chat with Lucy"
/>
</View>
);
}
const styles = StyleSheet.create({
container:{
justifyContent: 'center',
alignItems: 'center',
flex: 1
}
texter:
{
fontSize: 20,
textAlign: 'center'
}
});
dhrumil.navigationOptions = {
title:'dhrumil'
}
export default dhrumil
如何解決這個問題?
是的,我剛剛發現這個錯誤。這是一個愚蠢的錯誤。謝了哥們! –