1.2.2 • Published 8 years ago
easy-react-native v1.2.2
easy-react-native
easy-react-native is a framework that solves the store and router problems of creating a react-native app, it is composed of two main independent libraries: mini-routerjs as router, jsonstore-js as store.
Installing
$ npm install easy-react-native --save
import EasyReactNative from 'easy-react-native';
Example
File: ./index.android.js or ./index.ios.js
import React, { PropTypes, Component } from 'react';
import EasyReactNative, { Store } from 'easy-react-native';
import {
AppRegistry
} from 'react-native';
// Import pages
import PageOne from './PageOne';
import PageTwo from './PageTwo';
import PageThree from './PageThree';
// Create routers
const pageOne = {
pattern: '/page-one',
selector: function (request, store) {
return { name: store.get('currentPage') };
},
component: PageOne
};
const pageTwo = {
pattern: '/page-two',
selector: function (request, store) {
return { name: store.get('currentPage') };
},
component: PageTwo
};
const pageThree = {
pattern: '/page-three',
selector: function (request, store) {
return { name: store.get('currentPage') };
},
component: PageThree
};
// Create the root app
const initialStore = new Store({
store: {
tip: 'Hello world!'
}
});
class AppRoot extends Component {
render() {
return <EasyReactNative routes={[pageOne, pageTwo, pageThree]} initialPath="/page-one" initialStore={initialStore}/>;
}
}
AppRegistry.registerComponent('EasyReactNativeExample', () => AppRoot);
File: ./PageOne.js
import React, { Component, PropTypes } from 'react';
class
License
MIT
1.2.2
8 years ago
1.2.1
8 years ago
1.2.0
8 years ago
1.1.22
8 years ago
1.1.21
8 years ago
1.1.20
8 years ago
1.1.19
8 years ago
1.1.18
8 years ago
1.1.17
8 years ago
1.1.16
8 years ago
1.1.15
8 years ago
1.1.14
8 years ago
1.1.13
8 years ago
1.1.12
8 years ago
1.1.11
8 years ago
1.1.10
8 years ago
1.1.9
8 years ago
1.1.8
8 years ago
1.1.7
8 years ago
1.1.6
8 years ago
1.1.5
8 years ago
1.1.4
8 years ago
1.1.3
8 years ago
1.1.2
8 years ago
1.1.1
8 years ago
1.1.0
8 years ago
1.0.6
8 years ago
1.0.5
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago