React Native - dennisholee/notes GitHub Wiki

Environment Setup

IDE Setup

  1. Download Atom
  2. Install nuclide (Atom -> Preference -> Settings -> install)

Libraries

Expo CLI npm i -g expo-cli

Expo

Login expo login

Managing constants

In the "app.json" file add constants under expo.extra i.e.:

{
  "expo": {
    ...
    "extra" : {
      "hsbc" : {
        "branch": {
          "url": "https://api.hsbc.com/open-banking/v2.2/branches"
        }
      }
    },
  },
}

To reference the constant:

import { Constants } from 'expo'

... Constants.manifest.extra.hsbc.branch.url ...

Images

Add image using default size

<Image
  style={{flex:1, height: undefined, width: undefined}}
  source={require('../../../assets/images/onboarding-how-it-works.png')}
  resizeMode="contain"
/>

Turn opaque when image is selected

<TouchableOpacity style={{flex: 1, height: undefined, width: undefined}} onPress={this.onPress} >          
    <Image
        style={{flex: 1, height: undefined, width: undefined}}
        source={{ uri: this.props.imgUrl }}
         resizeMode="contain" />
</TouchableOpacity>

Install firebase module npm i --save firebase

Useful links