npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@qudian_mobile/qd-react-native-share

v0.0.4

Published

分享组件封装

Downloads

3

Readme

qd-react-native-share

Getting started

$ npm install @qudian_mobile/qd-react-native-share --save

Mostly automatic installation

$ react-native link @qudian_mobile/qd-react-native-share

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java

    
    import com.qudian.UMQDUtils;
    
    UMQDUtils.init(this,BuildConfig.UM_SHARE_KEY);
            UMQDUtils.registerPlaform(UMQDUtils.SINA
                    ,BuildConfig.UM_SHARE_ITEM_SINA_KEY
                    ,BuildConfig.UM_SHARE_ITEM_SINA_SECRET
                    ,BuildConfig.UM_SHARE_ITEM_SINA_URL);
            UMQDUtils.registerPlaform(UMQDUtils.WEIXIN
                    ,BuildConfig.UM_SHARE_ITEM_WECHAT_KEY
                    ,BuildConfig.UM_SHARE_ITEM_WECHAT_SECRET
                    ,BuildConfig.UM_SHARE_ITEM_WECHAT_URL);
            UMQDUtils.registerPlaform(UMQDUtils.QQ
                    ,BuildConfig.UM_SHARE_ITEM_QQ_KEY
                    ,BuildConfig.UM_SHARE_ITEM_QQ_SECRET
                    ,BuildConfig.UM_SHARE_ITEM_QQ_URL);

    Open up XXReactPackge.java

    import com.qudian.rn.module.QDShareModule;
    
    list.add(new QDShareModule(reactContext));
  2. Append the following lines to android/settings.gradle:

    include ':@qudian_mobile_qd-react-native-share'
    project(':@qudian_mobile_qd-react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/@qudian_mobile/qd-react-native-share/android')
  3. Insert the following lines in android/gradle.properties:

    UM_SHARE_KEY=XXXXX
    
    UM_SHARE_ITEM_SINA_PLATFORM=0
    UM_SHARE_ITEM_SINA_KEY=XXXXX
    UM_SHARE_ITEM_SINA_SECRET=XXXXX
    UM_SHARE_ITEM_SINA_URL=XXXXX
    
    UM_SHARE_ITEM_WECHAT_PLATFORM=1
    UM_SHARE_ITEM_WECHAT_KEY=XXXXX
    UM_SHARE_ITEM_WECHAT_SECRET=XXXXX
    UM_SHARE_ITEM_WECHAT_URL=null
    
       
    UM_SHARE_ITEM_QQ_PLATFORM=4
    UM_SHARE_ITEM_QQ_KEY=XXXXX
    UM_SHARE_ITEM_QQ_SECRET=XXXXX
    UM_SHARE_ITEM_QQ_URL=null
       
    UM_SHARE_TENCENT_KEY=XXXXX
  4. Insert the following lines in android/app/build.gradle:

      android {
        buildTypes {
            release {
                buildConfigField("String", "UM_SHARE_KEY", "\"" + project.UM_SHARE_KEY + "\"")
    
                buildConfigField("String", "UM_SHARE_ITEM_SINA_KEY", "\"" + project.UM_SHARE_ITEM_SINA_KEY + "\"")
                buildConfigField("String", "UM_SHARE_ITEM_SINA_SECRET", "\"" + project.UM_SHARE_ITEM_SINA_SECRET + "\"")
                buildConfigField("String", "UM_SHARE_ITEM_SINA_URL", "\"" + project.UM_SHARE_ITEM_SINA_URL + "\"")
    
    
                buildConfigField("String", "UM_SHARE_ITEM_WECHAT_KEY", "\"" + project.UM_SHARE_ITEM_WECHAT_KEY + "\"")
                buildConfigField("String", "UM_SHARE_ITEM_WECHAT_SECRET", "\"" + project.UM_SHARE_ITEM_WECHAT_SECRET + "\"")
                buildConfigField("String", "UM_SHARE_ITEM_WECHAT_URL", "\"" + project.UM_SHARE_ITEM_WECHAT_URL + "\"")
    
    
                buildConfigField("String", "UM_SHARE_ITEM_QQ_KEY", "\"" + project.UM_SHARE_ITEM_QQ_KEY + "\"")
                buildConfigField("String", "UM_SHARE_ITEM_QQ_SECRET", "\"" + project.UM_SHARE_ITEM_QQ_SECRET + "\"")
                buildConfigField("String", "UM_SHARE_ITEM_QQ_URL", "\"" + project.UM_SHARE_ITEM_QQ_URL + "\"")
            }
        }
      }
      dependencies {
        ...
        compile project(':@qudian_mobile_qd-react-native-share')
        ...
      }

iOS

#TODO

Usage

import {shareImageMessage, shareWebpageMessage, SocialPlatform} from '@qudian_mobile/qd-react-native-share';


    renderSharePannel = () => {
        const shareCallback = this._onShareClick;
        const items = [];
        items.push(
            <ShareItem
                image={Images.ICON_WECHAT_SESSION}
                title={'微信'}
                type={SocialPlatform.WechatSession}
                callback={shareCallback}
                key={0}
            />
        );
        items.push(
            <ShareItem
                image={Images.ICON_WECHAT_TIMELINE}
                title={'朋友圈'}
                type={SocialPlatform.WechatTimeLine}
                callback={shareCallback}
                key={1}
            />
        );
        items.push(
            <ShareItem
                image={Images.ICON_QQ}
                title={'QQ'}
                type={SocialPlatform.QQ}
                callback={shareCallback}
                key={3}
            />
        );
        items.push(
            <ShareItem
                image={Images.ICON_QQ_ZONE}
                title={'QQ空间'}
                type={SocialPlatform.Qzone}
                callback={shareCallback}
                key={4}
            />
        );
        return (
            <View style={[{flexDirection: 'row', marginTop: 13 }]}>
                {items}
            </View>
        )
    };


    _onShareClick = (type) => {
        switch (type) {
            case 1: // 微信
                this._traceAdEvent('xxx')
                break;
            case 2: // 朋友圈
                this._traceAdEvent('xxx')
                break;
            case 4: // QQ
                this._traceAdEvent('xxx')
                break;
            case 5: // QQ空间
                this._traceAdEvent('xxx')
                break;
        }
        if (!!this.props.shareInfo) {
            const shareUrl = xxx
            shareWebpageMessage(type, title, text, image, shareUrl);
        }
    };