您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页F8App-ReactNative项目源码分析1-初体验

F8App-ReactNative项目源码分析1-初体验

来源:二三娱乐

iOS启动后会报错,运行 react-native start就可以了

2016-05-17 11:34:12.357 [fatal][tid:main] Cannot find entry file index.ios.js in any of the roots: ["/Users/zhangxitao/work/github/f8app"]

项目依赖 Requirements

  1. (follow iOS and Android guides)
- Xcode 7.3 +
  1. (only for iOS)
- Version 1.0+ recommended (`gem install cocoapods --pre`)
  1. (needed to run Parse Server locally)

修改后的安装过程

  1. Clone the repo
```
$ git clone 
$ cd f8app
```
  1. Install dependencies (npm v3+):
```
$ npm install
$ (cd ios; pod install)        # only for iOS version
```
  1. Make sure MongoDB is running:
    先下载mongodb或直接通过brew install mongodb 命令安装。Mongodb不熟悉的需要先学习下mongodb的常用命令,和mysql有些类似。
```
$ lsof -iTCP:27017 -sTCP:LISTEN
$  mongod   --dbpath  YOURDATAPATH/mongodata/ &  #启动mongodb
```

NOTE: if installed with [Homebrew](http://brew.sh/) run `brew info mongo` and
check out the Caveats section.

If you prefer to use an external MongoDB server, set `DATABASE_URI`:

```
$ export 
```
  1. Start Parse/GraphQL servers:
```
$ npm start
$ react-native start

```
  1. Import sample data (the local Parse Server should be running): 并验证一下数据是否导入正确。
```
$ npm run import-data
$ mongo
MongoDB shell version: 2.6.5
connecting to: test
>
> show databases
admin  (empty)
dev    0.078GB
local  0.078GB
> use dev
switched to db dev
> show collections
Agenda
FAQ
Maps
Notification
Page
Speakers
Survey
_Installation
_SCHEMA
system.indexes
> db.FAQ.find()
#会查到很多数据
```

Make sure everything works by visiting:

* Parse Dashboard: [http://localhost:8080/dashboard](http://localhost:8080/dashboard)
* Graph*i*QL: [http://localhost:8080/graphql](http://localhost:8080/graphql?query=query+%7B%0A++schedule+%7B%0A++++title%0A++++speakers+%7B%0A++++++name%0A++++++title%0A++++%7D%0A++++location+%7B%0A++++++name%0A++++%7D%0A++%7D%0A%7D)
  1. Running on Android:
```
$ react-native run-android
$ adb reverse tcp:8081 tcp:8081   # required to ensure the Android app can
$ adb reverse tcp:8080 tcp:8080   # access the Packager and GraphQL server
```
  1. Running on iOS:
```
$ react-native run-ios
```

实际运行效果

这样安卓和iOS模拟器应该都跑起来了。实际效果如下:


下篇文章开始分析f8app的服务器端结构。

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务