{"id":40277865,"url":"https://github.com/luoxuhai/react-native-tinykit","last_synced_at":"2026-04-02T23:23:14.913Z","repository":{"id":331197888,"uuid":"1125665407","full_name":"luoxuhai/react-native-tinykit","owner":"luoxuhai","description":"📱🔧 A lightweight React Native toolkit for iOS, providing essential native utilities","archived":false,"fork":false,"pushed_at":"2026-01-18T01:47:13.000Z","size":1461,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-18T13:53:21.328Z","etag":null,"topics":["ios","react-native"],"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/luoxuhai.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-31T06:03:16.000Z","updated_at":"2026-01-18T01:47:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/luoxuhai/react-native-tinykit","commit_stats":null,"previous_names":["luoxuhai/react-native-tinykit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/luoxuhai/react-native-tinykit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luoxuhai%2Freact-native-tinykit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luoxuhai%2Freact-native-tinykit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luoxuhai%2Freact-native-tinykit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luoxuhai%2Freact-native-tinykit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luoxuhai","download_url":"https://codeload.github.com/luoxuhai/react-native-tinykit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luoxuhai%2Freact-native-tinykit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28594958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"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":["ios","react-native"],"created_at":"2026-01-20T03:10:10.051Z","updated_at":"2026-04-02T23:23:14.905Z","avatar_url":"https://github.com/luoxuhai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-tinykit\n\n[![npm version](https://img.shields.io/npm/v/react-native-tinykit.svg)](https://www.npmjs.com/package/react-native-tinykit)\n[![license](https://img.shields.io/npm/l/react-native-tinykit.svg)](https://github.com/luoxuhai/react-native-tinykit/blob/master/LICENSE)\n\nA lightweight React Native toolkit for iOS, providing essential native utilities (Zero dependencies).\n\n\u003cimg src=\"./assets/example.png\" width=\"400\" /\u003e\n\n## Features\n\n- 🔄 **App Restart** - Programmatically restart your React Native application\n- 🌡️ **Thermal State** - Get and monitor the device's thermal state\n- ⭐ **App Review** - Request App Store review from within your app\n- 🔅 **Keep Awake** - Prevent the screen from auto-locking\n- ⚡ **Turbo Module** - Built with the new architecture for optimal performance\n- 📦 **Lightweight** - Minimal footprint with zero dependencies\n\n## Requirements\n\n- React Native \u003e= 0.76\n- iOS only (for now)\n\n## Installation\n\n```sh\n# Using npm\nnpm install react-native-tinykit\n\n# Using yarn\nyarn add react-native-tinykit\n```\n\n### iOS Setup\n\n```sh\ncd ios \u0026\u0026 pod install\n```\n\n## Usage\n\n### Restart Application\n\nRestart the React Native application programmatically:\n\n```tsx\nimport { restart } from 'react-native-tinykit';\n\n// Restart the app\nrestart();\n```\n\n#### Example Use Cases\n\n- Force reload after language/locale change\n- Reset app state after logout\n- Apply configuration changes that require a restart\n\n### Thermal State\n\nGet the current thermal state and monitor for changes:\n\n```tsx\nimport { getThermalState, onThermalStateChange } from 'react-native-tinykit';\n\n// Get current thermal state\nconst state = getThermalState();\nconsole.log('Current thermal state:', state);\n\n// Listen for thermal state changes\nconst subscription = onThermalStateChange((state) =\u003e {\n  console.log('Thermal state changed:', state);\n\n  switch (state) {\n    case 'nominal':\n      // Normal operating conditions\n      break;\n    case 'fair':\n      // Slightly elevated thermal state\n      break;\n    case 'serious':\n      // High thermal state - consider reducing activity\n      break;\n    case 'critical':\n      // Critical thermal state - reduce activity immediately\n      break;\n  }\n});\n\n// Clean up the listener when done\nsubscription.remove();\n```\n\n#### Example Use Cases\n\n- Reduce graphics quality or frame rate when device is overheating\n- Pause background tasks during high thermal states\n- Show warnings to users when thermal state is critical\n\n### Keep Awake\n\nPrevent the screen from auto-locking:\n\n```tsx\nimport {\n  activate,\n  deactivate,\n  useKeepAwake,\n  KeepAwake,\n} from 'react-native-tinykit';\n\n// Imperative API\nactivate(); // Keep screen awake\ndeactivate(); // Allow screen to auto-lock\n\n// Hook - keeps screen awake while the component is mounted\nfunction VideoPlayer() {\n  useKeepAwake();\n  return \u003cVideo /\u003e;\n}\n\n// Component - keeps screen awake while mounted\nfunction App() {\n  return (\n    \u003c\u003e\n      \u003cKeepAwake /\u003e\n      \u003cMyContent /\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n#### Example Use Cases\n\n- Keep the screen on during video playback\n- Prevent auto-lock during navigation or long-running tasks\n- Keep display active during presentations or reading\n\n### App Review\n\nRequest an App Store review from your user:\n\n```tsx\nimport { requestReview } from 'react-native-tinykit';\n\n// Request review\nawait requestReview();\n```\n\n\u003e **Note**: In development mode, the review dialog will always appear. In production (TestFlight/App Store), iOS limits the frequency of these prompts (max 3 times per year per user).\n\n#### Example Use Cases\n\n- Prompt for review after a user completes a significant action\n- Ask for feedback after a certain number of app opens\n\n## API Reference\n\n### `restart()`\n\nTriggers a reload of the React Native application.\n\n```tsx\nrestart(): void\n```\n\n**Example:**\n\n```tsx\nimport { restart } from 'react-native-tinykit';\n\nconst handleLogout = async () =\u003e {\n  await clearUserData();\n  restart(); // Restart app to reset state\n};\n```\n\n### `getThermalState()`\n\nReturns the current thermal state of the device.\n\n```tsx\ngetThermalState(): ThermalState\n```\n\n**Returns:** `'nominal' | 'fair' | 'serious' | 'critical'`\n\n| State      | Description                               |\n| ---------- | ----------------------------------------- |\n| `nominal`  | The thermal state is within normal limits |\n| `fair`     | The thermal state is slightly elevated    |\n| `serious`  | The thermal state is high                 |\n| `critical` | The thermal state is critically high      |\n\n**Example:**\n\n```tsx\nimport { getThermalState } from 'react-native-tinykit';\n\nconst state = getThermalState();\nif (state === 'critical') {\n  // Reduce app activity to help cool down the device\n}\n```\n\n### `onThermalStateChange()`\n\nAdds a listener for thermal state changes.\n\n```tsx\nonThermalStateChange(listener: (state: ThermalState) =\u003e void): { remove: () =\u003e void }\n```\n\n**Parameters:**\n\n- `listener` - Callback function that receives the new thermal state\n\n**Returns:** A subscription object with a `remove()` method to stop listening\n\n**Example:**\n\n```tsx\nimport { onThermalStateChange } from 'react-native-tinykit';\n\nconst subscription = onThermalStateChange((state) =\u003e {\n  console.log('Thermal state changed to:', state);\n});\n\n// Later, when you want to stop listening:\nsubscription.remove();\n```\n\n### `activate()`\n\nActivates the keep-awake feature, preventing the screen from auto-locking.\n\n```tsx\nactivate(): void\n```\n\n**Example:**\n\n```tsx\nimport { activate } from 'react-native-tinykit';\n\nactivate();\n```\n\n### `deactivate()`\n\nDeactivates the keep-awake feature, allowing the screen to auto-lock.\n\n```tsx\ndeactivate(): void\n```\n\n**Example:**\n\n```tsx\nimport { deactivate } from 'react-native-tinykit';\n\ndeactivate();\n```\n\n### `useKeepAwake()`\n\nA hook that keeps the screen awake while the component is mounted. Automatically deactivates on unmount.\n\n```tsx\nuseKeepAwake(): void\n```\n\n**Example:**\n\n```tsx\nimport { useKeepAwake } from 'react-native-tinykit';\n\nfunction VideoPlayer() {\n  useKeepAwake();\n  return \u003cVideo /\u003e;\n}\n```\n\n### `\u003cKeepAwake /\u003e`\n\nA component that keeps the screen awake while mounted. Renders nothing.\n\n```tsx\n\u003cKeepAwake /\u003e\n```\n\n**Example:**\n\n```tsx\nimport { KeepAwake } from 'react-native-tinykit';\n\nfunction App() {\n  const [isPlaying, setIsPlaying] = useState(false);\n  return (\n    \u003c\u003e\n      {isPlaying \u0026\u0026 \u003cKeepAwake /\u003e}\n      \u003cVideoPlayer onPlay={() =\u003e setIsPlaying(true)} /\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n### `requestReview()`\n\nRequests a review of the app.\n\n```tsx\nrequestReview(): Promise\u003cvoid\u003e\n```\n\n**Returns:** A Promise that resolves when the request is processed.\n\n**Example:**\n\n```tsx\nimport { requestReview } from 'react-native-tinykit';\n\nconst handleReview = async () =\u003e {\n  try {\n    await requestReview();\n  } catch (error) {\n    console.error('Failed to request review:', error);\n  }\n};\n```\n\n## Apps Using This Library\n\n- [Night Vision - LiDAR Camera](https://apps.apple.com/app/id1668629667)\n- [Laser Measure - LiDAR Powered](https://apps.apple.com/app/id6466744678)\n- [PhoneAway - Digital Detox](https://apps.apple.com/app/id6744548607)\n- [Fatigue Alert - Stay Awake](https://apps.apple.com/app/id6479893638)\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n- [Development workflow](CONTRIBUTING.md#development-workflow)\n- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)\n- [Code of conduct](CODE_OF_CONDUCT.md)\n\n## License\n\nMIT © [Darkce](https://github.com/luoxuhai)\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%2Fluoxuhai%2Freact-native-tinykit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluoxuhai%2Freact-native-tinykit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluoxuhai%2Freact-native-tinykit/lists"}