├── .gitignore
├── README.md
├── _config.yml
├── android
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── eaffy
│ └── rnmarketcomment
│ ├── RNMarketCommentModule.java
│ └── RNMarketCommentPackage.java
├── index.js
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 | ios/assets/
25 | ios/main.*
26 |
27 | # Android/IJ
28 | #
29 | *.iml
30 | .idea
31 | .gradle
32 | local.properties
33 | # android/app/deepdata.keystore
34 |
35 | # node.js
36 | #
37 | node_modules/
38 | npm-debug.log
39 |
40 | # BUCK
41 | buck-out/
42 | \.buckd/
43 | android/keystores/debug.keystore
44 |
45 | # sonar-scanner
46 | sonar-project.properties
47 | .sonar/
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-market-comment
2 | ### 打开应用市场进行评论。iOS: 跳转 AppStore 评论页; Android: 跳出所有本机已安装应用市场列表,点击跳转对应市场 App评论页。
3 | #### Installing
4 | `npm install react-native-market-comment --save`
5 | #### Lingking Native Dependencies
6 | `react-naitve link react-native-market-comment`
7 | #### Usage
8 | `import openAppStoreToComment from 'react-native-market-comment';`
9 | ```
10 | didClickCommentButton = () => {
11 | openAppStoreToComment();
12 | }
13 | ```
14 | #### API
15 | * openAppStoreToComment(yourAppIdOnAppStore)
16 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "25.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 22
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | }
14 |
15 | dependencies {
16 | compile "com.facebook.react:react-native:+"
17 | }
18 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/java/com/eaffy/rnmarketcomment/RNMarketCommentModule.java:
--------------------------------------------------------------------------------
1 | package com.eaffy.rnmarketcomment;
2 |
3 | import android.net.Uri;
4 | import android.content.pm.PackageManager;
5 | import android.content.Intent;
6 |
7 | import com.facebook.react.bridge.NativeModule;
8 | import com.facebook.react.bridge.ReactApplicationContext;
9 | import com.facebook.react.bridge.ReactContext;
10 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
11 | import com.facebook.react.bridge.ReactMethod;
12 |
13 | import java.util.Map;
14 |
15 | public class RNMarketCommentModule extends ReactContextBaseJavaModule {
16 |
17 | ReactApplicationContext reactContext;
18 |
19 | public RNMarketCommentModule(ReactApplicationContext reactContext) {
20 | super(reactContext);
21 | this.reactContext = reactContext;
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "RNMarketCommentModule";
27 | }
28 |
29 | @ReactMethod
30 | public void show() {
31 | Uri uri = Uri.parse("market://details?id=" + reactContext.getPackageName());
32 | Intent intent = new Intent(Intent.ACTION_VIEW,uri);
33 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
34 | reactContext.startActivity(intent);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/android/src/main/java/com/eaffy/rnmarketcomment/RNMarketCommentPackage.java:
--------------------------------------------------------------------------------
1 | package com.eaffy.rnmarketcomment;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.NativeModule;
5 | import com.facebook.react.bridge.JavaScriptModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | public class RNMarketCommentPackage implements ReactPackage {
14 |
15 | @Override
16 | public List createViewManagers(ReactApplicationContext reactContext) {
17 | return Collections.emptyList();
18 | }
19 |
20 | @Override
21 | public List createNativeModules(ReactApplicationContext reactContext) {
22 | List modules = new ArrayList<>();
23 |
24 | modules.add(new RNMarketCommentModule(reactContext));
25 |
26 | return modules;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import {
2 | Linking,
3 | Platform,
4 | NativeModules
5 | } from 'react-native';
6 |
7 | const RNMarketCommentModule = NativeModules.RNMarketCommentModule;
8 |
9 | export default function openAppStoreToComment (appId = 1210643082) {
10 | if (Platform.OS === 'ios') {
11 | const url = `itms-apps://itunes.apple.com/cn/app/id${appId}?mt=8&action=write-review`;
12 | Linking.openURL(url).catch(err => console.error('An error occurred', err));
13 | return;
14 | }
15 | if (Platform.OS === 'android') {
16 | RNMarketCommentModule.show();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-market-comment",
3 | "version": "1.0.2",
4 | "description": "iOS: 跳转到应用AppStore添加评论页面;Android: 展示手机上已安装的应用市场,可以到每个市场添加评论",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/Eaffy/react-native-market-comment.git"
12 | },
13 | "keywords": [
14 | "[\"react-native\"",
15 | "\"market\"",
16 | "\"comment\"",
17 | "\"score\"",
18 | "\"appstore\"]"
19 | ],
20 | "author": "QiaoYifei",
21 | "license": "ISC",
22 | "bugs": {
23 | "url": "https://github.com/Eaffy/react-native-market-comment/issues"
24 | },
25 | "homepage": "https://github.com/Eaffy/react-native-market-comment#readme"
26 | }
27 |
--------------------------------------------------------------------------------