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

@phecdas/rn-wechat

v1.0.3

Published

Another react native bridge for WechatSDK

Downloads

30

Readme

rn-wechat

NPM Version LICENSE

WechatSDK 的 react-native 库,基于 react-native-wechat 完成。需要 react-native 版本 0.60 及以上。

概要

| | iOS | Android | | :----------------: | :-----: | :-----: | | Version | 1.8.6.2 | 5.5.8 | | Share | ✅ | ✅ | | Pay | ✅ | ✅ | | Auth | ✅ | ✅ | | Launch MiniProgram | ✅ | ✅ |

安装

yarn add @phecdas/rn-wechat
# or
npm install @phecdas/rn-wechat

iOS

  1. cd ios; pod install;
  2. 参考 微信开放文档 ,配置 Universal linksURL typeLSApplicationQueriesSchemes
  3. 配置你的 AppDelegate.m ,使其能正确处理 URL
// ios 9.0+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
            options:(NSDictionary<NSString*, id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
  return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}

Android

  1. android/app/proguard.pro 添加规则:
-keep class com.tencent.mm.opensdk.** {
    *;
}

-keep class com.tencent.wxop.** {
    *;
}

-keep class com.tencent.mm.sdk.** {
    *;
}
  1. 参考 微信开放文档 新建 android/app/src/main/java/YOUR/PACKAGE/wxapi/WXEntryActivity.java 如下
// WXEntryActivity.java
package YOUR.PACKAGE.wxapi;

import android.app.Activity;
import android.os.Bundle;

import com.braeco.wechat.BCWechatModule;

public class WXEntryActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BCWechatModule.handleIntent(getIntent());
    finish();
  }
}

添加如下代码到 ApplicationManifest.xml

<activity
    android:name=".wxapi.WXEntryActivity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:exported="true"
    android:taskAffinity="填写你的包名"
    android:launchMode="singleTask">
</activity>
  1. 支付功能,参考文档新建 android/app/src/main/java/YOUR/PACKAGE/wxapi/WXPayEntryActivity.java 如下
// WXPayEntryActivity.java
package YOUR.PACKAGE.wxapi;

import android.app.Activity;
import android.os.Bundle;
import com.braeco.wechat.BCWechatModule;

public class WXPayEntryActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BCWechatModule.handleIntent(getIntent());
    finish();
  }
}

添加如下代码到 ApplicationManifest.xml

<activity
    android:name=".wxapi.WXPayEntryActivity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:exported="true"
    android:taskAffinity="填写你的包名"
    android:launchMode="singleTask">
</activity>

使用

必须先向微信注册你的 App

// App.tsx or App.jsx
import Wechat from '@phecdas/rn-wechat'

Wechat.registerApp(App_Id, Universal_Link);

分享

import WeChat, { WXShareType, WXShareScene } from '@phecdas/rn-wechat';

try {
  await WeChat.shareMessage({
    type: WXShareType.WXShareTypeText,
    text: '要分享的文字',
    scene: WXShareScene.WXSceneSession,
  });
  // 注意微信为了保护用户隐私,即使用户取消,也会返回成功
} catch (error) {
  // 所以失败是有其他原因的
}

目前小程序仅支持分享到对话。

其他用法参考 Typescript 声明文件。

License

BSD-3-Clause