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.
- package/CHANGELOG.md +6 -0
- package/README.md +129 -0
- package/assets/branch-icon-light.png +0 -0
- package/assets/branch-icon-light@2x.png +0 -0
- package/assets/branch-icon-light@3x.png +0 -0
- package/assets/branch-icon.png +0 -0
- package/assets/branch-icon@2x.png +0 -0
- package/assets/branch-icon@3x.png +0 -0
- package/assets/check-icon-light.png +0 -0
- package/assets/check-icon-light@2x.png +0 -0
- package/assets/check-icon-light@3x.png +0 -0
- package/assets/check-icon.png +0 -0
- package/assets/check-icon@2x.png +0 -0
- package/assets/check-icon@3x.png +0 -0
- package/assets/clipboard-icon.png +0 -0
- package/assets/clipboard-icon@2x.png +0 -0
- package/assets/clipboard-icon@3x.png +0 -0
- package/assets/debug-icon.png +0 -0
- package/assets/debug-icon@2x.png +0 -0
- package/assets/debug-icon@3x.png +0 -0
- package/assets/extensions-filled-active-icon-light.png +0 -0
- package/assets/extensions-filled-active-icon-light@2x.png +0 -0
- package/assets/extensions-filled-active-icon-light@3x.png +0 -0
- package/assets/extensions-filled-active-icon.png +0 -0
- package/assets/extensions-filled-active-icon@2x.png +0 -0
- package/assets/extensions-filled-active-icon@3x.png +0 -0
- package/assets/extensions-filled-inactive-icon-light.png +0 -0
- package/assets/extensions-filled-inactive-icon-light@2x.png +0 -0
- package/assets/extensions-filled-inactive-icon-light@3x.png +0 -0
- package/assets/extensions-filled-inactive-icon.png +0 -0
- package/assets/extensions-filled-inactive-icon@2x.png +0 -0
- package/assets/extensions-filled-inactive-icon@3x.png +0 -0
- package/assets/extensions-icon-light.png +0 -0
- package/assets/extensions-icon-light@2x.png +0 -0
- package/assets/extensions-icon-light@3x.png +0 -0
- package/assets/extensions-icon.png +0 -0
- package/assets/extensions-icon@2x.png +0 -0
- package/assets/extensions-icon@3x.png +0 -0
- package/assets/home-filled-active-icon-light.png +0 -0
- package/assets/home-filled-active-icon-light@2x.png +0 -0
- package/assets/home-filled-active-icon-light@3x.png +0 -0
- package/assets/home-filled-inactive-icon-light.png +0 -0
- package/assets/home-filled-inactive-icon-light@2x.png +0 -0
- package/assets/home-filled-inactive-icon-light@3x.png +0 -0
- package/assets/info-icon-light.png +0 -0
- package/assets/info-icon-light@2x.png +0 -0
- package/assets/info-icon-light@3x.png +0 -0
- package/assets/info-icon.png +0 -0
- package/assets/info-icon@2x.png +0 -0
- package/assets/info-icon@3x.png +0 -0
- package/assets/inspect-element-icon.png +0 -0
- package/assets/inspect-element-icon@2x.png +0 -0
- package/assets/inspect-element-icon@3x.png +0 -0
- package/assets/loading-indicator-icon.png +0 -0
- package/assets/loading-indicator-icon@2x.png +0 -0
- package/assets/loading-indicator-icon@3x.png +0 -0
- package/assets/performance-icon.png +0 -0
- package/assets/performance-icon@2x.png +0 -0
- package/assets/performance-icon@3x.png +0 -0
- package/assets/run-icon.png +0 -0
- package/assets/run-icon@2x.png +0 -0
- package/assets/run-icon@3x.png +0 -0
- package/assets/settings-filled-active-icon-light.png +0 -0
- package/assets/settings-filled-active-icon-light@2x.png +0 -0
- package/assets/settings-filled-active-icon-light@3x.png +0 -0
- package/assets/settings-filled-inactive-icon-light.png +0 -0
- package/assets/settings-filled-inactive-icon-light@2x.png +0 -0
- package/assets/settings-filled-inactive-icon-light@3x.png +0 -0
- package/assets/shake-device-icon-light.png +0 -0
- package/assets/shake-device-icon-light@2x.png +0 -0
- package/assets/shake-device-icon-light@3x.png +0 -0
- package/assets/show-menu-at-launch-icon-light.png +0 -0
- package/assets/show-menu-at-launch-icon-light@2x.png +0 -0
- package/assets/show-menu-at-launch-icon-light@3x.png +0 -0
- package/assets/three-finger-long-press-icon-light.png +0 -0
- package/assets/three-finger-long-press-icon-light@2x.png +0 -0
- package/assets/three-finger-long-press-icon-light@3x.png +0 -0
- package/assets/update-icon-light.png +0 -0
- package/assets/update-icon-light@2x.png +0 -0
- package/assets/update-icon-light@3x.png +0 -0
- package/assets/update-icon.png +0 -0
- package/assets/update-icon@2x.png +0 -0
- package/assets/update-icon@3x.png +0 -0
- package/assets/user-icon-light.png +0 -0
- package/assets/user-icon-light@2x.png +0 -0
- package/assets/user-icon-light@3x.png +0 -0
- package/assets/warning-triangle-icon-light.png +0 -0
- package/assets/warning-triangle-icon-light@2x.png +0 -0
- package/assets/warning-triangle-icon-light@3x.png +0 -0
- package/assets/warning-triangle-icon.png +0 -0
- package/assets/warning-triangle-icon@2x.png +0 -0
- package/assets/warning-triangle-icon@3x.png +0 -0
- package/assets/x-icon-light.png +0 -0
- package/assets/x-icon-light@2x.png +0 -0
- package/assets/x-icon-light@3x.png +0 -0
- package/assets/x-icon.png +0 -0
- package/assets/x-icon@2x.png +0 -0
- package/assets/x-icon@3x.png +0 -0
- package/build/Button.d.ts +46 -22
- package/build/Button.d.ts.map +1 -0
- package/build/Button.js +4 -3
- package/build/Button.js.map +1 -1
- package/build/Image.d.ts +7 -1
- package/build/Image.d.ts.map +1 -0
- package/build/Image.js +1 -1
- package/build/Image.js.map +1 -1
- package/build/Text.d.ts +36 -10
- package/build/Text.d.ts.map +1 -0
- package/build/Text.js +30 -21
- package/build/Text.js.map +1 -1
- package/build/View.d.ts +80 -28
- package/build/View.d.ts.map +1 -0
- package/build/View.js +93 -43
- package/build/View.js.map +1 -1
- package/build/create-primitive.d.ts +41 -0
- package/build/create-primitive.d.ts.map +1 -0
- package/build/create-primitive.js +73 -0
- package/build/create-primitive.js.map +1 -0
- package/build/icons/BranchIcon.d.ts +4 -0
- package/build/icons/BranchIcon.d.ts.map +1 -0
- package/build/icons/BranchIcon.js +11 -0
- package/build/icons/BranchIcon.js.map +1 -0
- package/build/icons/CheckIcon.d.ts +1 -0
- package/build/icons/CheckIcon.d.ts.map +1 -0
- package/build/icons/CheckIcon.js +5 -1
- package/build/icons/CheckIcon.js.map +1 -1
- package/build/icons/ChevronRightIcon.d.ts +1 -0
- package/build/icons/ChevronRightIcon.d.ts.map +1 -0
- package/build/icons/ClipboardIcon.d.ts +4 -0
- package/build/icons/ClipboardIcon.d.ts.map +1 -0
- package/build/icons/ClipboardIcon.js +7 -0
- package/build/icons/ClipboardIcon.js.map +1 -0
- package/build/icons/DebugIcon.d.ts +4 -0
- package/build/icons/DebugIcon.d.ts.map +1 -0
- package/build/icons/DebugIcon.js +7 -0
- package/build/icons/DebugIcon.js.map +1 -0
- package/build/icons/ExpoLogoIcon.d.ts +1 -0
- package/build/icons/ExpoLogoIcon.d.ts.map +1 -0
- package/build/icons/ExtensionsFilledIcon.d.ts +8 -0
- package/build/icons/ExtensionsFilledIcon.d.ts.map +1 -0
- package/build/icons/ExtensionsFilledIcon.js +24 -0
- package/build/icons/ExtensionsFilledIcon.js.map +1 -0
- package/build/icons/ExtensionsIcon.d.ts +4 -0
- package/build/icons/ExtensionsIcon.d.ts.map +1 -0
- package/build/icons/ExtensionsIcon.js +11 -0
- package/build/icons/ExtensionsIcon.js.map +1 -0
- package/build/icons/HomeFilledIcon.d.ts +1 -0
- package/build/icons/HomeFilledIcon.d.ts.map +1 -0
- package/build/icons/HomeFilledIcon.js +16 -1
- package/build/icons/HomeFilledIcon.js.map +1 -1
- package/build/icons/InfoIcon.d.ts +1 -0
- package/build/icons/InfoIcon.d.ts.map +1 -0
- package/build/icons/InfoIcon.js +5 -1
- package/build/icons/InfoIcon.js.map +1 -1
- package/build/icons/InspectElementIcon.d.ts +4 -0
- package/build/icons/InspectElementIcon.d.ts.map +1 -0
- package/build/icons/InspectElementIcon.js +7 -0
- package/build/icons/InspectElementIcon.js.map +1 -0
- package/build/icons/LoadingIndicatorIcon.d.ts +4 -0
- package/build/icons/LoadingIndicatorIcon.d.ts.map +1 -0
- package/build/icons/LoadingIndicatorIcon.js +7 -0
- package/build/icons/LoadingIndicatorIcon.js.map +1 -0
- package/build/icons/PerformanceIcon.d.ts +4 -0
- package/build/icons/PerformanceIcon.d.ts.map +1 -0
- package/build/icons/PerformanceIcon.js +7 -0
- package/build/icons/PerformanceIcon.js.map +1 -0
- package/build/icons/QuestionMarkIcon.d.ts +1 -0
- package/build/icons/QuestionMarkIcon.d.ts.map +1 -0
- package/build/icons/RefreshIcon.d.ts +1 -0
- package/build/icons/RefreshIcon.d.ts.map +1 -0
- package/build/icons/RunIcon.d.ts +4 -0
- package/build/icons/RunIcon.d.ts.map +1 -0
- package/build/icons/RunIcon.js +7 -0
- package/build/icons/RunIcon.js.map +1 -0
- package/build/icons/SettingsFilledIcon.d.ts +1 -0
- package/build/icons/SettingsFilledIcon.d.ts.map +1 -0
- package/build/icons/SettingsFilledIcon.js +16 -1
- package/build/icons/SettingsFilledIcon.js.map +1 -1
- package/build/icons/ShakeDeviceIcon.d.ts +1 -0
- package/build/icons/ShakeDeviceIcon.d.ts.map +1 -0
- package/build/icons/ShakeDeviceIcon.js +5 -1
- package/build/icons/ShakeDeviceIcon.js.map +1 -1
- package/build/icons/ShowMenuIcon.d.ts +1 -0
- package/build/icons/ShowMenuIcon.d.ts.map +1 -0
- package/build/icons/ShowMenuIcon.js +5 -1
- package/build/icons/ShowMenuIcon.js.map +1 -1
- package/build/icons/TerminalIcon.d.ts +1 -0
- package/build/icons/TerminalIcon.d.ts.map +1 -0
- package/build/icons/ThreeFingerPressIcon.d.ts +1 -0
- package/build/icons/ThreeFingerPressIcon.d.ts.map +1 -0
- package/build/icons/ThreeFingerPressIcon.js +5 -1
- package/build/icons/ThreeFingerPressIcon.js.map +1 -1
- package/build/icons/ToolbarOverlayIcon.d.ts +1 -0
- package/build/icons/ToolbarOverlayIcon.d.ts.map +1 -0
- package/build/icons/UpdateIcon.d.ts +4 -0
- package/build/icons/UpdateIcon.d.ts.map +1 -0
- package/build/icons/UpdateIcon.js +11 -0
- package/build/icons/UpdateIcon.js.map +1 -0
- package/build/icons/UserIcon.d.ts +1 -0
- package/build/icons/UserIcon.d.ts.map +1 -0
- package/build/icons/UserIcon.js +5 -1
- package/build/icons/UserIcon.js.map +1 -1
- package/build/icons/WarningIcon.d.ts +4 -0
- package/build/icons/WarningIcon.d.ts.map +1 -0
- package/build/icons/WarningIcon.js +11 -0
- package/build/icons/WarningIcon.js.map +1 -0
- package/build/icons/XIcon.d.ts +1 -0
- package/build/icons/XIcon.d.ts.map +1 -0
- package/build/icons/XIcon.js +5 -1
- package/build/icons/XIcon.js.map +1 -1
- package/build/icons/index.d.ts +13 -1
- package/build/icons/index.d.ts.map +1 -0
- package/build/icons/index.js +12 -1
- package/build/icons/index.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/theme.d.ts +128 -131
- package/build/theme.d.ts.map +1 -0
- package/build/theme.js +77 -73
- package/build/theme.js.map +1 -1
- package/build/useExpoTheme.d.ts +236 -0
- package/build/useExpoTheme.d.ts.map +1 -0
- package/build/useExpoTheme.js +24 -3
- package/build/useExpoTheme.js.map +1 -1
- package/package.json +15 -9
- package/setupTests.js +35 -0
- package/src/Button.tsx +4 -3
- package/src/Image.tsx +1 -1
- package/src/Text.tsx +35 -21
- package/src/View.tsx +115 -44
- package/src/create-primitive.tsx +128 -0
- package/src/icons/BranchIcon.tsx +14 -0
- package/src/icons/CheckIcon.tsx +6 -1
- package/src/icons/ClipboardIcon.tsx +9 -0
- package/src/icons/DebugIcon.tsx +9 -0
- package/src/icons/ExtensionsFilledIcon.tsx +31 -0
- package/src/icons/ExtensionsIcon.tsx +14 -0
- package/src/icons/HomeFilledIcon.tsx +17 -1
- package/src/icons/InfoIcon.tsx +6 -1
- package/src/icons/InspectElementIcon.tsx +9 -0
- package/src/icons/LoadingIndicatorIcon.tsx +9 -0
- package/src/icons/PerformanceIcon.tsx +9 -0
- package/src/icons/RunIcon.tsx +9 -0
- package/src/icons/SettingsFilledIcon.tsx +17 -1
- package/src/icons/ShakeDeviceIcon.tsx +6 -1
- package/src/icons/ShowMenuIcon.tsx +6 -1
- package/src/icons/ThreeFingerPressIcon.tsx +6 -1
- package/src/icons/UpdateIcon.tsx +14 -0
- package/src/icons/UserIcon.tsx +6 -1
- package/src/icons/WarningIcon.tsx +14 -0
- package/src/icons/XIcon.tsx +6 -1
- package/src/icons/index.ts +12 -1
- package/src/theme.ts +90 -78
- package/src/useExpoTheme.tsx +50 -0
- 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
|
+
}
|
package/src/icons/XIcon.tsx
CHANGED
|
@@ -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
|
-
|
|
10
|
+
const theme = useCurrentTheme();
|
|
11
|
+
const themedIcon = theme === 'dark' ? lightIcon : icon;
|
|
12
|
+
|
|
13
|
+
return <Image source={themedIcon} {...props} />;
|
|
9
14
|
}
|
package/src/icons/index.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
14
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
43
|
-
|
|
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
|
-
|
|
53
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
115
|
-
|
|
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: {
|
|
139
|
-
extralight: {
|
|
140
|
-
light: {
|
|
141
|
-
normal: {
|
|
142
|
-
medium: {
|
|
143
|
-
semibold: {
|
|
144
|
-
bold: {
|
|
145
|
-
extrabold: {
|
|
146
|
-
black: {
|
|
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.
|
|
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.
|
|
219
|
-
background: darkTheme.background.
|
|
220
|
-
card: darkTheme.background.
|
|
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
|
+
}
|
package/src/useExpoTheme.ts
DELETED
|
@@ -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
|
-
}
|