All Projects → wy1027 → react-native-dva

wy1027 / react-native-dva

Licence: other
一个由react-native、react-navigation、dva搭建的简易架子

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to react-native-dva

React Native Dva Starter
a React Native starter powered by dva and react-navigation
Stars: ✭ 637 (+2096.55%)
Mutual labels:  react-navigation, dva
umi-react-native
umi preset plugins for react-native
Stars: ✭ 54 (+86.21%)
Mutual labels:  react-navigation, dva
React Native Feature Boilerplate
Feature based Architecture for developing Scalable React Native Apps 🚀 using react, redux, sagas and hooks
Stars: ✭ 139 (+379.31%)
Mutual labels:  react-navigation
Pillar Valley
👾A cross-platform video game built with Expo, three.js, and Firebase! 🎮🕹
Stars: ✭ 242 (+734.48%)
Mutual labels:  react-navigation
Expo Native Firebase
🔥 Native Firebase Expo App (iOS, Android) Demo for Firestore, Notifications, Analytics, Storage, Messaging, Database 🚨
Stars: ✭ 197 (+579.31%)
Mutual labels:  react-navigation
Redux React Navigation Demos
React-Native + Redux + Redux-Persist + React Navigation ( Authentication Flow with Redux demos)
Stars: ✭ 151 (+420.69%)
Mutual labels:  react-navigation
Expo Firebase Starter
🔥⚛️📱 Expo + Firebase Starter Kit
Stars: ✭ 199 (+586.21%)
Mutual labels:  react-navigation
Yaba Social
Yet Another Boilerplate App showing off react-navigation and the excellent new tools from Apollo
Stars: ✭ 133 (+358.62%)
Mutual labels:  react-navigation
react-native-boilerplate
A collection of curated and well maintained React Native boilerplates with various possibilities and combinations.
Stars: ✭ 24 (-17.24%)
Mutual labels:  react-navigation
React Native Popover View
A well-tested, adaptable, lightweight <Popover> component for react-native
Stars: ✭ 191 (+558.62%)
Mutual labels:  react-navigation
React Native Ofo
React Native 仿 ofo 共享单车 App
Stars: ✭ 239 (+724.14%)
Mutual labels:  react-navigation
Expo Uber
Uber UI Clone with React Native & Expo
Stars: ✭ 186 (+541.38%)
Mutual labels:  react-navigation
Slopeninja Native
 Slope Ninja App 🎿❄️⛄️
Stars: ✭ 160 (+451.72%)
Mutual labels:  react-navigation
React Navigation.github.io
Home of the documentation and other miscellanea
Stars: ✭ 207 (+613.79%)
Mutual labels:  react-navigation
Typescript React Native Starter
A highly scalable foundation with a focus on best pratices and simplicity to start your React Native project in seconds.
Stars: ✭ 141 (+386.21%)
Mutual labels:  react-navigation
Fluidtransitions
Fluid Transitions for React Navigation
Stars: ✭ 2,814 (+9603.45%)
Mutual labels:  react-navigation
React Native Boilerplate
A React Native boilerplate with Expo, Redux, React Navigation, Styled Components and some 💕 included.
Stars: ✭ 135 (+365.52%)
Mutual labels:  react-navigation
React Navigation Backhandler
Easily handle Android back button behavior with React-Navigation.
Stars: ✭ 177 (+510.34%)
Mutual labels:  react-navigation
Comicbook
React-Native跨平台漫画App免费视频:http://www.kongyixueyuan.com/course/3528
Stars: ✭ 199 (+586.21%)
Mutual labels:  react-navigation
react-native-web-monorepo-navigation
⚛️ An opinionated universal navigation strategy for codebases containing both React & React Native
Stars: ✭ 24 (-17.24%)
Mutual labels:  react-navigation

react-native-dva

前言

最近一版的app使用的是react-native,所以搭个架子总结下使用到的技术, 希望可以对有兴趣入坑的同学一些帮助。

环境搭建

请参考 react-native中文网

运行

安装依赖包

	yarn

android

	react-native run-android

ios

	react-native run-ios

dva介绍

dva解决了我们使用redux管理数据的那些繁杂的步骤,它把所有的步骤都整合到一个model文件里,在这个文件里你可以管理你的state,处理你的同步action还有异步action,而且还整合了redux-saga,让你的异步处理变得更简洁。美滋滋!

react-native如何结合dva

  1. 初始化react-native项目
  2. yarn add dva-core
  3. yarn add react-redux

使用dva-core的原因是因为react-native并不支持react-router v4,所以我们并不能使用这个路由,我们只需要dva的核心功能就行了。作者也是在这个版本中把dva-core给单独提取了出来,所以我们只需要调用create的方法把它给实例化,然后调用start方法把RN上的路由传进去就行。

import React from 'react';
import { create } from 'dva-core';
import { Provider, connect } from 'react-redux';

export { connect };

export default (options) => {
  const app = create(options);
  
  if (!global.registered) options.models.forEach(model => app.model(model));

  global.registered = true;

  app.start();
  
  const store = app._store;

  app.start = container => () => (
    <Provider store={store}>
      {container}
    </Provider>
  );

  app.getStore = () => store;

  return app;
};

react-native如何添加react-navigation

react-navigation是官方推的一个路由,很好用,切换流畅,而且兼容ios和android。 官方地址 中文参考

整合遇到的问题

打包后无法正常运行的情况

1.错误的使用dva-no-router,这是react项目使用的,并不适用于rn,改用dva-core + react-redux 2.解构失败: const value = ({}) => { ... } 是不允许的, 会报错

ReactNativeJS: 'Unhandled promise rejection', { [TypeError: undefined is not a function (evaluating 'babelHelpers.objectDestructuringEmpty(r)')]

mac运行出现错误

Could not install the app on the device, read the error above for details.Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

解决办法: 在根目录下运行:chmod 755 android/gradlew 然后就解决了

react-navigation 问题

参考 很全很详细

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].