{"id":30812681,"url":"https://github.com/evansuner/expo-wechat-lib","last_synced_at":"2025-09-06T07:05:03.951Z","repository":{"id":307804596,"uuid":"1030738800","full_name":"evansuner/expo-wechat-lib","owner":"evansuner","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-02T09:28:50.000Z","size":142,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-02T10:50:11.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evansuner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-02T08:06:11.000Z","updated_at":"2025-08-02T09:28:53.000Z","dependencies_parsed_at":"2025-08-03T07:46:04.392Z","dependency_job_id":null,"html_url":"https://github.com/evansuner/expo-wechat-lib","commit_stats":null,"previous_names":["evansuner/expo-wechat-lib"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/evansuner/expo-wechat-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansuner%2Fexpo-wechat-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansuner%2Fexpo-wechat-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansuner%2Fexpo-wechat-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansuner%2Fexpo-wechat-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evansuner","download_url":"https://codeload.github.com/evansuner/expo-wechat-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evansuner%2Fexpo-wechat-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273846473,"owners_count":25178625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-06T07:02:47.880Z","updated_at":"2025-09-06T07:05:03.939Z","avatar_url":"https://github.com/evansuner.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://native-wechat.hector.im/\"\u003e\n    Expo Native Wechat\n  \u003c/a\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eA Expo Module for supporting Wechat APIs on Android and iOS\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Hector-Chong/expo-native-wechat/blob/HEAD/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"Expo Native Native released under the MIT license.\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.org/package/expo-native-wechat\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/expo-native-wechat?color=brightgreen\u0026label=npm%20package\" alt=\"Current npm package version.\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n#### For Bare React Native Project\n\nPlease refer to [Native Wechat](https://github.com/Hector-Chong/native-wechat)\n\n# Motivation\n\nMost developers using React Native to build apps are not equipped with native developing skills, not to mention connecting their apps with WeChat.\n\nEspecially, WeChat OpenSDK is something pain in the ass because of [shitty docs](https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html) where lots of APIs are not clear and intuitive. To help developers using React Native, I tried as much as possible to create this library. And I hope you benefit from this and be less frustrated with WeChat.\n\n# Why\n\n- Native WeChat is new, and many libraries like it are no longer maintained and keep up with the latest WeChat.\n- Native WeChat supports both legacy and new React Native architecture.\n- Native WeChat is a TurboModule that supports lazy loading, allowing for faster app startup.\n- Supports TypeScript for better intellisense and easy-to-check typing errors.\n- All Apis are promisified.\n\n# Getting Started\n\n## Installation\n\n### Expo SDK 51 and below\n\n```bash\nnpm install expo-native-wechat@0.1.x\n# or\nyarn add expo-native-wechat@0.1.x\n```\n\n### Expo SDK 52 and above\n\n```bash\nnpm install expo-native-wechat@0.2.x\n# or\nyarn add expo-native-wechat@0.2.x\n```\n\n## Configuration\n\nOpen `app.json` and add the following information:\n\n```js\n{\n    // Add your WeChat app ID\n    \"scheme\": [\"wx123456nxabcdefg\"],\n    \"ios\": {\n      // Add your iOS universal link\n      // Example \"applinks:(google.com)\"\n      \"associatedDomains\": [\"applinks:(Universal Link Here)\"]\n    },\n    // Add Expo Native Wechat plugin\n    \"plugins\": [\"expo-native-wechat\"]\n}\n```\n\n## Register SDK\n\nBefore invoking any APIs, registering Native WeChat by invoking `registerApp` is essential.\n\n```typescript\nimport { registerApp } from \"expo-native-wechat\";\n\nuseEffect(() =\u003e {\n  return registerApp(\"wx964290141ebe9b7b\");\n}, []);\n```\n\nWhen invoking `registerApp`, there will be a listener to receive events from Wechat. `registerApp` returns a function to remove the listener, and no events will be received from Wechat.\n\n## Invoking API\n\nNow is the time to invoke API. For example, we will send an auth request to Wechat and receive the code. You may use the API named `sendAuthRequest` here.\n\n```jsx\nimport { registerApp, sendAuthRequest } from \"expo-native-wechat\";\nimport { Button, Text } from \"react-native\";\nimport { verifyWechatCode } from \"@/api/auth/wechat\";\n\nuseEffect(() =\u003e {\n  registerApp(\"wx964290141ebe9b7b\");\n}, []);\n\nconst onButtonClicked = async () =\u003e {\n  const {\n    data: { code },\n  } = await sendAuthRequest();\n\n  await verifyWechatCode(code);\n};\n\nreturn (\n  \u003cButton onClick={onButtonClicked}\u003e\n    \u003cText\u003eSend Auth Request\u003c/Text\u003e\n  \u003c/Button\u003e\n);\n```\n\nMost APIs in Native WeChat are promisified. So is `sendAuthRequest` which will return a promise. When the user confirms the request on Wechat, the promise is resolved to be data with a code. All promisifed APIs return a generic type named `NativeWechatResponse`.\n\n```typescript\nexport type NativeWechatResponse\u003cT = Record\u003cstring, unknown\u003e\u003e = {\n  type: string;\n  errorCode: number;\n  errorStr: string | null;\n  data: T;\n};\n```\n\n## WeChat App Pure Contract Signing\n\n### appPureSignContract\n\n```typescript\nimport { appPureSignContract } from 'expo-native-wechat';\n\nconst signContract = async () =\u003e {\n  try {\n    const result = await appPureSignContract({\n      preEntrustwebId: '5778aadY9nltAsZzXixCkFIGYnV2V'\n    });\n    console.log('Contract signing result:', result);\n  } catch (error) {\n    console.error('Contract signing failed:', error);\n  }\n};\n```\n\n# Support\n\nIf you have trouble using this library, do not hesitate to open an issue. I am always here to help.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevansuner%2Fexpo-wechat-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevansuner%2Fexpo-wechat-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevansuner%2Fexpo-wechat-lib/lists"}