{"id":43474248,"url":"https://github.com/neurio/react-native-local-network-permission","last_synced_at":"2026-02-03T07:25:23.732Z","repository":{"id":213173435,"uuid":"733243570","full_name":"neurio/react-native-local-network-permission","owner":"neurio","description":"A package to handle the local network permission after iOS 14","archived":false,"fork":false,"pushed_at":"2024-06-26T16:28:59.000Z","size":874,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-12T15:09:31.054Z","etag":null,"topics":["expo","ios","local-network","local-network-permission","permissions","react-native","swift"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/neurio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-18T22:18:58.000Z","updated_at":"2025-05-15T12:45:47.000Z","dependencies_parsed_at":"2023-12-19T04:22:35.280Z","dependency_job_id":"8844a034-da09-4c7e-a91f-9ea519bbbb46","html_url":"https://github.com/neurio/react-native-local-network-permission","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":"0.36363636363636365","last_synced_commit":"27fa3b791101e6c70547af6076ca1f1d61ed3bf3"},"previous_names":["neurio/react-native-local-network-permission"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/neurio/react-native-local-network-permission","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurio%2Freact-native-local-network-permission","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurio%2Freact-native-local-network-permission/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurio%2Freact-native-local-network-permission/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurio%2Freact-native-local-network-permission/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neurio","download_url":"https://codeload.github.com/neurio/react-native-local-network-permission/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neurio%2Freact-native-local-network-permission/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29037269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T06:39:36.383Z","status":"ssl_error","status_checked_at":"2026-02-03T06:39:32.787Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["expo","ios","local-network","local-network-permission","permissions","react-native","swift"],"created_at":"2026-02-03T07:25:23.102Z","updated_at":"2026-02-03T07:25:23.724Z","avatar_url":"https://github.com/neurio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native Local Network Permission\n\nA library to handle the local network permission introduced with iOS 14. It is only relevant for iOS, not for Android or\nweb.\n\n## Getting started\n\nAdd this library to your project:\n\n`npm install @generac/react-native-local-network-permission`\n\n`yarn add @generac/react-native-local-network-permission`\n\n### iOS manual configuration\n\n#### NSLocalNetworkUsageDescription\n\nYou need to add the `NSLocalNetworkUsageDescription` key to your `Info.plist` file. This should be a description of why\nyour app needs Local Network permissions:\n\n```\n\u003ckey\u003eNSLocalNetworkUsageDescription\u003c/key\u003e\n\u003cstring\u003eApp requires local network access to do ...\u003c/string\u003e\n```\n\n_See\nalso: [Apple documentation](https://developer.apple.com/documentation/bundleresources/information_property_list/nslocalnetworkusagedescription)_\n\n#### NSBonjourServices\n\nYou need to add the `NSBonjourServices` key to your `Info.plist` file. This should be an array of Bonjour services that\nyour app uses:\n\n```\n\u003ckey\u003eNSBonjourServices\u003c/key\u003e\n\u003carray\u003e\n  \u003cstring\u003e_bonjour._tcp\u003c/string\u003e\n  \u003cstring\u003e_lnp._tcp.\u003c/string\u003e\n\u003c/array\u003e\n```\n\n_See\nalso: [Apple documentation](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbonjourservices)_\n\n#### Expo\n\nIf you are using the Expo managed workflow, you cannot directly edit your `Info.plist`. Instead, you can add the\nfollowing to your `app.json` or `app.config.js`:\n\n```\nexpo: {\n  ios: {\n    infoPlist: {\n      NSLocalNetworkUsageDescription: 'App requires local network access to do ...',\n      NSBonjourServices: ['_bonjour._tcp', '_lnp._tcp.'],\n    },\n  },\n}\n```\n\n## Usage\n\nThis library can be used in both React Native and Expo projects. Note however:\n- If using Expo, you need to [create a development build](https://docs.expo.dev/develop/development-builds/create-a-build/), using the Expo Go app will not work;\n- If using bare React Native, you need to add Expo modules to your project, see [Expo documentation](https://docs.expo.dev/bare/installing-expo-modules/).\n\n```typescript\nimport {\n  checkLocalNetworkAccess,\n  requestLocalNetworkAccess,\n} from '@generac/react-native-local-network-permission';\n\n//you need to make sure the local network permission dialog popup once\nconst result = await requestLocalNetworkAccess();\n\n//then use checkLocalNetworkAccess when you need\nconst result = await checkLocalNetworkAccess();\n//here run the code depends local network access\n```\n\n## Jest mocking\n\nIf you need to mock this library in your Jest tests, you can use the following code in your `testSetup.ts` file which\nyou need to reference in your `jest.config.js` under `setupFilesAfterEnv`:\n\n```javascript\njest.mock('@generac/react-native-local-network-permission', () =\u003e ({\n    checkLocalNetworkAccess: jest.fn(),\n    requestLocalNetworkAccess: jest.fn(),\n  }),\n);\n```\n\n## Commit messages\n\nThis repository uses a [commit message convention](https://github.com/conventional-changelog/conventional-changelog)\nwhich is enforced by a pre-commit hook. If you execute `npm run commit` instead of `git commit -m \"some message\"` you\nwill be guided through the steps to write an acceptable commit message.\n\nIt is important that you do this properly, because\nthe [semantic-release](https://github.com/semantic-release/semantic-release) automation depends on the commit messages\nto be starting with the proper keyword to determine if a major, minor or\npatch [semantic version](https://semver.org/) should be assigned.\n\n## See also\n\n- [Apple FAQ 1](https://developer.apple.com/forums/thread/663858)\n- [Apple FAQ 2](https://developer.apple.com/forums/thread/663874)\n- [Stackoverflow inspiration for this library](https://stackoverflow.com/questions/63940427/ios-14-how-to-trigger-local-network-dialog-and-check-user-answer/67758105#67758105)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurio%2Freact-native-local-network-permission","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneurio%2Freact-native-local-network-permission","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneurio%2Freact-native-local-network-permission/lists"}