{"id":31135904,"url":"https://github.com/nextfaze/react-native-manup","last_synced_at":"2025-09-18T07:46:38.724Z","repository":{"id":307636094,"uuid":"1030096209","full_name":"NextFaze/react-native-manup","owner":"NextFaze","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-01T08:51:32.000Z","size":1870,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-01T10:50:56.559Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/NextFaze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-01T04:52:04.000Z","updated_at":"2025-08-01T04:52:16.000Z","dependencies_parsed_at":"2025-08-01T11:09:20.857Z","dependency_job_id":null,"html_url":"https://github.com/NextFaze/react-native-manup","commit_stats":null,"previous_names":["nextfaze/react-native-manup"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/NextFaze/react-native-manup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Freact-native-manup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Freact-native-manup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Freact-native-manup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Freact-native-manup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NextFaze","download_url":"https://codeload.github.com/NextFaze/react-native-manup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Freact-native-manup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275732031,"owners_count":25518090,"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-18T02:00:09.552Z","response_time":77,"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-18T07:46:37.523Z","updated_at":"2025-09-18T07:46:38.716Z","avatar_url":"https://github.com/NextFaze.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-manup\n\nA React Native library for handling mandatory app updates and maintenance mode. This library provides a simple way to check if your app version is supported, requires an update, or if the app is in maintenance mode.\n\n## Features\n\n- 🔄 **Version Validation**: Automatically validates app version against minimum and latest requirements\n- 🚧 **Maintenance Mode**: Support for putting apps in maintenance mode\n- 🔥 **Firebase Remote Config**: Integration with Firebase Remote Config for dynamic configuration\n- 🌐 **HTTP Configuration**: Support for HTTP-based configuration endpoints\n- 📱 **Platform Specific**: Different configuration for iOS and Android\n- ⚡ **Real-time Updates**: Automatic status updates with callback support\n\n## Installation\n\n```sh\nnpm install react-native-manup\n```\n\n### Peer Dependencies\n\nThis library requires the following peer dependencies:\n\n```sh\nnpm install react-native-device-info\n```\n\n#### Optional Firebase Dependencies\n\nIf you plan to use Firebase Remote Config as your configuration source, you'll also need to install:\n\n```sh\nnpm install @react-native-firebase/app @react-native-firebase/remote-config\n```\n\n## Usage\n\n### Remote Config Provider\n\nThe `RemoteConfigProvider` is a unified solution that works with any config source. It provides automatic caching, refetching, and change detection through react-query.\n\n#### HTTP Configuration Example\n\nCan also see the full example code at [example/App.tsx](example/App.tsx)\n\n```tsx\nimport React from 'react';\nimport { Alert } from 'react-native';\nimport { RemoteConfigProvider, useRemoteConfigManUp } from 'react-native-manup';\n\nfunction App() {\n  return (\n    \u003cRemoteConfigProvider\n      fetchConfig={async () =\u003e {\n        const response = await fetch('https://your-api.com/config.json', { cache: 'no-store'});\n        if (!response.ok) {\n          throw new Error(`HTTP error! status: ${response.status}`);\n        }\n        return response.json();\n      }}\n      refetchInterval={3600000} // 1 hour (optional)\n      queryKey=\"httpConfig\" // optional\n    \u003e\n      \u003cHomeScreen /\u003e\n    \u003c/RemoteConfigProvider\u003e\n  );\n}\n\nfunction HomeScreen() {\n  const { status, message } = useRemoteConfigManUp({\n  const onUpdateAvailable = () =\u003e {\n    // - Display update available modal\n    // - Modal can be dismissed\n  };\n\n  const onUpdateRequired = () =\u003e {\n    // - Display update required modal\n    // - Modal shouldn't be dismissible as user is required to update the app\n  };\n\n  const onMaintenanceMode = () =\u003e {\n    // - Display maintenance mode modal\n    // - Modal shouldn't be dismissible as the app is in maintenance mode\n  };\n  });\n\n  return (\n    // Your app content\n  );\n}\n```\n\n#### Firebase Remote Config Example\n\n\u003e **Prerequisite**: You must install and set up Firebase in your React Native app before using this provider. Follow the [React Native Firebase setup guide](https://rnfirebase.io/#installation) to configure `@react-native-firebase/app` and `@react-native-firebase/remote-config`.\n\n```tsx\nimport React from 'react';\nimport { Alert } from 'react-native';\nimport { RemoteConfigProvider, useRemoteConfigManUp } from 'react-native-manup';\nimport remoteConfig from '@react-native-firebase/remote-config';\n\nfunction App() {\n  return (\n    \u003cRemoteConfigProvider\n      fetchConfig={async () =\u003e {\n        await remoteConfig().fetchAndActivate();\n        return JSON.parse(remoteConfig().getValue('appConfig').asString());\n      }}\n      queryKey=\"firebaseConfig\"\n    \u003e\n      \u003cHomeScreen /\u003e\n    \u003c/RemoteConfigProvider\u003e\n  );\n}\n\nfunction HomeScreen() {\n  const { status, message } = useRemoteConfigManUp({\n  const onUpdateAvailable = () =\u003e {\n    // - Display update available modal\n    // - Modal can be dismissed\n  };\n\n  const onUpdateRequired = () =\u003e {\n    // - Display update required modal\n    // - Modal shouldn't be dismissible as user is required to update the app\n  };\n\n  const onMaintenanceMode = () =\u003e {\n    // - Display maintenance mode modal\n    // - Modal shouldn't be dismissible as the app is in maintenance mode\n  };\n  });\n\n  return (\n    // Your app content\n  );\n}\n```\n\n## Configuration\n\nThe library expects a configuration object with platform-specific data. Here's the structure:\n\n```typescript\ninterface Config {\n  [key: string]: PlatFormData;\n}\n\ninterface PlatFormData {\n  latest: string; // Latest available version\n  minimum: string; // Minimum supported version\n  url: string; // Download URL for the app\n  enabled: boolean; // Whether the app is enabled\n}\n```\n\n### Example Configuration\n\n```json\n{\n  \"ios\": {\n    \"latest\": \"1.2.0\",\n    \"minimum\": \"1.0.0\",\n    \"url\": \"https://apps.apple.com/app/yourapp\",\n    \"enabled\": true,\n    // Custom platform-specific property - can be any additional data you need\n    \"publicApiUrl\": \"https://api.ios-example.com/v1\"\n  },\n  \"android\": {\n    \"latest\": \"1.2.0\",\n    \"minimum\": \"1.0.0\",\n    \"url\": \"https://play.google.com/store/apps/details?id=com.yourapp\",\n    \"enabled\": true,\n    // Custom platform-specific property - can be any additional data you need\n    \"publicApiUrl\": \"https://api.android-example.com/v1\"\n  },\n  // Custom global property - shared across all platforms\n  \"publicApiUrl\": \"https://api.example.com/v1\"\n}\n```\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n\n---\n\nMade with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextfaze%2Freact-native-manup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextfaze%2Freact-native-manup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextfaze%2Freact-native-manup/lists"}