1.2.2 • Published 7 years ago

easy-react-native v1.2.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago