Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
86 changes: 17 additions & 69 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,71 +1,18 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

# We fork some components by platform.
.*/*.web.js
.*/*.android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ugh
.*/node_modules/babel.*
.*/node_modules/babylon.*
.*/node_modules/invariant.*

# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs/lib/Map.js
.*/node_modules/fbjs/lib/ErrorUtils.js

# Flow has a built-in definition for the 'react' module which we prefer to use
# over the currently-untyped source
.*/node_modules/react/react.js
.*/node_modules/react/lib/React.js
.*/node_modules/react/lib/ReactDOM.js

.*/__mocks__/.*
.*/__tests__/.*

.*/commoner/test/source/widget/share.js

# Ignore commoner tests
.*/node_modules/commoner/test/.*

# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js

# Ignore jest
.*/node_modules/jest-cli/.*

# Ignore Website
.*/website/.*

# Ignore generators
.*/local-cli/generator.*

# Ignore BUCK generated folders
.*\.buckd/

# Ignore RNPM
.*/local-cli/rnpm/.*

.*/node_modules/is-my-json-valid/test/.*\.json
.*/node_modules/iconv-lite/encodings/tables/.*\.json
.*/node_modules/y18n/test/.*\.json
.*/node_modules/spdx-license-ids/spdx-license-ids.json
.*/node_modules/spdx-exceptions/index.json
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
.*/node_modules/resolve/lib/core.json
.*/node_modules/jsonparse/samplejson/.*\.json
.*/node_modules/json5/test/.*\.json
.*/node_modules/ua-parser-js/test/.*\.json
.*/node_modules/builtin-modules/builtin-modules.json
.*/node_modules/binary-extensions/binary-extensions.json
.*/node_modules/url-regex/tlds.json
.*/node_modules/joi/.*\.json
.*/node_modules/isemail/.*\.json
.*/node_modules/tr46/.*\.json
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

[include]

Expand All @@ -77,8 +24,7 @@ flow/
[options]
module.system=haste

esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
experimental.strict_type_args=true

munge_underscores=true

Expand All @@ -89,9 +35,11 @@ suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-5]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-5]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy

unsafe.enable_getters_and_setters=true

[version]
^0.25.0
^0.35.0
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ DerivedData
*.xcuserstate
project.xcworkspace

# Android/IJ
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
Expand All @@ -37,4 +39,4 @@ npm-debug.log
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
*.keystore
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
## iShiWuPai
iShiWuPai是基于React Native和Redux实现的展示型美食类APP。持续更新中,欢迎一起讨论学习!
iShiWuPai是基于React Native实现的展示型美食类APP,数据来源于[【薄荷】](http://www.boohee.com/)。master分支采用了Redux数据流管理模式,基本为UI展示型APP,未涉及深层内容,适合新人入门和学习。另因个人学习Mobx,新的分支不定时更新中,如有兴趣可移步[alpha分支](https://github.com/ljunb/react-native-iShiWuPai/tree/alpha),已适配iOS和Android两端。

## 完成功能
目前只针对iOS端,完成功能:
主分支只针对iOS端,完成功能:
- [x] 逛吃界面,支持下拉刷新和上拖加载更多
- [x] 资讯详情界面
- [x] 食物百科界面
- [x] 食物列表页面所有功能,包括子类别排序、营养素排序功能及动画,支持上拖加载更多
- [x] 搜索历史记录、搜索结果功能及对应排序动画,支持上拖加载更多
- [x] 我的、食物对比基本界面
- [x] 食物对比
- [ ] 食物详情
- [ ] 我的页面功能
- [ ] 分享&收藏
- [ ] 性能优化

## 部分功能演示
![排序](https://github.com/ljunb/react-native-iShiWuPai/blob/master/screenshot/performance.gif)
Expand All @@ -28,21 +24,21 @@ iShiWuPai是基于React Native和Redux实现的展示型美食类APP。持续更

## 运行
```
$ git clone https://github.com/ljunb/react-native-iShiWuPai.git
$ git clone -b master https://github.com/ljunb/react-native-iShiWuPai.git
$ cd react-native-iShiWuPai
$ npm install
$ npm install && react-native link
$ react-native run-ios
```

## 相关依赖
```
"dependencies": {
"react": "^15.1.0",
"react-native": "^0.27.2",
"react-native-swiper": "^1.4.4",
"react-native-vector-icons": "^2.0.2",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"react": "^15.3.1",
"react-native": "^0.39.2",
"react-native-swiper": "^1.5.4",
"react-native-vector-icons": "^3.0.0",
"react-redux": "^5.0.1",
"redux": "^3.6.0",
"redux-thunk": "^2.1.0"
},
```
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-time-machine
2 changes: 1 addition & 1 deletion android/app/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import re
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#
Expand Down
12 changes: 9 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ import com.android.build.OutputFile
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"]
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"]
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/

Expand Down Expand Up @@ -129,6 +135,6 @@ dependencies {
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
from configurations.compile
into 'libs'
}
3 changes: 3 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip

# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
@com.facebook.common.internal.DoNotStrip *;
}

-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:targetSdkVersion="22" />

<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
Expand Down
Binary file modified android/app/src/main/assets/fonts/FontAwesome.ttf
Binary file not shown.
Binary file modified android/app/src/main/assets/fonts/Octicons.ttf
Binary file not shown.
Binary file not shown.
27 changes: 0 additions & 27 deletions android/app/src/main/java/com/ishiwupai/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package com.ishiwupai;

import com.facebook.react.ReactActivity;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

import java.util.Arrays;
import java.util.List;

public class MainActivity extends ReactActivity {

Expand All @@ -18,25 +12,4 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "iShiWuPai";
}

/**
* Returns whether dev mode should be enabled.
* This enables e.g. the dev menu.
*/
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage()
);
}
}
44 changes: 44 additions & 0 deletions android/app/src/main/java/com/ishiwupai/MainApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.ishiwupai;

import android.app.Application;
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage()
);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
2 changes: 0 additions & 2 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<resources>


<string name="app_name">iShiWuPai</string>
</resources>
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ allprojects {
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../../node_modules/react-native/android"
url "$rootDir/../node_modules/react-native/android"
}
}
}
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rootProject.name = 'iShiWuPai'

include ':app'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

include ':app'
Loading