Skip to content

Instantly share code, notes, and snippets.

@mildavw
Last active May 25, 2018 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mildavw/a20d3ef894e4faa4a06818a7a474974f to your computer and use it in GitHub Desktop.
Save mildavw/a20d3ef894e4faa4a06818a7a474974f to your computer and use it in GitHub Desktop.
React Native build for Native Starter Pro 8.1.0

git clone git@gitstrap.com:strapmobile/NativeStarterPro-FullApp.git

cd NativeStarterPro-FullApp/MobileApp/

yarn

yarn run eject

Select option: "React Native: I'd like a regular React Native project." Answer the questions that follow.

Change index.js to

import { AppRegistry } from 'react-native';
import setup from './js/setup';

AppRegistry.registerComponent('YOUR_APP_NAME', () => setup);

Edit js/setup.js to be:

import React, { Component } from 'react';
import { Spinner, StyleProvider } from 'native-base';
import App from './App';
import getTheme from '../native-base-theme/components';
import variables from '../native-base-theme/variables/commonColor';

export default class Setup extends Component {
  constructor() {
    super();
    this.state = {
      isLoading: false,
      isReady: false,
    };
  }
  componentWillMount() {
    this.setState({ isReady: true });
  }

  render() {
    if (!this.state.isReady) {
      return <Spinner />;
    }
    return (
      <StyleProvider style={getTheme(variables)}>
        <App />
      </StyleProvider>
    );
  }
}

Start Metro Bundler

yarn start

react-native run-ios

Launch Android Studio Tools > AVD Manager Start a device emulator

react-native run-andriod

#Start the back-end

Fire up MongoDB mongod --config /usr/local/etc/mongod.conf

cd ../NativeStarterPro-FullApp/ApiServer yarn start

To use a custom domain name (i.e. http://myApp.local:5001) edit the android emulator hosts file

https://stackoverflow.com/questions/41139087/i-cant-edit-android-emulators-host-file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment