{"id":28984359,"url":"https://github.com/hector-chong/native-wechat","last_synced_at":"2026-01-12T02:31:20.276Z","repository":{"id":62239901,"uuid":"558474697","full_name":"Hector-Chong/native-wechat","owner":"Hector-Chong","description":"A React Native library for supporting Wechat APIs on Android and iOS","archived":false,"fork":false,"pushed_at":"2025-04-30T00:09:50.000Z","size":380,"stargazers_count":181,"open_issues_count":19,"forks_count":19,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-15T18:18:55.969Z","etag":null,"topics":["android","ios","react-native","wechat"],"latest_commit_sha":null,"homepage":"https://native-wechat.hector.im","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hector-Chong.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.config.js","contributing":null,"funding":null,"license":"LICENSE","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":"2022-10-27T16:08:08.000Z","updated_at":"2025-06-04T00:58:54.000Z","dependencies_parsed_at":"2023-12-13T04:21:06.806Z","dependency_job_id":"33315d49-959e-4ec4-b829-e389880de608","html_url":"https://github.com/Hector-Chong/native-wechat","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.15000000000000002","last_synced_commit":"c246a99366e34cc23780131c59856c86ce5c5a2c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Hector-Chong/native-wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hector-Chong%2Fnative-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hector-Chong%2Fnative-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hector-Chong%2Fnative-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hector-Chong%2Fnative-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hector-Chong","download_url":"https://codeload.github.com/Hector-Chong/native-wechat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hector-Chong%2Fnative-wechat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261721227,"owners_count":23199637,"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","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":["android","ios","react-native","wechat"],"created_at":"2025-06-24T17:10:05.756Z","updated_at":"2025-06-24T17:10:06.554Z","avatar_url":"https://github.com/Hector-Chong.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://native-wechat.hector.im/\"\u003e\n    Native Wechat\n  \u003c/a\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eA React Native library 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/native-wechat/blob/HEAD/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"Native Wechatis released under the MIT license.\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.org/package/native-wechat\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/native-wechat?color=brightgreen\u0026label=npm%20package\" alt=\"Current npm package version.\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## For Expo Project\n\nPlease refer to [Expo Native Wechat](https://github.com/Hector-Chong/expo-native-wechat)\n\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## Register SDK\nBefore invoking any APIs, registering Native WeChat by invoking `registerApp` is essential.\n\n```typescript\nimport {registerApp} from 'native-wechat';\n\nuseEffect(()=\u003e{\n\treturn 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 'native-wechat';\nimport {Button, Text} from 'react-native';\nimport {verifyWechatCode} from '@/api/auth/wechat'\n\nuseEffect(()=\u003e{\n\tregisterApp('wx964290141ebe9b7b');\n}, [])\n\nconst onButtonClicked = async () =\u003e{\n  const {data: {code}} = await sendAuthRequest();\n  \n  await verifyWechatCode(code);\n}\n\nreturn \u003cButton onClick={onButtonClicked}\u003e\n  \u003cText\u003eSend Auth Request\u003c/Text\u003e\n\u003c/Button\u003e\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# 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%2Fhector-chong%2Fnative-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhector-chong%2Fnative-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhector-chong%2Fnative-wechat/lists"}