Guest User

Untitled

a guest
Oct 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. react-native init serverApp
  2.  
  3. cd serverApp
  4.  
  5. npm install react-native-static-server --save
  6.  
  7. react-native run-android
  8.  
  9. import StaticServer from 'react-native-static-server';
  10.  
  11. let server = new StaticServer(8080);
  12.  
  13. // Start the server
  14. server.start().then((url) => {
  15. console.log("Serving at URL", url);
  16. });
  17.  
  18. server.stop();
  19.  
  20. import React, {Component} from 'react';
  21. import {StyleSheet, Text, View} from 'react-native';
  22.  
  23. import StaticServer from 'react-native-static-server';
  24.  
  25. let server = new StaticServer(8080);
  26.  
  27. // Start the server
  28. server.start().then((url) => {
  29. console.log("Serving at URL", url);
  30. });
  31.  
  32. server.stop();
  33.  
  34. type Props = {};
  35. export default class App extends Component<Props> {
  36. render() {
  37. return (
  38. <View style={styles.container}>
  39. <Text style={styles.welcome}>Welcome to React Native!</Text>
  40. <Text style={styles.instructions}>To get started, edit App.js</Text>
  41. </View>
  42. );
  43. }
  44. }
  45.  
  46. const styles = StyleSheet.create({
  47. container: {
  48. flex: 1,
  49. justifyContent: 'center',
  50. alignItems: 'center',
  51. backgroundColor: '#F5FCFF',
  52. },
  53. welcome: {
  54. fontSize: 20,
  55. textAlign: 'center',
  56. margin: 10,
  57. },
  58. instructions: {
  59. textAlign: 'center',
  60. color: '#333333',
  61. marginBottom: 5,
  62. },
  63. });
Add Comment
Please, Sign In to add comment