Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- react-native init serverApp
- cd serverApp
- npm install react-native-static-server --save
- react-native run-android
- 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();
- 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,
- },
- });
Add Comment
Please, Sign In to add comment