├── .babelrc ├── .buckconfig ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── App.js ├── README.md ├── android ├── .project ├── .settings │ └── org.eclipse.buildship.core.prefs ├── app │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── BUCK │ ├── agconnect-services.json │ ├── build.gradle │ ├── debug.keystore │ ├── google-services.json.bak │ ├── libs │ │ ├── MiPush_SDK_Client_3_6_2.jar │ │ ├── MiPush_SDK_Client_3_7_0.jar │ │ ├── com.coloros.mcssdk.jar │ │ └── vivo_pushsdk_v2.3.4.jar │ ├── proguard-rules.pro │ ├── release.keystore │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── fonts │ │ │ ├── AntDesign.ttf │ │ │ ├── Entypo.ttf │ │ │ ├── EvilIcons.ttf │ │ │ ├── Feather.ttf │ │ │ ├── FontAwesome.ttf │ │ │ ├── FontAwesome5_Brands.ttf │ │ │ ├── FontAwesome5_Regular.ttf │ │ │ ├── FontAwesome5_Solid.ttf │ │ │ ├── Foundation.ttf │ │ │ ├── Ionicons.ttf │ │ │ ├── MaterialCommunityIcons.ttf │ │ │ ├── MaterialIcons.ttf │ │ │ ├── Octicons.ttf │ │ │ ├── SimpleLineIcons.ttf │ │ │ └── Zocial.ttf │ │ ├── java │ │ └── com │ │ │ └── nim_reactnative_demo │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── keystores │ ├── BUCK │ ├── debug.keystore.properties │ └── my-aos-release-key.keystore ├── nimpush │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── README.md │ ├── bin │ │ ├── .gitignore │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── netease │ │ │ │ └── nim │ │ │ │ └── rn │ │ │ │ └── push │ │ │ │ ├── NIMPushModule.class │ │ │ │ └── NIMPushPackage.class │ │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ ├── build.gradle │ ├── libs │ │ └── rnlib.jar │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── netease │ │ │ └── nim │ │ │ └── rn │ │ │ └── push │ │ │ ├── NIMPushModule.java │ │ │ └── NIMPushPackage.java │ │ └── res │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ └── values │ │ └── strings.xml └── settings.gradle ├── app.json ├── build.gradle.example ├── iOS苹果推送配置.md ├── index.js ├── ios ├── .gitignore ├── NIM_ReactNative_Demo-tvOS │ └── Info.plist ├── NIM_ReactNative_Demo-tvOSTests │ └── Info.plist ├── NIM_ReactNative_Demo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── NIM_ReactNative_Demo-tvOS.xcscheme │ │ └── NIM_ReactNative_Demo.xcscheme ├── NIM_ReactNative_Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── 120-1.png │ │ │ ├── 120.png │ │ │ ├── 180.png │ │ │ ├── 40.png │ │ │ ├── 58.png │ │ │ ├── 60.png │ │ │ ├── 80.png │ │ │ ├── 87.png │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ ├── NIM_ReactNative_Demo.entitlements │ └── main.m ├── NIM_ReactNative_DemoTests │ ├── Info.plist │ └── NIM_ReactNative_DemoTests.m ├── UIView+Toast.h └── UIView+Toast.m ├── jsconfig.json ├── nim ├── NIM_Android_Push.js ├── NIM_Web_SDK_rn_v6.1.0.js ├── NIM_Web_SDK_rn_v7.2.0.js └── third-party.zip ├── nim_rn_0.0.2.apk ├── package-lock.json ├── package.json ├── src ├── common │ └── index.js ├── components │ ├── chatAudio.js │ ├── chatBox.js │ ├── chatEmoji.js │ ├── chatMsg.js │ ├── contactMore.js │ ├── goback.js │ ├── leftAvatar.js │ ├── navBottom.js │ └── sessionItem.js ├── configs │ └── index.js ├── index.js ├── pages │ ├── PushController.js │ ├── about.js │ ├── chat.js │ ├── chatHistroy.js │ ├── chatroom.js │ ├── contact.js │ ├── general.js │ ├── index.js │ ├── login.js │ ├── myinfo.js │ ├── namecard.js │ ├── push.js │ ├── register.js │ ├── searchUser.js │ ├── session.js │ ├── sysmsg.js │ └── test.js ├── res │ ├── 404.png │ ├── emoji │ │ ├── ajmd │ │ │ ├── ajmd001.png │ │ │ ├── ajmd002.png │ │ │ ├── ajmd003.png │ │ │ ├── ajmd004.png │ │ │ ├── ajmd005.png │ │ │ ├── ajmd006.png │ │ │ ├── ajmd007.png │ │ │ ├── ajmd008.png │ │ │ ├── ajmd009.png │ │ │ ├── ajmd010.png │ │ │ ├── ajmd011.png │ │ │ ├── ajmd012.png │ │ │ ├── ajmd013.png │ │ │ ├── ajmd014.png │ │ │ ├── ajmd015.png │ │ │ ├── ajmd016.png │ │ │ ├── ajmd017.png │ │ │ ├── ajmd018.png │ │ │ ├── ajmd019.png │ │ │ ├── ajmd020.png │ │ │ ├── ajmd021.png │ │ │ ├── ajmd022.png │ │ │ ├── ajmd023.png │ │ │ ├── ajmd024.png │ │ │ ├── ajmd025.png │ │ │ ├── ajmd026.png │ │ │ ├── ajmd027.png │ │ │ ├── ajmd028.png │ │ │ ├── ajmd029.png │ │ │ ├── ajmd030.png │ │ │ ├── ajmd031.png │ │ │ ├── ajmd032.png │ │ │ ├── ajmd033.png │ │ │ ├── ajmd034.png │ │ │ ├── ajmd035.png │ │ │ ├── ajmd036.png │ │ │ ├── ajmd037.png │ │ │ ├── ajmd038.png │ │ │ ├── ajmd039.png │ │ │ ├── ajmd040.png │ │ │ ├── ajmd041.png │ │ │ ├── ajmd042.png │ │ │ ├── ajmd043.png │ │ │ ├── ajmd044.png │ │ │ ├── ajmd045.png │ │ │ ├── ajmd046.png │ │ │ ├── ajmd047.png │ │ │ └── ajmd048.png │ │ ├── emoji │ │ │ ├── emoji_00.png │ │ │ ├── emoji_01.png │ │ │ ├── emoji_02.png │ │ │ ├── emoji_03.png │ │ │ ├── emoji_04.png │ │ │ ├── emoji_05.png │ │ │ ├── emoji_06.png │ │ │ ├── emoji_07.png │ │ │ ├── emoji_08.png │ │ │ ├── emoji_09.png │ │ │ ├── emoji_10.png │ │ │ ├── emoji_100.png │ │ │ ├── emoji_101.png │ │ │ ├── emoji_102.png │ │ │ ├── emoji_103.png │ │ │ ├── emoji_104.png │ │ │ ├── emoji_105.png │ │ │ ├── emoji_106.png │ │ │ ├── emoji_107.png │ │ │ ├── emoji_108.png │ │ │ ├── emoji_109.png │ │ │ ├── emoji_11.png │ │ │ ├── emoji_110.png │ │ │ ├── emoji_111.png │ │ │ ├── emoji_112.png │ │ │ ├── emoji_113.png │ │ │ ├── emoji_114.png │ │ │ ├── emoji_115.png │ │ │ ├── emoji_116.png │ │ │ ├── emoji_117.png │ │ │ ├── emoji_118.png │ │ │ ├── emoji_119.png │ │ │ ├── emoji_12.png │ │ │ ├── emoji_120.png │ │ │ ├── emoji_121.png │ │ │ ├── emoji_122.png │ │ │ ├── emoji_123.png │ │ │ ├── emoji_124.png │ │ │ ├── emoji_125.png │ │ │ ├── emoji_126.png │ │ │ ├── emoji_127.png │ │ │ ├── emoji_128.png │ │ │ ├── emoji_129.png │ │ │ ├── emoji_13.png │ │ │ ├── emoji_130.png │ │ │ ├── emoji_131.png │ │ │ ├── emoji_132.png │ │ │ ├── emoji_133.png │ │ │ ├── emoji_134.png │ │ │ ├── emoji_135.png │ │ │ ├── emoji_136.png │ │ │ ├── emoji_137.png │ │ │ ├── emoji_138.png │ │ │ ├── emoji_139.png │ │ │ ├── emoji_14.png │ │ │ ├── emoji_140.png │ │ │ ├── emoji_141.png │ │ │ ├── emoji_142.png │ │ │ ├── emoji_143.png │ │ │ ├── emoji_144.png │ │ │ ├── emoji_145.png │ │ │ ├── emoji_146.png │ │ │ ├── emoji_147.png │ │ │ ├── emoji_148.png │ │ │ ├── emoji_149.png │ │ │ ├── emoji_15.png │ │ │ ├── emoji_150.png │ │ │ ├── emoji_151.png │ │ │ ├── emoji_152.png │ │ │ ├── emoji_16.png │ │ │ ├── emoji_160.png │ │ │ ├── emoji_161.png │ │ │ ├── emoji_162.png │ │ │ ├── emoji_163.png │ │ │ ├── emoji_164.png │ │ │ ├── emoji_165.png │ │ │ ├── emoji_166.png │ │ │ ├── emoji_17.png │ │ │ ├── emoji_18.png │ │ │ ├── emoji_19.png │ │ │ ├── emoji_20.png │ │ │ ├── emoji_200.png │ │ │ ├── emoji_21.png │ │ │ ├── emoji_22.png │ │ │ ├── emoji_23.png │ │ │ ├── emoji_24.png │ │ │ ├── emoji_25.png │ │ │ ├── emoji_26.png │ │ │ ├── emoji_27.png │ │ │ ├── emoji_28.png │ │ │ ├── emoji_29.png │ │ │ ├── emoji_30.png │ │ │ ├── emoji_31.png │ │ │ ├── emoji_32.png │ │ │ ├── emoji_33.png │ │ │ ├── emoji_34.png │ │ │ ├── emoji_35.png │ │ │ ├── emoji_36.png │ │ │ ├── emoji_37.png │ │ │ ├── emoji_38.png │ │ │ ├── emoji_39.png │ │ │ ├── emoji_40.png │ │ │ ├── emoji_41.png │ │ │ ├── emoji_42.png │ │ │ ├── emoji_43.png │ │ │ ├── emoji_44.png │ │ │ ├── emoji_45.png │ │ │ ├── emoji_46.png │ │ │ ├── emoji_47.png │ │ │ ├── emoji_48.png │ │ │ ├── emoji_49.png │ │ │ ├── emoji_50.png │ │ │ ├── emoji_51.png │ │ │ ├── emoji_52.png │ │ │ ├── emoji_53.png │ │ │ ├── emoji_54.png │ │ │ ├── emoji_55.png │ │ │ ├── emoji_56.png │ │ │ ├── emoji_57.png │ │ │ ├── emoji_58.png │ │ │ ├── emoji_59.png │ │ │ ├── emoji_60.png │ │ │ ├── emoji_61.png │ │ │ ├── emoji_62.png │ │ │ ├── emoji_63.png │ │ │ ├── emoji_64.png │ │ │ ├── emoji_65.png │ │ │ ├── emoji_66.png │ │ │ ├── emoji_67.png │ │ │ ├── emoji_68.png │ │ │ ├── emoji_69.png │ │ │ ├── emoji_70.png │ │ │ ├── emoji_71.png │ │ │ ├── emoji_72.png │ │ │ ├── emoji_73.png │ │ │ ├── emoji_74.png │ │ │ ├── emoji_75.png │ │ │ ├── emoji_76.png │ │ │ ├── emoji_77.png │ │ │ ├── emoji_78.png │ │ │ ├── emoji_79.png │ │ │ ├── emoji_80.png │ │ │ ├── emoji_81.png │ │ │ ├── emoji_82.png │ │ │ ├── emoji_83.png │ │ │ ├── emoji_84.png │ │ │ ├── emoji_85.png │ │ │ ├── emoji_86.png │ │ │ ├── emoji_87.png │ │ │ ├── emoji_88.png │ │ │ ├── emoji_89.png │ │ │ ├── emoji_90.png │ │ │ ├── emoji_91.png │ │ │ ├── emoji_92.png │ │ │ ├── emoji_93.png │ │ │ ├── emoji_94.png │ │ │ ├── emoji_95.png │ │ │ ├── emoji_96.png │ │ │ ├── emoji_97.png │ │ │ ├── emoji_98.png │ │ │ ├── emoji_99.png │ │ │ └── emoji_del.png │ │ ├── index.js │ │ ├── lt │ │ │ ├── lt001.png │ │ │ ├── lt002.png │ │ │ ├── lt003.png │ │ │ ├── lt004.png │ │ │ ├── lt005.png │ │ │ ├── lt006.png │ │ │ ├── lt007.png │ │ │ ├── lt008.png │ │ │ ├── lt009.png │ │ │ ├── lt010.png │ │ │ ├── lt011.png │ │ │ ├── lt012.png │ │ │ ├── lt013.png │ │ │ ├── lt014.png │ │ │ ├── lt015.png │ │ │ ├── lt016.png │ │ │ ├── lt017.png │ │ │ ├── lt018.png │ │ │ ├── lt019.png │ │ │ └── lt020.png │ │ ├── sync.py │ │ └── xxy │ │ │ ├── xxy001.png │ │ │ ├── xxy002.png │ │ │ ├── xxy003.png │ │ │ ├── xxy004.png │ │ │ ├── xxy005.png │ │ │ ├── xxy006.png │ │ │ ├── xxy007.png │ │ │ ├── xxy008.png │ │ │ ├── xxy009.png │ │ │ ├── xxy010.png │ │ │ ├── xxy011.png │ │ │ ├── xxy012.png │ │ │ ├── xxy013.png │ │ │ ├── xxy014.png │ │ │ ├── xxy015.png │ │ │ ├── xxy016.png │ │ │ ├── xxy017.png │ │ │ ├── xxy018.png │ │ │ ├── xxy019.png │ │ │ ├── xxy020.png │ │ │ ├── xxy021.png │ │ │ ├── xxy022.png │ │ │ ├── xxy023.png │ │ │ ├── xxy024.png │ │ │ ├── xxy025.png │ │ │ ├── xxy026.png │ │ │ ├── xxy027.png │ │ │ ├── xxy028.png │ │ │ ├── xxy029.png │ │ │ ├── xxy030.png │ │ │ ├── xxy031.png │ │ │ ├── xxy032.png │ │ │ ├── xxy033.png │ │ │ ├── xxy034.png │ │ │ ├── xxy035.png │ │ │ ├── xxy036.png │ │ │ ├── xxy037.png │ │ │ ├── xxy038.png │ │ │ ├── xxy039.png │ │ │ └── xxy040.png │ ├── index.js │ ├── loading-img.gif │ ├── loading-img.jpg │ ├── loading-msg.gif │ ├── logo.png │ └── play │ │ ├── index.js │ │ ├── play-1.png │ │ ├── play-2.png │ │ └── play-3.png ├── store │ ├── actions │ │ ├── friend.js │ │ ├── link.js │ │ ├── msg.js │ │ ├── session.js │ │ └── userInfo.js │ ├── constant.js │ ├── index.js │ └── stores │ │ ├── chatroom.js │ │ ├── nim.js │ │ └── status.js ├── themes │ └── index.js └── util │ ├── emoji.js │ ├── index.js │ ├── md5.js │ ├── pinyin.js │ └── uuid.js ├── weblink.md ├── yarn.lock ├── 安卓打包配置.md └── 安卓推送配置.md /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["module:metro-react-native-babel-preset"] 4 | ], 5 | "plugins": [ 6 | ["@babel/plugin-proposal-decorators", { "legacy": true }], 7 | ["@babel/plugin-transform-runtime"] 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = false 9 | insert_final_newline = false -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | android/* 2 | ios/* 3 | node_modules/* 4 | nim/* -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "airbnb", 3 | "parser": "babel-eslint", 4 | "rules": { 5 | // React Native has JSX in JS files 6 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], 7 | // 取消换行符检验 8 | 'linebreak-style': 'off', 9 | 'no-param-reassign': 'off', 10 | "global-require": 0, 11 | "react/prop-types": 'off', 12 | "class-methods-use-this": 'off', 13 | "no-console": 'off', 14 | "no-continue": 'off', 15 | "no-underscore-dangle":'off' 16 | } 17 | }; -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | node_modules/react-native/flow-github/ 28 | 29 | [options] 30 | emoji=true 31 | 32 | module.system=haste 33 | 34 | munge_underscores=true 35 | 36 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 37 | 38 | module.file_ext=.js 39 | module.file_ext=.jsx 40 | module.file_ext=.json 41 | module.file_ext=.native.js 42 | 43 | suppress_type=$FlowIssue 44 | suppress_type=$FlowFixMe 45 | suppress_type=$FlowFixMeProps 46 | suppress_type=$FlowFixMeState 47 | 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 50 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 51 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 52 | 53 | [version] 54 | ^0.67.0 55 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.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 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | */fastlane/report.xml 51 | */fastlane/Preview.html 52 | */fastlane/screenshots 53 | 54 | # Bundle artifact 55 | *.jsbundle 56 | 57 | 58 | /ios/build 59 | .history 60 | my-aos-release-key.keystore 61 | .vscode 62 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { BackHandler, NetInfo, Alert } from 'react-native'; 3 | import { Provider } from 'mobx-react/native'; 4 | import stores from './src/store'; 5 | import App from './src'; 6 | 7 | // const NimApp = () => ( 8 | // 9 | // 10 | // 11 | // ); 12 | 13 | const handleConnectivityChange = () => { 14 | NetInfo.isConnected.fetch().then((isConnected) => { 15 | if (!isConnected) { 16 | Alert.alert('提示', '网络已断开,请连接网络重试'); 17 | } 18 | }); 19 | }; 20 | 21 | export default class NimApp extends Component { 22 | constructor(props) { 23 | super(props); 24 | BackHandler.addEventListener( 25 | 'hardwareBackPress', 26 | this.onBackButtonPressAndroid, 27 | ); 28 | NetInfo.isConnected.addEventListener( 29 | 'connectionChange', 30 | handleConnectivityChange, 31 | ); 32 | } 33 | 34 | componentWillUnmount() { 35 | BackHandler.removeEventListener( 36 | 'hardwareBackPress', 37 | this.onBackButtonPressAndroid, 38 | ); 39 | NetInfo.isConnected.removeEventListener( 40 | 'connectionChange', 41 | handleConnectivityChange, 42 | ); 43 | } 44 | onBackButtonPressAndroid = () => true 45 | render() { 46 | return ( 47 | 48 | 49 | 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | NIM_ReactNative_Demo 4 | Project NIM_ReactNative_Demo created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir= 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/app/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=.. 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.nim_reactnative_demo", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.nim_reactnative_demo", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /android/app/agconnect-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "agcgw":{ 3 | "backurl":"connect-drcn.dbankcloud.cn", 4 | "url":"connect-drcn.hispace.hicloud.com" 5 | }, 6 | "client":{ 7 | "cp_id":"890086000102126665", 8 | "product_id":"9105385871708399064", 9 | "client_id":"273554930759894080", 10 | "client_secret":"524D5BBFEEDCCC53150023C8360D79AE932A9085DEA507A719C8519A0A50967A", 11 | "app_id":"101612397", 12 | "package_name":"com.nim_reactnative_demo" 13 | }, 14 | "service":{ 15 | "analytics":{ 16 | "collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", 17 | "resource_id":"p1", 18 | "channel_id":"" 19 | }, 20 | "ml":{ 21 | "mlservice_url":"ml-api-drcn.ai.hicloud.com,ml-api-drcn.ai.dbankcloud.cn" 22 | } 23 | }, 24 | "region":"CN", 25 | "configuration_version":"1.0" 26 | } -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/debug.keystore -------------------------------------------------------------------------------- /android/app/google-services.json.bak: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "666346423763", 4 | "firebase_url": "https://nim-rn.firebaseio.com", 5 | "project_id": "nim-rn", 6 | "storage_bucket": "nim-rn.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:666346423763:android:5a1c12505ebd8261", 12 | "android_client_info": { 13 | "package_name": "com.nim_reactnative_demo" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "666346423763-hkko5bqb8e65oo7i4dia285elirquhjd.apps.googleusercontent.com", 19 | "client_type": 3 20 | }, 21 | { 22 | "client_id": "666346423763-hkko5bqb8e65oo7i4dia285elirquhjd.apps.googleusercontent.com", 23 | "client_type": 3 24 | } 25 | ], 26 | "api_key": [ 27 | { 28 | "current_key": "AIzaSyD-5bV-0wBKP0mlKwCCA8jDesz2xSy5k5A" 29 | } 30 | ], 31 | "services": { 32 | "analytics_service": { 33 | "status": 1 34 | }, 35 | "appinvite_service": { 36 | "status": 1, 37 | "other_platform_oauth_client": [] 38 | }, 39 | "ads_service": { 40 | "status": 2 41 | } 42 | } 43 | } 44 | ], 45 | "configuration_version": "1" 46 | } -------------------------------------------------------------------------------- /android/app/libs/MiPush_SDK_Client_3_6_2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/libs/MiPush_SDK_Client_3_6_2.jar -------------------------------------------------------------------------------- /android/app/libs/MiPush_SDK_Client_3_7_0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/libs/MiPush_SDK_Client_3_7_0.jar -------------------------------------------------------------------------------- /android/app/libs/com.coloros.mcssdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/libs/com.coloros.mcssdk.jar -------------------------------------------------------------------------------- /android/app/libs/vivo_pushsdk_v2.3.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/libs/vivo_pushsdk_v2.3.4.jar -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /android/app/release.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/release.keystore -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/AntDesign.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/AntDesign.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/Entypo.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/EvilIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/EvilIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Feather.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/Feather.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/FontAwesome.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Foundation.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/Foundation.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/Ionicons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/MaterialIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/MaterialIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Octicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/Octicons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/SimpleLineIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/SimpleLineIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Zocial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/assets/fonts/Zocial.ttf -------------------------------------------------------------------------------- /android/app/src/main/java/com/nim_reactnative_demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.nim_reactnative_demo; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "NIM_ReactNative_Demo"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/nim_reactnative_demo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.nim_reactnative_demo; 2 | 3 | import android.app.Application; 4 | 5 | import com.brentvatne.react.ReactVideoPackage; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | import com.huawei.hms.support.common.ActivityMgr; 12 | import com.imagepicker.ImagePickerPackage; 13 | import com.netease.nim.rn.push.NIMPushPackage; 14 | import com.oblador.vectoricons.VectorIconsPackage; 15 | import com.rnfs.RNFSPackage; 16 | import com.rnim.rn.audio.ReactNativeAudioPackage; 17 | import com.zmxv.RNSound.RNSoundPackage; 18 | 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | import io.realm.react.RealmReactPackage; 23 | 24 | public class MainApplication extends Application implements ReactApplication { 25 | 26 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 27 | @Override 28 | public boolean getUseDeveloperSupport() { 29 | return BuildConfig.DEBUG; 30 | } 31 | 32 | @Override 33 | protected List getPackages() { 34 | return Arrays.asList( 35 | new MainReactPackage(), 36 | new RNFSPackage(), 37 | new RealmReactPackage(), 38 | new ReactVideoPackage(), 39 | new VectorIconsPackage(), 40 | new RNSoundPackage(), 41 | new ImagePickerPackage(), 42 | new ReactNativeAudioPackage(), 43 | new NIMPushPackage() 44 | ); 45 | } 46 | 47 | @Override 48 | protected String getJSMainModuleName() { 49 | return "index"; 50 | } 51 | }; 52 | 53 | @Override 54 | public ReactNativeHost getReactNativeHost() { 55 | return mReactNativeHost; 56 | } 57 | 58 | @Override 59 | public void onCreate() { 60 | super.onCreate(); 61 | SoLoader.init(this, /* native exopackage */ false); 62 | ActivityMgr.INST.init(this); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 云信 RN 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 17 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | // google() 13 | // jcenter() 14 | maven { url 'https://maven.aliyun.com/repository/google' } 15 | maven { url 'https://maven.aliyun.com/repository/jcenter' } 16 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } 17 | maven { url 'http://developer.huawei.com/repo/' } 18 | } 19 | dependencies { 20 | classpath 'com.android.tools.build:gradle:3.2.1' 21 | // classpath 'com.google.gms:google-services:3.1.0' 22 | classpath "io.realm:realm-gradle-plugin:3.1.3" 23 | classpath 'com.huawei.agconnect:agcp:1.0.0.300' 24 | // NOTE: Do not place your application dependencies here; they belong 25 | // in the individual module build.gradle files 26 | } 27 | } 28 | 29 | allprojects { 30 | repositories { 31 | mavenLocal() 32 | // google() 33 | // jcenter() 34 | maven { url 'https://maven.aliyun.com/repository/google' } 35 | maven { url 'https://maven.aliyun.com/repository/jcenter' } 36 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } 37 | maven { url "$rootDir/../node_modules/react-native/android" } 38 | maven { url 'http://developer.huawei.com/repo/' } 39 | } 40 | } 41 | 42 | 43 | task wrapper(type: Wrapper) { 44 | gradleVersion = '4.6' 45 | distributionUrl = distributionUrl.replace("bin", "all") 46 | } 47 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | 21 | android.useDeprecatedNdk=true 22 | android.enableAapt2=true -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /android/keystores/my-aos-release-key.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/keystores/my-aos-release-key.keystore -------------------------------------------------------------------------------- /android/nimpush/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/nimpush/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android/nimpush/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | nimpush 4 | Project nimpush created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/nimpush/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | #Mon May 28 11:13:08 CST 2018 2 | connection.project.dir=.. 3 | -------------------------------------------------------------------------------- /android/nimpush/bin/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android/nimpush/bin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | minSdkVersion 14 7 | targetSdkVersion 26 8 | versionCode 1 9 | versionName "1.0" 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | api fileTree(dir: 'libs', include: ['*.jar']) 22 | implementation 'com.android.support:appcompat-v7:26.+' 23 | implementation "com.facebook.react:react-native:+" 24 | } 25 | -------------------------------------------------------------------------------- /android/nimpush/bin/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/nimpush/bin/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /android/nimpush/bin/src/main/java/com/netease/nim/rn/push/NIMPushModule.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/nimpush/bin/src/main/java/com/netease/nim/rn/push/NIMPushModule.class -------------------------------------------------------------------------------- /android/nimpush/bin/src/main/java/com/netease/nim/rn/push/NIMPushPackage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/nimpush/bin/src/main/java/com/netease/nim/rn/push/NIMPushPackage.class -------------------------------------------------------------------------------- /android/nimpush/bin/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NIMPush 3 | 4 | -------------------------------------------------------------------------------- /android/nimpush/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | minSdkVersion 14 7 | targetSdkVersion 26 8 | versionCode 1 9 | versionName "1.0" 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | api fileTree(dir: 'libs', include: ['*.jar']) 22 | implementation 'com.android.support:appcompat-v7:26.+' 23 | implementation "com.facebook.react:react-native:+" 24 | } 25 | -------------------------------------------------------------------------------- /android/nimpush/libs/rnlib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/nimpush/libs/rnlib.jar -------------------------------------------------------------------------------- /android/nimpush/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/nimpush/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /android/nimpush/src/main/java/com/netease/nim/rn/push/NIMPushPackage.java: -------------------------------------------------------------------------------- 1 | package com.netease.nim.rn.push; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.NativeModule; 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.uimanager.ViewManager; 7 | 8 | import java.util.Arrays; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | public class NIMPushPackage implements ReactPackage { 13 | 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList(new NativeModule[]{ 17 | new NIMPushModule(reactContext), 18 | }); 19 | } 20 | 21 | @Override 22 | public List createViewManagers(ReactApplicationContext reactContext) { 23 | return Collections.emptyList(); 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /android/nimpush/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/android/nimpush/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/nimpush/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NIMPush 3 | 4 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'NIM_ReactNative_Demo' 2 | include ':react-native-fs' 3 | project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android') 4 | include ':realm' 5 | project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android') 6 | include ':react-native-video' 7 | project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer') 8 | include ':react-native-vector-icons' 9 | project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') 10 | include ':react-native-sound' 11 | project(':react-native-sound').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sound/android') 12 | include ':react-native-image-picker' 13 | project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android') 14 | include ':react-native-audio' 15 | project(':react-native-audio').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-audio/android') 16 | 17 | include ':app' 18 | include ':nimpush' 19 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NIM_ReactNative_Demo", 3 | "displayName": "NIM_ReactNative_Demo" 4 | } -------------------------------------------------------------------------------- /build.gradle.example: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.1.2' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | mavenLocal() 19 | jcenter() 20 | maven { 21 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 22 | url "$rootDir/../node_modules/react-native/android" 23 | } 24 | google() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iOS苹果推送配置.md: -------------------------------------------------------------------------------- 1 | # iOS苹果推送配置 2 | ## 创建应用 App ID 3 | * 登陆 iOS Dev Center 选择进入 Certificates,Identifiers & Profiles。 4 | 5 | 6 | 7 | * 点击左栏 iOS Apps IDs ,进入 Identifiers - App IDs 列表 8 | 9 | 10 | 11 | 12 | * 点击右侧 “+” 号,创建 App ID 13 | 14 | 15 | 16 | 17 | ## 为 App 开启 Push Notification 功能 18 | * 点击创建好的 App,选择 Edit 按钮。 19 | * 勾选 Push Notifications 功能,点击配置证书按钮,进入配置证书页面。请注意开发证书的种类,开发证书供开发调试使用,生产证书供发布使用。 20 | 21 | 22 | 23 | ## 配置证书 24 | * 在 OSX 系统中点击“钥匙串访问”,生成请求证书。 25 | 26 | 27 | 28 | * 在证书信息中填入常用邮件地址,选择保存到磁盘。 29 | 30 | 31 | 32 | * 在上一节进入的配置证书页,点击 Continue。 33 | 34 | 35 | 36 | * 将刚刚生成的请求证书上传,点击 Generate。 37 | 38 | 39 | 40 | * 完成后下载并打开证书,会将证书自动导入钥匙串。 41 | 42 | 在“钥匙串访问中”的“我的证书”里可以找到刚刚导入的证书。 43 | 44 | ## 导出推送所需 p12 文件 45 | 46 | * 选择刚刚导进来的证书,选择右键菜单中的导出选项。 47 | 48 | 49 | 50 | * 保存 p12 文件时,请设置密码,上传证书时需要填写密码。 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ## 上传网易云信服务器 59 | * 进入网易云信管理中心,选择 appkey 对应的应用,点击“应用配置”选项。 60 | * 按图中所示,上传刚刚导出的 p12 文件。可以上传多个 p12 文件,以上传时所填入的证书名称做区分。 61 | * 开发环境或生产环境,请选择与该证书生成时相同的环境类型。 62 | 63 | 64 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry, Platform } from 'react-native'; 2 | import App from './App'; 3 | 4 | global.ISIOS = false; 5 | global.ISANDROID = false; 6 | if (Platform.OS.toLowerCase() === 'android') { 7 | global.ISANDROID = true; 8 | } else if (Platform.OS.toLowerCase() === 'ios') { 9 | global.ISIOS = true; 10 | } 11 | 12 | AppRegistry.registerComponent('NIM_ReactNative_Demo', () => App); 13 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | Product/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | 21 | NIMGitVersion.h 22 | 23 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/120-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/120-1.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/60.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "40.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "60.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "58.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "87.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "80.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "120.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "120-1.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "180.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "idiom" : "ios-marketing", 53 | "size" : "1024x1024", 54 | "scale" : "1x" 55 | } 56 | ], 57 | "info" : { 58 | "version" : 1, 59 | "author" : "xcode" 60 | } 61 | } -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSMicrophoneUsageDescription 6 | This sample uses the microphone to record your speech and convert it to text. 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleDisplayName 10 | 云信RN DEMO 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1 27 | LSRequiresIPhoneOS 28 | 29 | NSAppTransportSecurity 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSCameraUsageDescription 41 | $(PRODUCT_NAME) would like to use your camera 42 | NSLocationWhenInUseUsageDescription 43 | 44 | NSMicrophoneUsageDescription 45 | $(PRODUCT_NAME) would like to your microphone (for videos) 46 | NSPhotoLibraryAddUsageDescription 47 | $(PRODUCT_NAME) would like to save photos to your photo gallery 48 | NSPhotoLibraryUsageDescription 49 | $(PRODUCT_NAME) would like access to your photo gallery 50 | UIAppFonts 51 | 52 | Entypo.ttf 53 | EvilIcons.ttf 54 | Feather.ttf 55 | FontAwesome.ttf 56 | Foundation.ttf 57 | Ionicons.ttf 58 | MaterialCommunityIcons.ttf 59 | MaterialIcons.ttf 60 | Octicons.ttf 61 | SimpleLineIcons.ttf 62 | Zocial.ttf 63 | 64 | UIBackgroundModes 65 | 66 | remote-notification 67 | 68 | UILaunchStoryboardName 69 | LaunchScreen 70 | UIRequiredDeviceCapabilities 71 | 72 | armv7 73 | 74 | UISupportedInterfaceOrientations 75 | 76 | UIInterfaceOrientationPortrait 77 | 78 | UIViewControllerBasedStatusBarAppearance 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/NIM_ReactNative_Demo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_Demo/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_DemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/NIM_ReactNative_DemoTests/NIM_ReactNative_DemoTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface NIM_ReactNative_DemoTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation NIM_ReactNative_DemoTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "experimentalDecorators": true 4 | } 5 | } -------------------------------------------------------------------------------- /nim/NIM_Android_Push.js: -------------------------------------------------------------------------------- 1 | import {NativeModules} from 'react-native' 2 | 3 | export default NativeModules.NIMPushModule 4 | 5 | export function getDeviceInfo (callback) { 6 | if (NativeModules.NIMPushModule) { 7 | NativeModules.NIMPushModule.getDeviceInfo(callback) 8 | } else { 9 | callback() 10 | } 11 | } 12 | 13 | export function onLogin ({account, pushType, hasPushed = false, lastDeviceId = ''}) { 14 | NativeModules.NIMPushModule && NativeModules.NIMPushModule.onLogin(account, pushType, hasPushed, lastDeviceId) 15 | } 16 | 17 | export function showNotification ({icon, title, content, time}) { 18 | NativeModules.NIMPushModule && NativeModules.NIMPushModule.showNotification(icon, title, content, time) 19 | } 20 | 21 | export function clearNotification () { 22 | NativeModules.NIMPushModule && NativeModules.NIMPushModule.clearNotification() 23 | } 24 | 25 | export function registerPush ({ 26 | xmAppId, 27 | xmAppKey, 28 | xmCertificateName, 29 | hwAppId, 30 | hwCertificateName, 31 | mzAppId, 32 | mzAppKey, 33 | mzCertificateName, 34 | fcmCertificateName, 35 | vivoCertificateName, 36 | oppoAppId, 37 | oppoAppKey, 38 | oppoAppSercet, 39 | oppoCertificateName, 40 | tokenCallback}) { 41 | NativeModules.NIMPushModule && NativeModules.NIMPushModule.init(xmAppId, xmAppKey, 42 | xmCertificateName, hwAppId, 43 | hwCertificateName, mzAppId, mzAppKey, mzCertificateName, fcmCertificateName, vivoCertificateName, 44 | oppoAppId, oppoAppKey, oppoAppSercet, oppoCertificateName, tokenCallback) 45 | } 46 | 47 | export function onLogout () { 48 | NativeModules.NIMPushModule && NativeModules.NIMPushModule.onLogout() 49 | } 50 | 51 | export function setDeviceId (deviceId) { 52 | NativeModules.NIMPushModule && NativeModules.NIMPushModule.setDeviceId(deviceId) 53 | } 54 | -------------------------------------------------------------------------------- /nim/third-party.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/nim/third-party.zip -------------------------------------------------------------------------------- /nim_rn_0.0.2.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netease-im/NIM_ReactNative_Demo/74dfd6d7e96b75d81ff93be06587ce993f3aafe6/nim_rn_0.0.2.apk -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nim_reactnative_demo", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest", 8 | "dev:ios": "react-native run-ios" 9 | }, 10 | "dependencies": { 11 | "jest-haste-map": "^24.9.0", 12 | "mobx": "^4.2.1", 13 | "mobx-react": "^5.4.3", 14 | "react": "^16.7.0", 15 | "react-native": "^0.57.8", 16 | "react-native-audio": "^4.3.0", 17 | "react-native-easy-toast": "^1.1.0", 18 | "react-native-elements": "1.0.0-beta5", 19 | "react-native-fs": "^2.14.1", 20 | "react-native-image-picker": "^0.27.2", 21 | "react-native-sound": "^0.10.9", 22 | "react-native-vector-icons": "^6.1.0", 23 | "react-native-video": "^4.2.0", 24 | "react-navigation": "^2.18.2", 25 | "realm": "^2.26.1" 26 | }, 27 | "devDependencies": { 28 | "@babel/core": "^7.2.2", 29 | "@babel/plugin-proposal-decorators": "^7.2.3", 30 | "@babel/plugin-transform-runtime": "^7.2.0", 31 | "jsrsasign": "8.0.12", 32 | "eslint": "^5.11.1", 33 | "eslint-config-airbnb": "^17.1.0", 34 | "eslint-plugin-import": "^2.14.0", 35 | "eslint-plugin-jsx-a11y": "^6.1.2", 36 | "eslint-plugin-react": "^7.12.0", 37 | "jest": "23.6.0", 38 | "react-test-renderer": "16.7.0" 39 | }, 40 | "jest": { 41 | "preset": "react-native" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/common/index.js: -------------------------------------------------------------------------------- 1 | import { Dimensions, PixelRatio } from 'react-native'; 2 | 3 | export const deviceWidth = Dimensions.get('window').width; // 设备的宽度 4 | export const deviceHeight = Dimensions.get('window').height; // 设备的高度 5 | const fontScale = PixelRatio.getFontScale(); // 返回字体大小缩放比例 6 | const pixelRatio = PixelRatio.get(); // 当前设备的像素密度 7 | 8 | export const RVW = deviceWidth / 100; 9 | export const RVH = deviceHeight / 100; 10 | export const RFT = RVW / fontScale; 11 | export const RPX = 1 / pixelRatio; 12 | -------------------------------------------------------------------------------- /src/components/chatEmoji.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View, ScrollView, Image, TouchableOpacity } from 'react-native'; 3 | import { chatStyle, emojiStyle } from '../themes'; 4 | import { RVW } from '../common'; 5 | // import emojiObj from '../util/emoji'; 6 | import emojiObj from '../res/emoji'; 7 | 8 | function genEmojiList(type, emojiList) { 9 | const result = {}; 10 | Object.keys(emojiList).forEach((name) => { 11 | const emojiMap = emojiList[name]; 12 | const list = []; 13 | Object.keys(emojiMap).forEach((key) => { 14 | list.push({ 15 | type, 16 | name, 17 | key, 18 | img: emojiMap[key].img, 19 | }); 20 | }); 21 | if (list.length > 0) { 22 | result[name] = { 23 | type, 24 | name, 25 | list, 26 | album: list[0].img, 27 | }; 28 | } 29 | }); 30 | 31 | return result; 32 | } 33 | 34 | export default class ChatEmoji extends React.Component { 35 | static defaultProps = { 36 | onSelectEmoji() {}, 37 | } 38 | constructor(props) { 39 | super(props); 40 | this.emoji = genEmojiList('emoji', emojiObj.emojiList); 41 | this.pinup = genEmojiList('pinup', emojiObj.pinupList); 42 | this.state = { 43 | currType: 'emoji', 44 | currAlbum: 'emoji', 45 | }; 46 | this.emojiScrollView = null; 47 | } 48 | selectAlbum = (item) => { 49 | this.setState({ 50 | currType: item.type, 51 | currAlbum: item.name, 52 | }); 53 | if (this.emojiScrollView) { 54 | this.emojiScrollView.scrollTo({ x: 0 }); 55 | } 56 | } 57 | selectEmoji = (item) => { 58 | this.props.onSelectEmoji({ 59 | type: this.state.currType, 60 | name: this.state.currAlbum, 61 | key: item.key, 62 | }); 63 | } 64 | renderEmoji = () => { 65 | const emojis = this.emoji[this.state.currAlbum]; 66 | return ( 67 | 68 | { 69 | emojis.list.map(item => ( 70 | { this.selectEmoji({ key: item.key }); }} 74 | > 75 | 76 | 77 | )) 78 | } 79 | 80 | ); 81 | } 82 | renderPinup = () => { 83 | const pinups = this.pinup[this.state.currAlbum]; 84 | return ( 85 | 86 | { 87 | pinups.list.map(item => ( 88 | { this.selectEmoji({ key: item.key }); }} 92 | > 93 | 94 | 95 | )) 96 | } 97 | 98 | ); 99 | } 100 | render() { 101 | return ( 102 | 103 | { this.emojiScrollView = scrollView; }} 106 | > 107 | { this.state.currType === 'emoji' ? this.renderEmoji() : this.renderPinup()} 108 | 109 | 110 | { 111 | Object.keys(this.emoji).map((name) => { 112 | const emoji = this.emoji[name].list[0]; 113 | return ( 114 | { this.selectAlbum({ type: 'emoji', name }); }}> 115 | 116 | 117 | ); 118 | }) 119 | } 120 | { 121 | Object.keys(this.pinup).map((name) => { 122 | const pinup = this.pinup[name].list[0]; 123 | return ( 124 | { this.selectAlbum({ type: 'pinup', name }); }}> 125 | 126 | 127 | ); 128 | }) 129 | } 130 | 131 | 132 | ); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /src/components/contactMore.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { TouchableOpacity } from 'react-native'; 3 | import { Icon } from 'react-native-elements'; 4 | import { headerStyle } from '../themes'; 5 | 6 | export default props => 7 | ( 8 | 9 | {/* */} 10 | 11 | 12 | ); 13 | 14 | -------------------------------------------------------------------------------- /src/components/goback.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { TouchableOpacity } from 'react-native'; 3 | import { Icon } from 'react-native-elements'; 4 | import { headerStyle } from '../themes'; 5 | 6 | export default class Component extends React.Component { 7 | goBack = () => { 8 | if (this.props.callback) { 9 | this.props.callback(); 10 | } 11 | this.props.navigation.goBack(); 12 | } 13 | render() { 14 | return ( 15 | 16 | 17 | 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/components/leftAvatar.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { TouchableOpacity, View, Image } from 'react-native'; 3 | import { globalStyle } from '../themes'; 4 | 5 | export default (props) => { 6 | if (props.onPress) { 7 | return ( 8 | 9 | 10 | 11 | ); 12 | } 13 | return ( 14 | 15 | 16 | 17 | ); 18 | }; 19 | -------------------------------------------------------------------------------- /src/components/navBottom.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View, Text, TouchableOpacity } from 'react-native'; 3 | import { baseBlueColor } from '../themes'; 4 | import { RVW, RFT } from '../common'; 5 | 6 | const localStyle = { 7 | wrapper: { 8 | flexDirection: 'row', 9 | justifyContent: 'space-between', 10 | alignItems: 'center', 11 | borderTopWidth: 1, 12 | borderTopColor: '#ccc', 13 | }, 14 | tab: { 15 | flex: 1, 16 | backgroundColor: '#fff', 17 | minHeight: 12 * RVW, 18 | }, 19 | label: { 20 | fontSize: 3.6 * RFT, 21 | lineHeight: 12 * RVW, 22 | textAlign: 'center', 23 | }, 24 | }; 25 | 26 | export default (props) => { 27 | const { navigation } = props; 28 | const { routeName } = navigation.state; 29 | const lightBlueColor = '#f0f3fb'; 30 | return ( 31 | 32 | { navigation.navigate('session'); }}> 33 | 最近会话 34 | 35 | { navigation.navigate('contact'); }}> 36 | 通讯录 37 | 38 | { navigation.navigate('general'); }}> 39 | 设置 40 | 41 | 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /src/components/sessionItem.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, TouchableOpacity, Animated, Alert } from 'react-native'; 3 | import { inject } from 'mobx-react/native'; 4 | import { ListItem } from 'react-native-elements'; 5 | import LeftAvatar from '../components/leftAvatar'; 6 | import { RFT, RVW } from '../common'; 7 | import configs from '../configs'; 8 | 9 | @inject('nimStore', 'sessionAction', 'msgAction') 10 | export default class SessionItem extends Component { 11 | constructor(props) { 12 | super(props); 13 | this.state = { 14 | positionLeft: new Animated.Value(0), 15 | isDeleteBarShown: false, 16 | }; 17 | } 18 | deleteSession = () => { 19 | Alert.alert('提示', '确认删除会话?', [ 20 | { text: '取消', onPress: () => { this.setState({ isDeleteBarShown: false }); } }, 21 | { text: '确认删除', onPress: () => { this.props.sessionAction.deleteLocalSession(this.props.session.id); } }, 22 | ]); 23 | Animated.timing( 24 | this.state.positionLeft, 25 | { 26 | toValue: 0, 27 | duration: 0, 28 | }, 29 | ).start(); 30 | } 31 | showDeleteBar = () => { 32 | if (this.state.isDeleteBarShown) { 33 | return; 34 | } 35 | Animated.timing( 36 | this.state.positionLeft, 37 | { 38 | toValue: -20 * RVW, 39 | duration: 100, 40 | }, 41 | ).start(); 42 | this.setState({ 43 | isDeleteBarShown: true, 44 | }); 45 | } 46 | hideDeleteBar = () => { 47 | if (!this.state.isDeleteBarShown) { 48 | return; 49 | } 50 | Animated.timing( 51 | this.state.positionLeft, 52 | { 53 | toValue: 0, 54 | duration: 100, 55 | }, 56 | ).start(); 57 | this.setState({ 58 | isDeleteBarShown: false, 59 | }); 60 | } 61 | gotoChat = (session) => { 62 | const sessionId = session.id; 63 | if (this.state.isDeleteBarShown) { 64 | this.hideDeleteBar(); 65 | return; 66 | } 67 | if (session.lastMsg && session.lastMsg) { 68 | this.props.msgAction.sendMsgReceipt({ msg: session.lastMsg }); 69 | } 70 | this.props.navigation.navigate('chat', { sessionId }); 71 | } 72 | render() { 73 | const columnHeight = 16 * RVW; 74 | const item = this.props.session; 75 | if (!item.avatar) { 76 | item.avatar = configs.defaultUserIcon; 77 | } 78 | return ( 79 | 85 | { 90 | const sessionId = item.id; 91 | if (/^p2p-/.test(sessionId)) { 92 | this.props.navigation.navigate('namecard', { account: sessionId.replace(/^p2p-/, '') }); 93 | } 94 | }} 95 | />} 96 | title={item.name} 97 | subtitle={item.lastMsg && item.lastMsgShow} 98 | subtitleStyle={{ flexWrap: 'nowrap', width: 50 * RVW }} 99 | rightTitle={item.updateTimeShow} 100 | containerStyle={{ backgroundColor: '#fff', width: 100 * RVW, height: columnHeight }} 101 | badge={{ 102 | value: item.unread, 103 | textStyle: { color: '#fff' }, 104 | containerStyle: { backgroundColor: '#f00', display: item.unread === 0 ? 'none' : 'flex' }, 105 | }} 106 | onPress={() => { this.gotoChat(item); }} 107 | onLongPress={this.showDeleteBar} 108 | bottomDivider 109 | /> 110 | 111 | 117 | 124 | 删除 125 | 126 | 127 | 128 | 129 | ); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/configs/index.js: -------------------------------------------------------------------------------- 1 | const env = 'online'; 2 | 3 | const appConfig = { 4 | // 用户的appkey 5 | // 用于在web demo中注册账号异步请求demo 服务器中使用 6 | test: { 7 | appkey: 'fe416640c8e8a72734219e1847ad2547', 8 | postUrl: 'https://apptest.netease.im', 9 | }, 10 | online: { 11 | appkey: '45c6af3c98409b18a84451215d0bdd6e', 12 | postUrl: 'https://app.netease.im', 13 | }, 14 | }; 15 | 16 | const base = { 17 | // SDK 在store/actions中被引入 18 | // 资源路径根目录,为了方便用户部署在二级以上URL路径上 19 | resourceUrl: 'https://yx-web.nos-hz.163yun.com/webdoc/h5', 20 | // 用户logo地址 21 | logo: 'https://yx-web.nos-hz.163yun.com/webdoc/h5/im/logo.png', 22 | // 默认用户头像 23 | defaultUserIcon: 'https://yx-web.nos-hz.163yun.com/webdoc/h5/im/default-icon.png', 24 | // 默认普通群头像 25 | defaultGroupIcon: 'https://yx-web.nos-hz.163yun.com/webdoc/h5/im/default-group.png', 26 | // 默认高级群头像 27 | defaultAdvancedIcon: 'https://yx-web.nos-hz.163yun.com/webdoc/h5/im/default-advanced.png', 28 | // 系统通知图标 29 | noticeIcon: 'https://yx-web.nos-hz.163yun.com/webdoc/h5/im/notice-icon.png', 30 | // 我的手机图标 31 | myPhoneIcon: 'https://yx-web.nos-hz.163yun.com/webdoc/h5/im/my-phone.png', 32 | // 本地消息显示数量,会影响性能 33 | localMsglimit: 36, 34 | }; 35 | 36 | export default Object.assign(base, appConfig[env]); 37 | 38 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import { createStackNavigator } from 'react-navigation'; 2 | 3 | import Pages from './pages'; 4 | // import TabNavigator from './tabNavigator'; 5 | 6 | const App = createStackNavigator( 7 | { 8 | login: { 9 | screen: Pages.login, 10 | }, 11 | register: { 12 | screen: Pages.register, 13 | }, 14 | // home: { 15 | // screen: TabNavigator, 16 | // }, 17 | session: { 18 | screen: Pages.session, 19 | }, 20 | contact: { 21 | screen: Pages.contact, 22 | }, 23 | general: { 24 | screen: Pages.general, 25 | }, 26 | chat: { 27 | screen: Pages.chat, 28 | }, 29 | chatHistroy: { 30 | screen: Pages.chatHistroy, 31 | }, 32 | sysmsg: { 33 | screen: Pages.sysmsg, 34 | }, 35 | namecard: { 36 | screen: Pages.namecard, 37 | }, 38 | searchUser: { 39 | screen: Pages.searchUser, 40 | }, 41 | // 个人信息页 42 | myinfo: { 43 | screen: Pages.myinfo, 44 | }, 45 | about: { 46 | screen: Pages.about, 47 | }, 48 | test: { 49 | screen: Pages.test, 50 | }, 51 | }, 52 | { 53 | initialRouteName: 'session', 54 | headerMode: 'none', 55 | navigationOptions: { 56 | gesturesEnabled: false, 57 | }, 58 | mode: 'card', 59 | }, 60 | ); 61 | 62 | export default App; 63 | -------------------------------------------------------------------------------- /src/pages/PushController.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PushNotification from 'react-native-push-notification'; 3 | 4 | export default class PushController extends React.Component { 5 | componentDidMount() { 6 | PushNotification.configure({ 7 | onRegister(token) { 8 | console.log('TOKEN:', token); 9 | }, 10 | onNotification(notification) { 11 | console.log('NOTIFICATION:', notification); 12 | }, 13 | }); 14 | } 15 | 16 | render() { 17 | return null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/pages/about.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { ScrollView, Text, View } from 'react-native'; 3 | import { inject, observer } from 'mobx-react/native'; 4 | // import { View } from 'react-navigation'; 5 | import { Header } from 'react-native-elements'; 6 | import GoBack from '../components/goback'; 7 | import { headerStyle, globalStyle } from '../themes'; 8 | 9 | @inject('nimStore') 10 | @observer 11 | export default class Page extends Component { 12 | render() { 13 | const { navigation } = this.props; 14 | return ( 15 | 16 |
} 19 | centerComponent={{ text: '关于', style: headerStyle.center }} 20 | /> 21 | 22 | 1529653709700 23 | 24 | 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/pages/chatHistroy.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Header } from 'react-native-elements'; 3 | import { inject } from 'mobx-react/native'; 4 | import { Animated, FlatList, View, Text, InteractionManager } from 'react-native'; 5 | import { headerStyle, globalStyle, chatStyle } from '../themes'; 6 | import { ChatLeft, ChatRight } from '../components/chatMsg'; 7 | import GoBack from '../components/goback'; 8 | import util from '../util'; 9 | import uuid from '../util/uuid'; 10 | // import { RVH } from '../common'; 11 | 12 | const AnimatedFlatList = Animated.createAnimatedComponent(FlatList); 13 | 14 | @inject('nimStore', 'msgAction') 15 | export default class Page extends Component { 16 | constructor(props) { 17 | super(props); 18 | const sessionId = this.props.navigation.getParam('sessionId') || ''; 19 | this.sessionId = sessionId; 20 | if (/^[^-]+-/.test(this.sessionId)) { 21 | this.scene = /^[^-]+-/.exec(this.sessionId); 22 | this.scene = this.scene[0]; 23 | this.to = this.sessionId.replace(this.scene, ''); 24 | this.scene = this.scene.replace('-', ''); 25 | } 26 | this.state = { 27 | historyMsgs: [], 28 | refreshing: false, 29 | }; 30 | } 31 | componentWillMount() { 32 | const { scene, to } = this; 33 | this.props.msgAction.getHistoryMsgs({ 34 | scene, 35 | to, 36 | done: (msgs) => { 37 | this.setState({ 38 | historyMsgs: this.sortMsgs(msgs), 39 | }); 40 | InteractionManager.runAfterInteractions(() => { 41 | this.scrollToEnd(); 42 | }); 43 | }, 44 | }); 45 | } 46 | scrollToEnd = () => { 47 | // if (this.chatListRef) { 48 | // this.chatListRef.scrollTo({ x: 0, y: 100 * RVH }); 49 | // } 50 | } 51 | loadMore = () => { 52 | let endTime = this.state.historyMsgs[0].time; 53 | if (!endTime) { 54 | endTime = this.state.historyMsgs[1].time; 55 | } 56 | this.setState({ 57 | refreshing: true, 58 | }); 59 | const { scene, to } = this; 60 | this.props.msgAction.getHistoryMsgs({ 61 | scene, 62 | to, 63 | endTime, 64 | done: (msgs) => { 65 | this.setState({ 66 | refreshing: false, 67 | }); 68 | if (!msgs || msgs.length <= 0) { 69 | return; 70 | } 71 | const currHistoryMsgs = this.sortMsgs(msgs); 72 | this.state.historyMsgs.forEach((item) => { 73 | currHistoryMsgs.push(item); 74 | }); 75 | this.setState({ 76 | historyMsgs: currHistoryMsgs, 77 | }); 78 | InteractionManager.runAfterInteractions(() => { 79 | this.scrollToEnd(); 80 | }); 81 | }, 82 | }); 83 | } 84 | sortMsgs = (origMsgs) => { 85 | const msgLen = origMsgs.length; 86 | const msgs = []; 87 | if (msgLen > 0) { 88 | origMsgs = origMsgs.sort((a, b) => a.time - b.time); 89 | let lastMsgTime = 0; 90 | origMsgs.forEach((msg) => { 91 | if ((msg.time - lastMsgTime) > 1000 * 60 * 5) { 92 | msgs.push({ 93 | type: 'timeTag', 94 | text: util.formatDate(msg.time, false), 95 | key: uuid(), 96 | }); 97 | lastMsgTime = msg.time; 98 | } 99 | msgs.push(msg); 100 | }); 101 | } 102 | return msgs; 103 | } 104 | renderItem = ((item) => { 105 | const msg = item.item; 106 | if (msg.flow === 'in') { 107 | return (); 113 | } else if (msg.flow === 'out') { 114 | return ; 115 | } else if (msg.type === 'timeTag') { 116 | return ---- {msg.text} ----; 117 | } 118 | return null; 119 | }) 120 | render() { 121 | const { navigation } = this.props; 122 | const { historyMsgs } = this.state; 123 | return ( 124 | 125 |
} 129 | /> 130 | { 131 | (historyMsgs && historyMsgs.length > 0) ? 132 | (item.idClient || item.key || item.text)} 136 | renderItem={this.renderItem} 137 | ref={(ref) => { this.chatListRef = ref; }} 138 | onRefresh={this.loadMore} 139 | refreshing={this.state.refreshing} 140 | /> : 141 | 无历史消息 142 | } 143 | 144 | ); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/pages/chatroom.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Text, View } from 'react-native'; 3 | import { inject, observer } from 'mobx-react/native'; 4 | // import { View } from 'react-navigation'; 5 | 6 | import { globalStyle } from '../themes'; 7 | // import { RVW } from '../common'; 8 | 9 | @inject('chatroomStore') 10 | @observer 11 | export default class Page extends Component { 12 | render() { 13 | return ( 14 | 15 | 聊天室 16 | 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/pages/general.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { ScrollView, Text, View } from 'react-native'; 3 | import { inject, observer } from 'mobx-react/native'; 4 | // import { SafeView } from 'react-navigation'; 5 | import { ListItem, Avatar, Header } from 'react-native-elements'; 6 | import NavBottom from '../components/navBottom'; 7 | import { headerStyle, globalStyle, baseBlueColor } from '../themes'; 8 | import { RVW, RFT } from '../common'; 9 | 10 | @inject('nimStore') 11 | @observer 12 | export default class Page extends Component { 13 | constructor(props) { 14 | super(props); 15 | this.state = { 16 | // muteVal: false, 17 | // pushVal: false, 18 | // token: 'e10adc3949ba59abbe56e057f20f883e', 19 | }; 20 | } 21 | // setMuteVal = (val) => { 22 | // this.setState({ 23 | // muteVal: val, 24 | // }); 25 | // } 26 | // setPushVal = (val) => { 27 | // this.setState({ 28 | // pushVal: val, 29 | // }); 30 | // } 31 | render() { 32 | const myInfo = this.props.nimStore.myInfo || {}; 33 | const { navigation } = this.props; 34 | return ( 35 | 36 |
40 | 41 | } 48 | title={{myInfo.nick}} 49 | subtitle={`账号:${myInfo.account}`} 50 | containerStyle={{ height: 30 * RVW }} 51 | rightIcon={{ 52 | type: 'ionicon', 53 | name: 'ios-arrow-forward', 54 | color: baseBlueColor, 55 | size: 30, 56 | }} 57 | onPress={ 58 | () => { 59 | this.props.navigation.navigate('myinfo'); 60 | } 61 | } 62 | bottomDivider 63 | /> 64 | {/* 72 | } 73 | topDivider 74 | bottomDivider 75 | containerStyle={{ marginTop: 30 }} 76 | /> 77 | 85 | } 86 | bottomDivider 87 | /> */} 88 | { 92 | this.props.navigation.navigate('about'); 93 | }} 94 | chevron 95 | chevronColor={baseBlueColor} 96 | bottomDivider 97 | /> 98 | 99 | 100 | 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/pages/index.js: -------------------------------------------------------------------------------- 1 | import login from './login'; 2 | import register from './register'; 3 | import session from './session'; 4 | import contact from './contact'; 5 | import namecard from './namecard'; 6 | import searchUser from './searchUser'; 7 | import chatroom from './chatroom'; 8 | import general from './general'; 9 | import myinfo from './myinfo'; 10 | import about from './about'; 11 | import chat from './chat'; 12 | import chatHistroy from './chatHistroy'; 13 | import sysmsg from './sysmsg'; 14 | import test from './test'; 15 | 16 | export default { 17 | login, 18 | register, 19 | session, 20 | contact, 21 | namecard, 22 | searchUser, 23 | chatroom, 24 | general, 25 | myinfo, 26 | about, 27 | chat, 28 | chatHistroy, 29 | sysmsg, 30 | test, 31 | }; 32 | -------------------------------------------------------------------------------- /src/pages/myinfo.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { ScrollView, View } from 'react-native'; 3 | import { inject, observer } from 'mobx-react/native'; 4 | // import { View } from 'react-navigation'; 5 | import { ListItem, Button, Header } from 'react-native-elements'; 6 | import Toast from 'react-native-easy-toast'; 7 | import GoBack from '../components/goback'; 8 | import LeftAvatar from '../components/leftAvatar'; 9 | import { globalStyle, headerStyle, baseRedColor } from '../themes'; 10 | import { RVW } from '../common'; 11 | 12 | @inject('nimStore', 'linkAction') 13 | @observer 14 | export default class Page extends Component { 15 | logout = () => { 16 | this.props.linkAction.logout(); 17 | } 18 | render() { 19 | const myInfo = this.props.nimStore.myInfo || {}; 20 | let gender = '未知'; 21 | if (myInfo.gender === 'female') { 22 | gender = '女'; 23 | } else if (myInfo.gender === 'male') { 24 | gender = '男'; 25 | } 26 | const { navigation } = this.props; 27 | return ( 28 | 29 |
} 32 | centerComponent={{ text: '个人信息', style: headerStyle.center }} 33 | /> 34 | } 37 | title={myInfo.nick} 38 | subtitle={`账号:${myInfo.account}`} 39 | containerStyle={{ marginVertical: 20 }} 40 | /> 41 | 42 | 49 | 55 | 62 | 69 | 76 | 82 | 83 |