{"id":25668036,"url":"https://github.com/sreejithr/react-native-context-execute","last_synced_at":"2026-05-14T08:33:11.715Z","repository":{"id":57336237,"uuid":"82665120","full_name":"sreejithr/react-native-context-execute","owner":"sreejithr","description":"Execute JS code in React Native context","archived":false,"fork":false,"pushed_at":"2017-02-21T13:05:53.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T17:16:56.475Z","etag":null,"topics":["react-native"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/sreejithr.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}},"created_at":"2017-02-21T10:07:30.000Z","updated_at":"2017-07-21T11:33:08.000Z","dependencies_parsed_at":"2022-09-11T02:11:29.952Z","dependency_job_id":null,"html_url":"https://github.com/sreejithr/react-native-context-execute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreejithr%2Freact-native-context-execute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreejithr%2Freact-native-context-execute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreejithr%2Freact-native-context-execute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sreejithr%2Freact-native-context-execute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sreejithr","download_url":"https://codeload.github.com/sreejithr/react-native-context-execute/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240261481,"owners_count":19773474,"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":["react-native"],"created_at":"2025-02-24T10:20:22.494Z","updated_at":"2026-05-14T08:33:06.694Z","avatar_url":"https://github.com/sreejithr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# react-native-context-execute\n\nExecute JS code in React Native's context even when RN is inactive (eg. app in background).\n\nIn Android, where background services are indispensable, keeping RN in sync can be hard since RN doesn't stay active in background. **Currently, Android-only**.\n\nA tiny library which registers a `JavascriptModule` in RN's `JavascriptModuleRegistry` and makes `Catalyst` (Bridge) run it.\n\nBefore using this, please note that **HeadlessJS** is another good way to go.\n\n## Getting started\n\n`$ npm install react-native-context-execute --save`\n\n### Mostly automatic installation\n\n`$ rnpm link react-native-context-execute`\n\n### Manual installation\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n  - Add `import com.reactlibrary.RNContextExecutePackage;` to the imports at the top of the file\n  - Add `new RNContextExecutePackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':react-native-context-execute'\n  \tproject(':react-native-context-execute').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-context-execute/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n      compile project(':react-native-context-execute')\n  \t```\n\n## Usage\nIn your Java side, grab hold of the `ReactApplicationContext` and do,\n\n```java\nWritableMap payload = Arguments.createMap();\npayload.putString(\"some_key\", \"some_value\");\n\nnew ReactContextExecutor(reactApplicationContext).execute(\"some_other_key\", payload);\n```\n\nIn JS side,\n\n```javascript\nimport { ContextExecute } from 'react-native-context-execute';\n\nContextExecute((op, data) =\u003e {\n    // Do your thing\n});\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsreejithr%2Freact-native-context-execute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsreejithr%2Freact-native-context-execute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsreejithr%2Freact-native-context-execute/lists"}