This project is designed to help those who use dva to develop an native-app(it also can develop web app). In a word, this is a simple example.
- Dva, Lightweight front-end framework based on redux, redux-saga and react-router@2.x. (Inspired by elm and choo)
Quick Start (12 步 30 分钟,完成用户管理的 CURD 应用) (react+dva+antd)
- React-Motion, A spring that solves your animation problems.
It's Works with React-Native v0.18+. In addition, I have written two examples on the web application. If you are interested in the animation, you should go to look at it. (Additional knowledge.)
-
Clone this repo.
-
Modify something in package.json like name to "your-project-name".
-
Run npm install.
$ npm install
- Run.
$ react-native run-ios
- To know the directory structure.
$ tree . -L 3
.
├── android
├── assets // saved image resources who variable
├── index.android.js // root entrance for android platform!!
├── index.ios.js // root entrance!!
├── ios
├── node_modules
├── package.json
├── src
│ ├── Router.js // all routing
├── components // dumb component
│ ├── Login.js
│ ├── Splash.js
│ └── common
├── models
│ ├── Auth.js
│ ├── Find.js
│ ├── Homepage.js
│ ├── Initial.js
│ └── Newbie.js
├── routes // smart component
│ ├── Find.js
│ ├── Homepage.js
│ ├── Login.js
│ ├── More.js
│ ├── Register.js
│ └── Register2.js
├── services
├── utils // such as config, request, defaults
└── yarn.lock
- The whole entrance is index.jsx. I try to describe clearly why import that.
...
const app = dva();
// Load models. In web application can use dynamic routing, But in native-app maybe don't need
app.model(Initial);
app.model(Auth);
app.model(Homepage);
app.model(Newbie);
app.model(Find);
app.router(() => <Router />);
AppRegistry.registerComponent('RnDva', () => app.start());
-
Dva/Redux/React-Router, reading some documents will help you.
-
Look at 'subscriptions' (in models/Initial.js), when app in Splash screen, then will jump to Homepage after 3s.
...
subscriptions: {
initialize() {
_.delay(() => {
Actions.tabbar({ type: 'reset' });
}, 3000);
}
}
Thanks to dvajs group for providing the lightweight framework for developers. And in work I am a mobile application developer as android/iOS platform, before using dva, I have been using the reactnative+reudx+redux-thunk. I have subscribed to issue list for a long time. I saw a lot of issues have been proposed, and soon be solved. Thanks to the team and chencheng (云谦) once again.
Thank you for reading.
logo_ico.png from rezzzzzzz's Oh My D.VA who in dribbble. Thank rezzzzzzz! She's so pink :)