Skip to content

Commit

Permalink
Merge branch 'main' into spike/302-ColorTokensInStorybook
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicawoodin committed Jul 10, 2024
2 parents 8e339f8 + f9bd30f commit 09308a4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
9 changes: 5 additions & 4 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@department-of-veterans-affairs/mobile-component-library",
"version": "0.19.2-alpha.0",
"version": "0.20.2",
"description": "VA Design System Mobile Component Library",
"main": "src/index.tsx",
"scripts": {
Expand Down Expand Up @@ -39,16 +39,15 @@
},
"homepage": "https://department-of-veterans-affairs.github.io/va-mobile-library",
"dependencies": {
"@department-of-veterans-affairs/mobile-assets": "0.12.0",
"@department-of-veterans-affairs/mobile-tokens": "0.13.0",
"@os-team/i18next-react-native-language-detector": "^1.0.31",
"i18next": "^23.11.5",
"react-i18next": "^14.1.2",
"react-native-svg": "15.2.0",
"styled-components": "^6.1.8"
},
"peerDependencies": {
"@department-of-veterans-affairs/mobile-assets": "*",
"@department-of-veterans-affairs/mobile-assets": "^0.12.0",
"@department-of-veterans-affairs/mobile-tokens": "^0.13.0",
"react": "^18.2.0",
"react-native": ">=0.71.7",
"react-native-gesture-handler": "^2.12.0"
Expand All @@ -58,6 +57,8 @@
"@babel/plugin-transform-react-jsx": "^7.23.4",
"@babel/preset-env": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@department-of-veterans-affairs/mobile-assets": "0.12.0",
"@department-of-veterans-affairs/mobile-tokens": "0.13.0",
"@expo/metro-runtime": "~3.2.1",
"@expo/webpack-config": "~19.0.1",
"@react-native-async-storage/async-storage": "1.23.1",
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ export { Link } from './components/Link/Link'
export { LoadingIndicator } from './components/LoadingIndicator/LoadingIndicator'
export { SegmentedControl } from './components/SegmentedControl/SegmentedControl'
export { Spacer } from './components/Spacer/Spacer'

// Export consumer available utilities here so they are exported through npm
export { useTheme } from './utils'
8 changes: 5 additions & 3 deletions packages/components/src/utils/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Namespace import is required. Destructuring causes error in va-mobile-app See #390.
import * as Tokens from '@department-of-veterans-affairs/mobile-tokens'

import {
AccessibilityInfo,
ColorSchemeName,
Expand All @@ -6,7 +9,6 @@ import {
StyleProp,
ViewStyle,
} from 'react-native'
import { Theme, themes } from '@department-of-veterans-affairs/mobile-tokens'
import { useEffect, useState } from 'react'

/** Function to prefill base gray colors */
Expand All @@ -32,9 +34,9 @@ export function useColorScheme(): ColorSchemeName {
}

/** Returns light/dark theme based on useColorScheme */
export function useTheme(): Theme {
export function useTheme(): Tokens.Theme {
const themeName: ColorSchemeName = useColorScheme() || 'light'
return themes[themeName]
return Tokens.themes[themeName]
}

/**
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2202,7 +2202,8 @@ __metadata:
ts-jest: "npm:^29.1.2"
typescript: "npm:^5.3.3"
peerDependencies:
"@department-of-veterans-affairs/mobile-assets": "*"
"@department-of-veterans-affairs/mobile-assets": ^0.12.0
"@department-of-veterans-affairs/mobile-tokens": ^0.13.0
react: ^18.2.0
react-native: ">=0.71.7"
react-native-gesture-handler: ^2.12.0
Expand Down

0 comments on commit 09308a4

Please sign in to comment.