{"id":20741616,"url":"https://github.com/attitude/react-dual-theme","last_synced_at":"2026-04-22T01:02:48.689Z","repository":{"id":41142619,"uuid":"214977447","full_name":"attitude/react-dual-theme","owner":"attitude","description":"A dual theme context for React (Native) apps to support dark mode purposes.","archived":false,"fork":false,"pushed_at":"2023-01-06T02:12:37.000Z","size":701,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-26T12:52:10.535Z","etag":null,"topics":["context","context-api","dark-mode","react","react-hook","react-native","theme-context","theme-provider","theming","usetheme"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/attitude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-14T07:33:07.000Z","updated_at":"2022-06-28T20:49:44.000Z","dependencies_parsed_at":"2023-02-05T02:32:12.210Z","dependency_job_id":null,"html_url":"https://github.com/attitude/react-dual-theme","commit_stats":null,"previous_names":["attitude/react-native-theme"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/attitude/react-dual-theme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/attitude%2Freact-dual-theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/attitude%2Freact-dual-theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/attitude%2Freact-dual-theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/attitude%2Freact-dual-theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/attitude","download_url":"https://codeload.github.com/attitude/react-dual-theme/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/attitude%2Freact-dual-theme/sbom","scorecard":{"id":215748,"data":{"date":"2025-08-11","repo":{"name":"github.com/attitude/react-dual-theme","commit":"d3e1bbf843acfee561da41ca1abba0a897328c7b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"14 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T01:37:16.112Z","repository_id":41142619,"created_at":"2025-08-17T01:37:16.112Z","updated_at":"2025-08-17T01:37:16.112Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32116514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"ssl_error","status_checked_at":"2026-04-22T00:30:22.894Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["context","context-api","dark-mode","react","react-hook","react-native","theme-context","theme-provider","theming","usetheme"],"created_at":"2024-11-17T06:42:25.232Z","updated_at":"2026-04-22T01:02:48.669Z","avatar_url":"https://github.com/attitude.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-dual-theme\nA dual theme context for React (Native) apps to support dark mode purposes.\n\n## ✨ Installation\n\nInstall package:\n\n```\nyarn add react-dual-theme\n```\n\nor\n\n```\nnpm install react-dual-theme\n```\n\n---\n\n## 📖 Reference\n\n### ThemeProvider\n\n\u003e A component used to set theme for its children.\n\nProp  | Type                          | Required\n------|-------------------------------|---------\ntheme |`string` or `[string, string]` | yes\n\nPassing a single `string` to the `theme` prop is considered same as\npassing a tuple of the same string as `[string, string]`.\n\n### useTheme(): [string, string]\n\n\u003e A React hook to be used in functional components to get theme\n\u003e from the nearest ThemeProvider parent.\n\nReturns tuple of strings.\n\n\\#    | Type     | Description\n------|----------|------------------\n`[0]` | `string` | First theme name\n`[1]` | `string` | Second theme name\n\n---\n\n## 🚀 Usage\n\n1. Wrap your app in `\u003cThemeProvider\u003e...\u003c/ThemeProvider\u003e`:\n\n```js\n// ./App.js\n// Example with Dark Mode\nimport { ThemeProvider } from 'react-dual-theme'\nimport { DarkModeProvider } from 'react-native-dark-mode'\n\nimport { Text, View } from './ThemedComponents'\n\nconst App = () =\u003e {\n  return (\n    \u003cDarkModeProvider\u003e\n      \u003cThemeProvider theme={['red-on-light', 'red-on-dark']}\u003e\n        \u003cView\u003e\n          \u003cText\u003eHello themed text!\u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/ThemeProvider\u003e\n    \u003c/DarkModeProvider\u003e\n}\n```\n\n2. Create component to consume the theme context:\n\n```js\n// ./ThemedComponents.js\n// @flow\nimport * as React from 'react'\nimport {\n  StyleSheet,\n  View as RNView,\n  Text as RNText,\n} from 'react-native'\nimport { useTheme } from 'react-dual-theme'\nimport { useDarkMode } from 'react-native-dark-mode'\n\nconst viewStyles = StyleSheet.create({\n  'red-on-dark': { backgroundColor: 'black' },\n  'red-on-light': { backgroundColor: 'white' },\n})\n\n// Type just for example purposes:\ndeclare type Style = null | Object | (null | Object | Style)[];\n\ntype Props = {\n  children?: React.Node,\n  style?: Style,\n}\n\nexport const View = ({ children, style, ...rest }: Props) =\u003e {\n  const [light, dark] = useTheme()\n  const isDarkMode: boolean = useDarkMode()\n\n  // Add some theming logic..\n  const themeStyle = isDarkMode ? viewStyles[dark] : viewStyles[light]\n\n  return \u003cRNView\n    {...rest}\n    style={[themeStyle, style]}\n  \u003e\n    {children}\n  \u003c/RNView\u003e\n}\n\nconst textStyles = StyleSheet.create({\n  'red-on-dark': { color: 'red' },\n  'red-on-light': { color: 'red' },\n})\n\nexport const Text = ({ children, style, ...rest }: Props) =\u003e {\n  const [light, dark] = useTheme()\n  const isDarkMode: boolean = useDarkMode()\n\n  // Add some theming logic..\n  const themeStyle = isDarkMode ? textStyles[dark] : textStyles[light]\n\n  return \u003cRNText\n    {...rest}\n    style={[themeStyle, style]}\n  \u003e\n    {children}\n  \u003c/RNText\u003e\n}\n\n```\n\n3. **Extra:** View as a _ThemeProvider_\n\nYou can simply make a `\u003cView /\u003e` component a theme provider in the same time:\n\n```js\nimport { ThemeProvider, useTheme } from 'react-dual-theme'\n\ntype Props = {\n  children?: React.Node,\n  style?: Style,\n  theme: string | [string, string],\n}\n\nexport const View = ({ children, style, theme, ...rest }: Props) =\u003e {\n  const Component = \u003cRNView\n      // ...\n    /\u003e\n\n  return theme // Provide new theme context when needed\n    ? \u003cThemeProvider theme={theme}\u003e\u003cComponent /\u003e\u003c/ThemeProvider\u003e\n    : \u003cComponent /\u003e\n}\n```\n\n---\n\n## 🔧 Using Flow definitions \u0026 Setting up your .flowconfig\n\n**This package has `.js.flow` files to let Flow use type definitions. However, most projects ignore everything under `node_modules` to skip type-checking dependencies.**\n\nTo be able to use types included inside of packages, consider moving `\u003cPROJECT_ROOT\u003e/node_modules/.*` from `[ignore]` to `[untyped]` section. This way Flow can wak through the `node_modules` but exports as `any`.\n\nBest part is you don't need to generate empty definitions using [flow-typed create-stub](https://github.com/flow-typed/flow-typed/wiki/CLI-Commands-and-Flags#create-stub) anymore.\n\n\n### Edit your .flowconfig\n\n1. Remove `node_modules` from the `[ignore]` section:\n\n   ```ini\n   [ignore]\n   ; \u003cPROJECT_ROOT\u003e/node_modules/.* ; \u003c\u003c\u003c you should not need this\n   ```\n\n1. Add `node_modules` to `[untyped]` section:\n\n   ```ini\n   [untyped]\n   \u003cPROJECT_ROOT\u003e/node_modules/.* ; \u003c\u003c\u003c export every module as any by default\n   !\u003cPROJECT_ROOT\u003e/node_modules/react-dual-theme/.* ; \u003c\u003c\u003c exception\n   ```\n\n1. Add `react-dual-theme` to `[declarations]` section:\n\n   ```ini\n   [declarations]\n   \u003cPROJECT_ROOT\u003e/node_modules/react-dual-theme/.* ; \u003c\u003c\u003c use types from .flow.js files\n   ```\n1. Flow should be now able to get through the package typings.\n1. Profit 🎉\n\n---\n\n## 🚧 Typescript _(needs testing)_\n\nThis package includes TypeScript definition `index.d.ts` file.\n\n---\n\n## Licence: MIT\n\n [@martin_adamko](https://twitter.com/martin_adamko) 🐤\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fattitude%2Freact-dual-theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fattitude%2Freact-dual-theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fattitude%2Freact-dual-theme/lists"}