代码之家  ›  专栏  ›  技术社区  ›  V.Cozzatella

在react native中打开服务器

  •  0
  • V.Cozzatella  · 技术社区  · 6 年前

    react-native-static-server

    react-native-http-bridge

    here you can find my problem with react-native-static-server

    因此,即使我遵循教程,我尊重所有的规则,本地服务器不工作,并向我显示这个错误。

    enter image description here

    这是app.js的代码:

    import React, {Component} from 'react'; import {StyleSheet, Text, View} from 'react-native'; import StaticServer from 'react-native-static-server'; let server = new StaticServer(8080); // Start the server server.start().then((url) => { console.log("Serving at URL", url); }); server.stop(); type Props = {}; export default class App extends Component<Props> { render() { return ( <View style={styles.container}> <Text style={styles.welcome}>Welcome to React Native!</Text> <Text style={styles.instructions}>To get started, edit App.js</Text> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, });
    

    有人可以建议一种方法来实现服务器在我的反应本机应用程序或教程来解决这个问题谢谢

    0 回复  |  直到 6 年前