expo-dev-client-components 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +129 -0
  3. package/assets/branch-icon-light.png +0 -0
  4. package/assets/branch-icon-light@2x.png +0 -0
  5. package/assets/branch-icon-light@3x.png +0 -0
  6. package/assets/branch-icon.png +0 -0
  7. package/assets/branch-icon@2x.png +0 -0
  8. package/assets/branch-icon@3x.png +0 -0
  9. package/assets/check-icon-light.png +0 -0
  10. package/assets/check-icon-light@2x.png +0 -0
  11. package/assets/check-icon-light@3x.png +0 -0
  12. package/assets/check-icon.png +0 -0
  13. package/assets/check-icon@2x.png +0 -0
  14. package/assets/check-icon@3x.png +0 -0
  15. package/assets/clipboard-icon.png +0 -0
  16. package/assets/clipboard-icon@2x.png +0 -0
  17. package/assets/clipboard-icon@3x.png +0 -0
  18. package/assets/debug-icon.png +0 -0
  19. package/assets/debug-icon@2x.png +0 -0
  20. package/assets/debug-icon@3x.png +0 -0
  21. package/assets/extensions-filled-active-icon-light.png +0 -0
  22. package/assets/extensions-filled-active-icon-light@2x.png +0 -0
  23. package/assets/extensions-filled-active-icon-light@3x.png +0 -0
  24. package/assets/extensions-filled-active-icon.png +0 -0
  25. package/assets/extensions-filled-active-icon@2x.png +0 -0
  26. package/assets/extensions-filled-active-icon@3x.png +0 -0
  27. package/assets/extensions-filled-inactive-icon-light.png +0 -0
  28. package/assets/extensions-filled-inactive-icon-light@2x.png +0 -0
  29. package/assets/extensions-filled-inactive-icon-light@3x.png +0 -0
  30. package/assets/extensions-filled-inactive-icon.png +0 -0
  31. package/assets/extensions-filled-inactive-icon@2x.png +0 -0
  32. package/assets/extensions-filled-inactive-icon@3x.png +0 -0
  33. package/assets/extensions-icon-light.png +0 -0
  34. package/assets/extensions-icon-light@2x.png +0 -0
  35. package/assets/extensions-icon-light@3x.png +0 -0
  36. package/assets/extensions-icon.png +0 -0
  37. package/assets/extensions-icon@2x.png +0 -0
  38. package/assets/extensions-icon@3x.png +0 -0
  39. package/assets/home-filled-active-icon-light.png +0 -0
  40. package/assets/home-filled-active-icon-light@2x.png +0 -0
  41. package/assets/home-filled-active-icon-light@3x.png +0 -0
  42. package/assets/home-filled-inactive-icon-light.png +0 -0
  43. package/assets/home-filled-inactive-icon-light@2x.png +0 -0
  44. package/assets/home-filled-inactive-icon-light@3x.png +0 -0
  45. package/assets/info-icon-light.png +0 -0
  46. package/assets/info-icon-light@2x.png +0 -0
  47. package/assets/info-icon-light@3x.png +0 -0
  48. package/assets/info-icon.png +0 -0
  49. package/assets/info-icon@2x.png +0 -0
  50. package/assets/info-icon@3x.png +0 -0
  51. package/assets/inspect-element-icon.png +0 -0
  52. package/assets/inspect-element-icon@2x.png +0 -0
  53. package/assets/inspect-element-icon@3x.png +0 -0
  54. package/assets/loading-indicator-icon.png +0 -0
  55. package/assets/loading-indicator-icon@2x.png +0 -0
  56. package/assets/loading-indicator-icon@3x.png +0 -0
  57. package/assets/performance-icon.png +0 -0
  58. package/assets/performance-icon@2x.png +0 -0
  59. package/assets/performance-icon@3x.png +0 -0
  60. package/assets/run-icon.png +0 -0
  61. package/assets/run-icon@2x.png +0 -0
  62. package/assets/run-icon@3x.png +0 -0
  63. package/assets/settings-filled-active-icon-light.png +0 -0
  64. package/assets/settings-filled-active-icon-light@2x.png +0 -0
  65. package/assets/settings-filled-active-icon-light@3x.png +0 -0
  66. package/assets/settings-filled-inactive-icon-light.png +0 -0
  67. package/assets/settings-filled-inactive-icon-light@2x.png +0 -0
  68. package/assets/settings-filled-inactive-icon-light@3x.png +0 -0
  69. package/assets/shake-device-icon-light.png +0 -0
  70. package/assets/shake-device-icon-light@2x.png +0 -0
  71. package/assets/shake-device-icon-light@3x.png +0 -0
  72. package/assets/show-menu-at-launch-icon-light.png +0 -0
  73. package/assets/show-menu-at-launch-icon-light@2x.png +0 -0
  74. package/assets/show-menu-at-launch-icon-light@3x.png +0 -0
  75. package/assets/three-finger-long-press-icon-light.png +0 -0
  76. package/assets/three-finger-long-press-icon-light@2x.png +0 -0
  77. package/assets/three-finger-long-press-icon-light@3x.png +0 -0
  78. package/assets/update-icon-light.png +0 -0
  79. package/assets/update-icon-light@2x.png +0 -0
  80. package/assets/update-icon-light@3x.png +0 -0
  81. package/assets/update-icon.png +0 -0
  82. package/assets/update-icon@2x.png +0 -0
  83. package/assets/update-icon@3x.png +0 -0
  84. package/assets/user-icon-light.png +0 -0
  85. package/assets/user-icon-light@2x.png +0 -0
  86. package/assets/user-icon-light@3x.png +0 -0
  87. package/assets/warning-triangle-icon-light.png +0 -0
  88. package/assets/warning-triangle-icon-light@2x.png +0 -0
  89. package/assets/warning-triangle-icon-light@3x.png +0 -0
  90. package/assets/warning-triangle-icon.png +0 -0
  91. package/assets/warning-triangle-icon@2x.png +0 -0
  92. package/assets/warning-triangle-icon@3x.png +0 -0
  93. package/assets/x-icon-light.png +0 -0
  94. package/assets/x-icon-light@2x.png +0 -0
  95. package/assets/x-icon-light@3x.png +0 -0
  96. package/assets/x-icon.png +0 -0
  97. package/assets/x-icon@2x.png +0 -0
  98. package/assets/x-icon@3x.png +0 -0
  99. package/build/Button.d.ts +46 -22
  100. package/build/Button.d.ts.map +1 -0
  101. package/build/Button.js +4 -3
  102. package/build/Button.js.map +1 -1
  103. package/build/Image.d.ts +7 -1
  104. package/build/Image.d.ts.map +1 -0
  105. package/build/Image.js +1 -1
  106. package/build/Image.js.map +1 -1
  107. package/build/Text.d.ts +36 -10
  108. package/build/Text.d.ts.map +1 -0
  109. package/build/Text.js +30 -21
  110. package/build/Text.js.map +1 -1
  111. package/build/View.d.ts +80 -28
  112. package/build/View.d.ts.map +1 -0
  113. package/build/View.js +93 -43
  114. package/build/View.js.map +1 -1
  115. package/build/create-primitive.d.ts +41 -0
  116. package/build/create-primitive.d.ts.map +1 -0
  117. package/build/create-primitive.js +73 -0
  118. package/build/create-primitive.js.map +1 -0
  119. package/build/icons/BranchIcon.d.ts +4 -0
  120. package/build/icons/BranchIcon.d.ts.map +1 -0
  121. package/build/icons/BranchIcon.js +11 -0
  122. package/build/icons/BranchIcon.js.map +1 -0
  123. package/build/icons/CheckIcon.d.ts +1 -0
  124. package/build/icons/CheckIcon.d.ts.map +1 -0
  125. package/build/icons/CheckIcon.js +5 -1
  126. package/build/icons/CheckIcon.js.map +1 -1
  127. package/build/icons/ChevronRightIcon.d.ts +1 -0
  128. package/build/icons/ChevronRightIcon.d.ts.map +1 -0
  129. package/build/icons/ClipboardIcon.d.ts +4 -0
  130. package/build/icons/ClipboardIcon.d.ts.map +1 -0
  131. package/build/icons/ClipboardIcon.js +7 -0
  132. package/build/icons/ClipboardIcon.js.map +1 -0
  133. package/build/icons/DebugIcon.d.ts +4 -0
  134. package/build/icons/DebugIcon.d.ts.map +1 -0
  135. package/build/icons/DebugIcon.js +7 -0
  136. package/build/icons/DebugIcon.js.map +1 -0
  137. package/build/icons/ExpoLogoIcon.d.ts +1 -0
  138. package/build/icons/ExpoLogoIcon.d.ts.map +1 -0
  139. package/build/icons/ExtensionsFilledIcon.d.ts +8 -0
  140. package/build/icons/ExtensionsFilledIcon.d.ts.map +1 -0
  141. package/build/icons/ExtensionsFilledIcon.js +24 -0
  142. package/build/icons/ExtensionsFilledIcon.js.map +1 -0
  143. package/build/icons/ExtensionsIcon.d.ts +4 -0
  144. package/build/icons/ExtensionsIcon.d.ts.map +1 -0
  145. package/build/icons/ExtensionsIcon.js +11 -0
  146. package/build/icons/ExtensionsIcon.js.map +1 -0
  147. package/build/icons/HomeFilledIcon.d.ts +1 -0
  148. package/build/icons/HomeFilledIcon.d.ts.map +1 -0
  149. package/build/icons/HomeFilledIcon.js +16 -1
  150. package/build/icons/HomeFilledIcon.js.map +1 -1
  151. package/build/icons/InfoIcon.d.ts +1 -0
  152. package/build/icons/InfoIcon.d.ts.map +1 -0
  153. package/build/icons/InfoIcon.js +5 -1
  154. package/build/icons/InfoIcon.js.map +1 -1
  155. package/build/icons/InspectElementIcon.d.ts +4 -0
  156. package/build/icons/InspectElementIcon.d.ts.map +1 -0
  157. package/build/icons/InspectElementIcon.js +7 -0
  158. package/build/icons/InspectElementIcon.js.map +1 -0
  159. package/build/icons/LoadingIndicatorIcon.d.ts +4 -0
  160. package/build/icons/LoadingIndicatorIcon.d.ts.map +1 -0
  161. package/build/icons/LoadingIndicatorIcon.js +7 -0
  162. package/build/icons/LoadingIndicatorIcon.js.map +1 -0
  163. package/build/icons/PerformanceIcon.d.ts +4 -0
  164. package/build/icons/PerformanceIcon.d.ts.map +1 -0
  165. package/build/icons/PerformanceIcon.js +7 -0
  166. package/build/icons/PerformanceIcon.js.map +1 -0
  167. package/build/icons/QuestionMarkIcon.d.ts +1 -0
  168. package/build/icons/QuestionMarkIcon.d.ts.map +1 -0
  169. package/build/icons/RefreshIcon.d.ts +1 -0
  170. package/build/icons/RefreshIcon.d.ts.map +1 -0
  171. package/build/icons/RunIcon.d.ts +4 -0
  172. package/build/icons/RunIcon.d.ts.map +1 -0
  173. package/build/icons/RunIcon.js +7 -0
  174. package/build/icons/RunIcon.js.map +1 -0
  175. package/build/icons/SettingsFilledIcon.d.ts +1 -0
  176. package/build/icons/SettingsFilledIcon.d.ts.map +1 -0
  177. package/build/icons/SettingsFilledIcon.js +16 -1
  178. package/build/icons/SettingsFilledIcon.js.map +1 -1
  179. package/build/icons/ShakeDeviceIcon.d.ts +1 -0
  180. package/build/icons/ShakeDeviceIcon.d.ts.map +1 -0
  181. package/build/icons/ShakeDeviceIcon.js +5 -1
  182. package/build/icons/ShakeDeviceIcon.js.map +1 -1
  183. package/build/icons/ShowMenuIcon.d.ts +1 -0
  184. package/build/icons/ShowMenuIcon.d.ts.map +1 -0
  185. package/build/icons/ShowMenuIcon.js +5 -1
  186. package/build/icons/ShowMenuIcon.js.map +1 -1
  187. package/build/icons/TerminalIcon.d.ts +1 -0
  188. package/build/icons/TerminalIcon.d.ts.map +1 -0
  189. package/build/icons/ThreeFingerPressIcon.d.ts +1 -0
  190. package/build/icons/ThreeFingerPressIcon.d.ts.map +1 -0
  191. package/build/icons/ThreeFingerPressIcon.js +5 -1
  192. package/build/icons/ThreeFingerPressIcon.js.map +1 -1
  193. package/build/icons/ToolbarOverlayIcon.d.ts +1 -0
  194. package/build/icons/ToolbarOverlayIcon.d.ts.map +1 -0
  195. package/build/icons/UpdateIcon.d.ts +4 -0
  196. package/build/icons/UpdateIcon.d.ts.map +1 -0
  197. package/build/icons/UpdateIcon.js +11 -0
  198. package/build/icons/UpdateIcon.js.map +1 -0
  199. package/build/icons/UserIcon.d.ts +1 -0
  200. package/build/icons/UserIcon.d.ts.map +1 -0
  201. package/build/icons/UserIcon.js +5 -1
  202. package/build/icons/UserIcon.js.map +1 -1
  203. package/build/icons/WarningIcon.d.ts +4 -0
  204. package/build/icons/WarningIcon.d.ts.map +1 -0
  205. package/build/icons/WarningIcon.js +11 -0
  206. package/build/icons/WarningIcon.js.map +1 -0
  207. package/build/icons/XIcon.d.ts +1 -0
  208. package/build/icons/XIcon.d.ts.map +1 -0
  209. package/build/icons/XIcon.js +5 -1
  210. package/build/icons/XIcon.js.map +1 -1
  211. package/build/icons/index.d.ts +13 -1
  212. package/build/icons/index.d.ts.map +1 -0
  213. package/build/icons/index.js +12 -1
  214. package/build/icons/index.js.map +1 -1
  215. package/build/index.d.ts +1 -0
  216. package/build/index.d.ts.map +1 -0
  217. package/build/theme.d.ts +128 -131
  218. package/build/theme.d.ts.map +1 -0
  219. package/build/theme.js +77 -73
  220. package/build/theme.js.map +1 -1
  221. package/build/useExpoTheme.d.ts +236 -0
  222. package/build/useExpoTheme.d.ts.map +1 -0
  223. package/build/useExpoTheme.js +24 -3
  224. package/build/useExpoTheme.js.map +1 -1
  225. package/package.json +15 -9
  226. package/setupTests.js +35 -0
  227. package/src/Button.tsx +4 -3
  228. package/src/Image.tsx +1 -1
  229. package/src/Text.tsx +35 -21
  230. package/src/View.tsx +115 -44
  231. package/src/create-primitive.tsx +128 -0
  232. package/src/icons/BranchIcon.tsx +14 -0
  233. package/src/icons/CheckIcon.tsx +6 -1
  234. package/src/icons/ClipboardIcon.tsx +9 -0
  235. package/src/icons/DebugIcon.tsx +9 -0
  236. package/src/icons/ExtensionsFilledIcon.tsx +31 -0
  237. package/src/icons/ExtensionsIcon.tsx +14 -0
  238. package/src/icons/HomeFilledIcon.tsx +17 -1
  239. package/src/icons/InfoIcon.tsx +6 -1
  240. package/src/icons/InspectElementIcon.tsx +9 -0
  241. package/src/icons/LoadingIndicatorIcon.tsx +9 -0
  242. package/src/icons/PerformanceIcon.tsx +9 -0
  243. package/src/icons/RunIcon.tsx +9 -0
  244. package/src/icons/SettingsFilledIcon.tsx +17 -1
  245. package/src/icons/ShakeDeviceIcon.tsx +6 -1
  246. package/src/icons/ShowMenuIcon.tsx +6 -1
  247. package/src/icons/ThreeFingerPressIcon.tsx +6 -1
  248. package/src/icons/UpdateIcon.tsx +14 -0
  249. package/src/icons/UserIcon.tsx +6 -1
  250. package/src/icons/WarningIcon.tsx +14 -0
  251. package/src/icons/XIcon.tsx +6 -1
  252. package/src/icons/index.ts +12 -1
  253. package/src/theme.ts +90 -78
  254. package/src/useExpoTheme.tsx +50 -0
  255. package/src/useExpoTheme.ts +0 -14
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ import { Image } from '../Image';
4
+ import { useCurrentTheme } from '../useExpoTheme';
5
+
6
+ const lightIcon = require('../../assets/warning-triangle-icon-light.png');
7
+ const icon = require('../../assets/warning-triangle-icon.png');
8
+
9
+ export function WarningIcon(props: Partial<React.ComponentProps<typeof Image>>) {
10
+ const theme = useCurrentTheme();
11
+ const themedIcon = theme === 'dark' ? lightIcon : icon;
12
+
13
+ return <Image source={themedIcon} {...props} />;
14
+ }
@@ -1,9 +1,14 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import { Image } from '../Image';
4
+ import { useCurrentTheme } from '../useExpoTheme';
4
5
 
6
+ const lightIcon = require('../../assets/x-icon-light.png');
5
7
  const icon = require('../../assets/x-icon.png');
6
8
 
7
9
  export function XIcon(props: Partial<React.ComponentProps<typeof Image>>) {
8
- return <Image source={icon} {...props} />;
10
+ const theme = useCurrentTheme();
11
+ const themedIcon = theme === 'dark' ? lightIcon : icon;
12
+
13
+ return <Image source={themedIcon} {...props} />;
9
14
  }
@@ -1,15 +1,26 @@
1
+ export * from './BranchIcon';
1
2
  export * from './CheckIcon';
2
3
  export * from './ChevronRightIcon';
4
+ export * from './ClipboardIcon';
5
+ export * from './DebugIcon';
3
6
  export * from './ExpoLogoIcon';
7
+ export * from './ExtensionsIcon';
8
+ export * from './ExtensionsFilledIcon';
4
9
  export * from './HomeFilledIcon';
5
10
  export * from './InfoIcon';
11
+ export * from './InspectElementIcon';
12
+ export * from './LoadingIndicatorIcon';
13
+ export * from './PerformanceIcon';
6
14
  export * from './QuestionMarkIcon';
7
15
  export * from './RefreshIcon';
16
+ export * from './RunIcon';
17
+ export * from './SettingsFilledIcon';
8
18
  export * from './ShakeDeviceIcon';
9
19
  export * from './ShowMenuIcon';
10
- export * from './SettingsFilledIcon';
11
20
  export * from './TerminalIcon';
12
21
  export * from './ThreeFingerPressIcon';
13
22
  export * from './ToolbarOverlayIcon';
23
+ export * from './UpdateIcon';
14
24
  export * from './UserIcon';
25
+ export * from './WarningIcon';
15
26
  export * from './XIcon';
package/src/theme.ts CHANGED
@@ -1,71 +1,57 @@
1
- import { spacing, lightTheme, darkTheme, borderRadius } from '@expo/styleguide-native';
2
- import { TextStyle } from 'react-native';
1
+ import { spacing, lightTheme, darkTheme, borderRadius, typography } from '@expo/styleguide-native';
2
+ import { TextStyle, Platform, StyleSheet } from 'react-native';
3
3
 
4
- export const scale = {
4
+ type SpacingKey = `${keyof typeof spacing}`;
5
+ type DescriptiveScale = 'micro' | 'tiny' | 'small' | 'medium' | 'large' | 'xl';
6
+ type ScaleKey = SpacingKey | DescriptiveScale;
7
+ type Scale = Record<ScaleKey, number>;
8
+
9
+ export const scale: Scale = {
5
10
  micro: spacing[0.5],
6
11
  tiny: spacing[1],
7
12
  small: spacing[3],
8
13
  medium: spacing[4],
9
14
  large: spacing[6],
10
15
  xl: spacing[8],
16
+ ...spacing,
11
17
  };
12
18
 
13
- export const padding = {
14
- padding: {
15
- micro: { padding: scale.micro },
16
- tiny: { padding: scale.tiny },
17
- small: { padding: scale.small },
18
- medium: { padding: scale.medium },
19
- large: { padding: scale.large },
20
- xl: { padding: scale.xl },
21
- },
19
+ function fullSpacingScaleForAttributes(attributes: string[]) {
20
+ const obj: { [scaleKey: string]: any } = {};
22
21
 
23
- px: {
24
- micro: { paddingHorizontal: scale.micro },
25
- tiny: { paddingHorizontal: scale.tiny },
26
- small: { paddingHorizontal: scale.small },
27
- medium: { paddingHorizontal: scale.medium },
28
- large: { paddingHorizontal: scale.large },
29
- xl: { paddingHorizontal: scale.xl },
30
- },
22
+ Object.keys(scale).forEach((key) => {
23
+ key = `${key}`;
24
+ const value: { [attribute: string]: number } = {};
31
25
 
32
- py: {
33
- micro: { paddingVertical: scale.micro },
34
- tiny: { paddingVertical: scale.tiny },
35
- small: { paddingVertical: scale.small },
36
- medium: { paddingVertical: scale.medium },
37
- large: { paddingVertical: scale.large },
38
- xl: { paddingVertical: scale.xl },
39
- },
40
- };
26
+ attributes.forEach((attribute) => {
27
+ value[attribute] = scale[key as ScaleKey];
28
+ });
41
29
 
42
- export const margin = {
43
- margin: {
44
- micro: { margin: scale.micro },
45
- tiny: { margin: scale.tiny },
46
- small: { margin: scale.small },
47
- medium: { margin: scale.medium },
48
- large: { margin: scale.large },
49
- xl: { margin: scale.xl },
50
- },
30
+ obj[key] = value;
31
+ });
51
32
 
52
- mx: {
53
- micro: { marginHorizontal: scale.micro },
54
- tiny: { marginHorizontal: scale.tiny },
55
- small: { marginHorizontal: scale.small },
56
- medium: { marginHorizontal: scale.medium },
57
- large: { marginHorizontal: scale.large },
58
- },
33
+ return obj as Record<SpacingKey | DescriptiveScale, any>;
34
+ }
59
35
 
60
- my: {
61
- micro: { marginHorizontal: scale.micro },
62
- tiny: { marginVertical: scale.tiny },
63
- small: { marginVertical: scale.small },
64
- medium: { marginVertical: scale.medium },
65
- large: { marginVertical: scale.large },
66
- },
36
+ export const padding = {
37
+ padding: fullSpacingScaleForAttributes(['padding']),
38
+ px: fullSpacingScaleForAttributes(['paddingHorizontal']),
39
+ py: fullSpacingScaleForAttributes(['paddingVertical']),
40
+ pb: fullSpacingScaleForAttributes(['paddingBottom']),
41
+ pt: fullSpacingScaleForAttributes(['paddingTop']),
67
42
  };
68
43
 
44
+ export const margin = {
45
+ margin: fullSpacingScaleForAttributes(['margin']),
46
+ mx: fullSpacingScaleForAttributes(['marginHorizontal']),
47
+ my: fullSpacingScaleForAttributes(['marginVertical']),
48
+ mb: fullSpacingScaleForAttributes(['marginBottom']),
49
+ mt: fullSpacingScaleForAttributes(['marginTop']),
50
+ };
51
+
52
+ export const width = fullSpacingScaleForAttributes(['width']);
53
+ export const height = fullSpacingScaleForAttributes(['height']);
54
+
69
55
  export const rounded = {
70
56
  rounded: {
71
57
  none: { borderRadius: 0 },
@@ -110,18 +96,9 @@ export const text = {
110
96
  },
111
97
 
112
98
  size: {
113
- small: {
114
- fontSize: 12,
115
- lineHeight: 14,
116
- },
117
- medium: {
118
- fontSize: 16,
119
- lineHeight: 18,
120
- },
121
- large: {
122
- fontSize: 18,
123
- lineHeight: 24,
124
- },
99
+ small: typography.fontSizes[12],
100
+ medium: typography.fontSizes[16],
101
+ large: typography.fontSizes[18],
125
102
  },
126
103
 
127
104
  leading: {
@@ -130,20 +107,38 @@ export const text = {
130
107
 
131
108
  type: {
132
109
  mono: {
133
- fontFamily: 'Menlo',
110
+ fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace',
134
111
  },
112
+ InterBlack: { fontFamily: 'Inter-Black' },
113
+ InterBlackItalic: { fontFamily: 'Inter-BlackItalic' },
114
+ InterBold: { fontFamily: 'Inter-Bold' },
115
+ InterBoldItalic: { fontFamily: 'Inter-BoldItalic' },
116
+ InterExtraBold: { fontFamily: 'Inter-ExtraBold' },
117
+ InterExtraBoldItalic: { fontFamily: 'Inter-ExtraBoldItalic' },
118
+ InterExtraLight: { fontFamily: 'Inter-ExtraLight' },
119
+ InterExtraLightItalic: { fontFamily: 'Inter-ExtraLightItalic' },
120
+ InterRegular: { fontFamily: 'Inter-Regular' },
121
+ InterItalic: { fontFamily: 'Inter-Italic' },
122
+ InterLight: { fontFamily: 'Inter-Light' },
123
+ InterLightItalic: { fontFamily: 'Inter-LightItalic' },
124
+ InterMedium: { fontFamily: 'Inter-Medium' },
125
+ InterMediumItalic: { fontFamily: 'Inter-MediumItalic' },
126
+ InterSemiBold: { fontFamily: 'Inter-SemiBold' },
127
+ InterSemiBoldItalic: { fontFamily: 'Inter-SemiBoldItalic' },
128
+ InterThin: { fontFamily: 'Inter-Thin' },
129
+ InterThinItalic: { fontFamily: 'Inter-ThinItalic' },
135
130
  },
136
131
 
137
132
  weight: {
138
- thin: { fontWeight: '100' as TextStyle['fontWeight'] },
139
- extralight: { fontWeight: '200' as TextStyle['fontWeight'] },
140
- light: { fontWeight: '300' as TextStyle['fontWeight'] },
141
- normal: { fontWeight: '400' as TextStyle['fontWeight'] },
142
- medium: { fontWeight: '500' as TextStyle['fontWeight'] },
143
- semibold: { fontWeight: '600' as TextStyle['fontWeight'] },
144
- bold: { fontWeight: '700' as TextStyle['fontWeight'] },
145
- extrabold: { fontWeight: '800' as TextStyle['fontWeight'] },
146
- black: { fontWeight: '900' as TextStyle['fontWeight'] },
133
+ thin: { fontFamily: 'Inter-Thin' },
134
+ extralight: { fontFamily: 'Inter-ExtraLight' },
135
+ light: { fontFamily: 'Inter-Light' },
136
+ normal: { fontFamily: 'Inter-Regular' },
137
+ medium: { fontFamily: 'Inter-Medium' },
138
+ semibold: { fontFamily: 'Inter-SemiBold' },
139
+ bold: { fontFamily: 'Inter-Bold' },
140
+ extrabold: { fontFamily: 'Inter-ExtraBold' },
141
+ black: { fontFamily: 'Inter-Black' },
147
142
  },
148
143
 
149
144
  color: {
@@ -153,6 +148,7 @@ export const text = {
153
148
  success: { color: lightTheme.text.success },
154
149
  secondary: { color: lightTheme.text.secondary },
155
150
  primary: { color: lightTheme.button.primary.background },
151
+ link: { color: lightTheme.link.default },
156
152
  },
157
153
  };
158
154
 
@@ -168,6 +164,7 @@ export const textDark = {
168
164
  success: { color: darkTheme.text.success },
169
165
  secondary: { color: darkTheme.text.secondary },
170
166
  primary: { color: darkTheme.button.primary.background },
167
+ link: { color: darkTheme.link.default },
171
168
  },
172
169
  };
173
170
 
@@ -175,6 +172,7 @@ export const bg = {
175
172
  none: { backgroundColor: 'transparent' },
176
173
  default: { backgroundColor: lightTheme.background.default },
177
174
  secondary: { backgroundColor: lightTheme.background.secondary },
175
+ overlay: { backgroundColor: lightTheme.background.overlay },
178
176
  success: { backgroundColor: lightTheme.background.success },
179
177
  warning: { backgroundColor: lightTheme.background.warning },
180
178
  error: { backgroundColor: lightTheme.background.error },
@@ -183,6 +181,7 @@ export const bg = {
183
181
  export const bgDark = {
184
182
  default: { backgroundColor: darkTheme.background.default },
185
183
  secondary: { backgroundColor: darkTheme.background.secondary },
184
+ overlay: { backgroundColor: darkTheme.background.overlay },
186
185
  success: { backgroundColor: darkTheme.background.success },
187
186
  warning: { backgroundColor: darkTheme.background.warning },
188
187
  error: { backgroundColor: darkTheme.background.error },
@@ -204,7 +203,7 @@ export const lightNavigationTheme: NavigationTheme = {
204
203
  dark: false,
205
204
  colors: {
206
205
  primary: lightTheme.button.primary.background,
207
- background: lightTheme.background.secondary,
206
+ background: lightTheme.background.screen,
208
207
  card: lightTheme.background.default,
209
208
  text: lightTheme.text.default,
210
209
  border: lightTheme.border.default,
@@ -215,11 +214,24 @@ export const lightNavigationTheme: NavigationTheme = {
215
214
  export const darkNavigationTheme: NavigationTheme = {
216
215
  dark: true,
217
216
  colors: {
218
- primary: darkTheme.button.primary.background,
219
- background: darkTheme.background.secondary,
220
- card: darkTheme.background.default,
217
+ primary: darkTheme.link.default,
218
+ background: darkTheme.background.screen,
219
+ card: darkTheme.background.screen,
221
220
  text: darkTheme.text.default,
222
221
  border: darkTheme.border.default,
223
222
  notification: darkTheme.highlight.accent,
224
223
  },
225
224
  };
225
+
226
+ export const border = {
227
+ default: { borderColor: lightTheme.border.default, borderWidth: 1 },
228
+ warning: { borderColor: lightTheme.border.warning, borderWidth: 1 },
229
+ hairline: { borderColor: lightTheme.border.default, borderWidth: StyleSheet.hairlineWidth },
230
+ };
231
+
232
+ export const borderDark = {
233
+ default: { borderColor: darkTheme.border.default, borderWidth: 1 },
234
+ warning: { borderColor: darkTheme.border.warning, borderWidth: 1 },
235
+ error: { borderColor: darkTheme.border.error, borderWidth: 1 },
236
+ hairline: { borderColor: darkTheme.border.default, borderWidth: StyleSheet.hairlineWidth },
237
+ };
@@ -0,0 +1,50 @@
1
+ import { lightTheme, darkTheme, palette } from '@expo/styleguide-native';
2
+ import * as React from 'react';
3
+ import { useColorScheme } from 'react-native';
4
+
5
+ export type ThemePreference = 'light' | 'dark' | 'no-preference';
6
+ type Theme = 'light' | 'dark';
7
+
8
+ const ThemeContext = React.createContext<Theme>('light');
9
+ export const useTheme = () => React.useContext(ThemeContext);
10
+
11
+ type ThemeProviderProps = {
12
+ children: React.ReactNode;
13
+ themePreference?: ThemePreference;
14
+ };
15
+
16
+ export function ThemeProvider({ children, themePreference = 'no-preference' }: ThemeProviderProps) {
17
+ const systemTheme = useColorScheme();
18
+
19
+ const theme = React.useMemo(() => {
20
+ if (themePreference !== 'no-preference') {
21
+ return themePreference;
22
+ }
23
+
24
+ return systemTheme ?? 'light';
25
+ }, [themePreference, systemTheme]);
26
+
27
+ return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
28
+ }
29
+
30
+ type ExpoTheme = typeof lightTheme;
31
+
32
+ export function useCurrentTheme(): 'light' | 'dark' {
33
+ const theme = useTheme();
34
+ return theme;
35
+ }
36
+
37
+ export function useExpoTheme(): ExpoTheme {
38
+ const theme = useTheme();
39
+
40
+ if (theme === 'dark') {
41
+ return darkTheme;
42
+ }
43
+
44
+ return lightTheme;
45
+ }
46
+
47
+ export function useExpoPalette() {
48
+ const theme = useTheme();
49
+ return palette[theme];
50
+ }
@@ -1,14 +0,0 @@
1
- import { lightTheme, darkTheme } from '@expo/styleguide-native';
2
- import { useColorScheme } from 'react-native';
3
-
4
- type ExpoTheme = typeof lightTheme;
5
-
6
- export function useExpoTheme(): ExpoTheme {
7
- const colorScheme = useColorScheme();
8
-
9
- if (colorScheme === 'dark') {
10
- return darkTheme;
11
- }
12
-
13
- return lightTheme;
14
- }