Setting up a project in React - LucyMHall/Fizzy_O GitHub Wiki

Initial Set up:

*$ react-native init NameOfApp

  • this generate some basic structure and installs all necessary dependencies
  • at this point you can actually run your app via npm start - this goes to a development server which can provide you with live updates on changes you make
  • use app Expo to connect your phone and launches it into this app, to get out of this $ npm run eject
  • You should have index.js (provides entry point into app) and
  • In App.js
    • has a bit at the top where you load main components in e.g. View, Text, StyleSheet
    • in the stylesheet section you can create a new StyleSheet JS object which contains classes (way of grouping certain styles) which have properties on them
const styles = StyleSheet.create({
  nameOfClass: {
    flex: 1,
    backgroundColor: #304204
  }

});
  • You can then assign these classes to components e.g. <View style={styles.nameOfClass}>