Introduction to React Native

Why do I use React Native ?

Quick history

What about Cordova

Cordova

React Native

Quick presentation of Expo

Style

StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  ...
});

Tools

Init new app faster with a CLI

npm install -g create-react-native-app
create-react-native-app my-app
cd my-app/
npm run eject # I do not love Expo 
npm start

NativeBase

the “Bootstrap of React Native”

React Navigation

Routing and navigation for your React Native apps

import React from 'react';
import { View, Text } from 'react-native';
import { createStackNavigator } from 'react-navigation';

class HomeScreen extends React.Component {
  render() {
      return (
      <View>
        <Text>Home Screen</Text>
      </View>
    );
  }
}
class SecondScreen extends React.Component {
  render() {
      return (
      <View>
        <Text>Second Screen</Text>
      </View>
    );
  }
}
export default createStackNavigator({
  Home: {
    screen: HomeScreen
  },
  Second: {
    screen: SecondScreen
  },
});

Building stack

Error during building

Error displayed on the screen

Error displayed in the console

Problems

Just the beginning…