Android React native app

Have played around react native, and published an android app earlier.

some thoughts:

  1. navigator

    this would normally be the entry point, which define the landing page, and how routing to different pages works.


<Navigator
    initialRoute={{ title: 'Tap Scene', id: 'default' }}
    renderScene={this.navigatorRenderScene}
/>

 

Scene

2. For each scene, its a Component, where the life cycle of constructor, componentDidMount, componentUnmount, can be used to trigger specific actions. on each scene, you can use JSX to create the page/view, which could link to functions, like normal js binding:

onActionSelected
onIconClicked
handleClick() {
    if(!this.state.favnumber)
        LocalToastAndroid.show('Please set up your favorite number first', LocalToastAndroid.SHORT);
    else
        LocalToastAndroid.call(this.state.favnumber);
};

Additional actions

3. native react native modules wont cover all functions you request, to create custom module, you can register additional

ReactContextBaseJavaModule

then exposing the method to JS

@ReactMethod
public void call(String number){
.....
}
module.exports = NativeModules.CustomizedModule;

here is the app: https://play.google.com/store/apps/details?id=com.best2lwjj