GithubHelp home page GithubHelp logo

awesomepan / jmessage-react-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jpush/jmessage-react-plugin

0.0 0.0 0.0 70.79 MB

Home Page: https://docs.jiguang.cn

License: MIT License

Ruby 0.20% Java 25.88% JavaScript 22.54% Objective-C 51.38%

jmessage-react-plugin's Introduction

jmessage-react-plugin

极光官方开发的极光 IM react-native 插件,同时支持 文字、图片、语言、文件和自定义消息。同时支持 iOS 和 Android 平台。

安装

npm install jmessage-react-plugin --save
npm install jcore-react-native --save(目前 jmessage-react-plugin 2.1.1 版本需要指定安装 jcore-react-native 1.2.1 以上版本)
react-native link
(如果是原生应用集成 react-native)使用 CocoaPods 安装

在 Podfile 中添加如下代码:

pod 'JPushRN', :path => '../node_modules/jpush-react-native'

终端执行如下指令:

pod install

配置

Android

  • 配置 AndroidManifest,加入 meta-data 部分
...
<meta-data android:name="JPUSH_CHANNEL" android:value="${APP_CHANNEL}" />
<meta-data android:name="JPUSH_APPKEY" android:value="${JPUSH_APPKEY}" />
...
  • 配置 build.gradle,将下列配置部分替换成自己的。
defaultConfig {
        applicationId "你的 application id"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [
                JPUSH_APPKEY: "你的 appKey",	//在此替换你的APPKey
                APP_CHANNEL: "developer-default"		//应用渠道号
        ]
    }

在 MainApplication 中加上 JMessagePackage 即可,JMessagePackage 有一个参数,设置是否弹出 toast。

// 如果设置为 true,则不弹出 toast。
private boolean shutdownToast = false;

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

iOS

  • 打开工程,进入 Build Settings -> Framework search paths 添加 framework 搜索路径

    $(SRCROOT)/../node_modules/jmessage-react-plugin/ios/RCTJMessageModule
    
  • 打开工程,进入 Build Settings -> Other Link Flag 添加一行编译选项

    -framework "JMessage"
    

API

API doc

更多

jmessage-react-plugin's People

Contributors

huangminlinux avatar kenchoi1992 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.