wechat.js 737 B

123456789101112131415161718192021222324252627
  1. import * as WeChat from "react-native-wechat";
  2. /**
  3. public static String WX_APPID = "wx51acc19c8f7a0f6f";
  4. public static String WX_SECRET = "e830d45f497025041269ef6221140c3d";
  5. */
  6. WeChat.registerApp("wx51acc19c8f7a0f6f");
  7. export default class wechat {
  8. componentWillMount() {}
  9. //文字好友分享
  10. static shareToSession(text, description) {
  11. console.log("123123123123123");
  12. WeChat.isWXAppInstalled().then(isInstalled => {
  13. if (isInstalled) {
  14. WeChat.shareToSession({
  15. type: "text",
  16. description: "测试微信好友分享的文本内容"
  17. }).catch(error => {
  18. console.log(error.message);
  19. });
  20. } else {
  21. alert("请安装微信");
  22. }
  23. });
  24. }
  25. }