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
package/src/View.tsx
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { lightTheme, darkTheme, shadows
|
|
2
|
-
import { View as RNView } from 'react-native';
|
|
3
|
-
import { create } from 'react-native-primitives';
|
|
1
|
+
import { lightTheme, darkTheme, shadows } from '@expo/styleguide-native';
|
|
2
|
+
import { View as RNView, StyleSheet } from 'react-native';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import { create } from './create-primitive';
|
|
5
|
+
import {
|
|
6
|
+
scale,
|
|
7
|
+
padding,
|
|
8
|
+
margin,
|
|
9
|
+
rounded,
|
|
10
|
+
bg,
|
|
11
|
+
bgDark,
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
borderDark,
|
|
15
|
+
border,
|
|
16
|
+
} from './theme';
|
|
6
17
|
|
|
7
18
|
export const View = create(RNView, {
|
|
8
19
|
variants: {
|
|
@@ -17,6 +28,9 @@ export const View = create(RNView, {
|
|
|
17
28
|
justifyContent: 'center',
|
|
18
29
|
alignItems: 'center',
|
|
19
30
|
},
|
|
31
|
+
start: {
|
|
32
|
+
alignItems: 'flex-start',
|
|
33
|
+
},
|
|
20
34
|
},
|
|
21
35
|
|
|
22
36
|
flex: {
|
|
@@ -29,10 +43,49 @@ export const View = create(RNView, {
|
|
|
29
43
|
'0': { flexShrink: 0 },
|
|
30
44
|
},
|
|
31
45
|
|
|
46
|
+
grow: {
|
|
47
|
+
'1': { flexGrow: 1 },
|
|
48
|
+
'0': { flexGrow: 0 },
|
|
49
|
+
},
|
|
50
|
+
|
|
32
51
|
bg,
|
|
33
52
|
|
|
53
|
+
opacity: {
|
|
54
|
+
'1': { opacity: 1 },
|
|
55
|
+
'0.5': { opacity: 0.5 },
|
|
56
|
+
'0.75': { opacity: 0.75 },
|
|
57
|
+
'0': { opacity: 0 },
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
inset: {
|
|
61
|
+
top: {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
bottom: {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
bottom: 0,
|
|
71
|
+
left: 0,
|
|
72
|
+
right: 0,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
full: {
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
top: 0,
|
|
78
|
+
left: 0,
|
|
79
|
+
right: 0,
|
|
80
|
+
bottom: 0,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
|
|
34
84
|
border: {
|
|
35
85
|
default: { borderColor: lightTheme.border.default, borderWidth: 1 },
|
|
86
|
+
hairline: { borderColor: lightTheme.border.default, borderWidth: StyleSheet.hairlineWidth },
|
|
87
|
+
warning: { borderColor: lightTheme.border.warning, borderWidth: 1 },
|
|
88
|
+
error: { borderColor: lightTheme.border.error, borderWidth: 1 },
|
|
36
89
|
},
|
|
37
90
|
|
|
38
91
|
...rounded,
|
|
@@ -45,23 +98,8 @@ export const View = create(RNView, {
|
|
|
45
98
|
button: shadows.button,
|
|
46
99
|
},
|
|
47
100
|
|
|
48
|
-
width
|
|
49
|
-
|
|
50
|
-
tiny: { width: iconSize.tiny },
|
|
51
|
-
small: { width: iconSize.small },
|
|
52
|
-
medium: { width: iconSize.regular },
|
|
53
|
-
large: { width: iconSize.large },
|
|
54
|
-
xl: { width: scale.xl },
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
height: {
|
|
58
|
-
micro: { height: iconSize.micro },
|
|
59
|
-
tiny: { height: iconSize.tiny },
|
|
60
|
-
small: { height: iconSize.small },
|
|
61
|
-
medium: { height: iconSize.regular },
|
|
62
|
-
large: { height: iconSize.large },
|
|
63
|
-
xl: { height: scale.xl },
|
|
64
|
-
},
|
|
101
|
+
width,
|
|
102
|
+
height,
|
|
65
103
|
|
|
66
104
|
...padding,
|
|
67
105
|
...margin,
|
|
@@ -71,9 +109,7 @@ export const View = create(RNView, {
|
|
|
71
109
|
dark: {
|
|
72
110
|
bg: bgDark,
|
|
73
111
|
|
|
74
|
-
border:
|
|
75
|
-
default: { borderColor: darkTheme.border.default, borderWidth: 1 },
|
|
76
|
-
},
|
|
112
|
+
border: borderDark,
|
|
77
113
|
},
|
|
78
114
|
|
|
79
115
|
light: {
|
|
@@ -90,47 +126,79 @@ export const Row = create(RNView, {
|
|
|
90
126
|
variants: {
|
|
91
127
|
bg,
|
|
92
128
|
|
|
129
|
+
flex: {
|
|
130
|
+
'1': { flex: 1 },
|
|
131
|
+
'0': { flex: 0 },
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
shrink: {
|
|
135
|
+
'1': { flexShrink: 1 },
|
|
136
|
+
'0': { flexShrink: 0 },
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
grow: {
|
|
140
|
+
'1': { flexGrow: 1 },
|
|
141
|
+
'0': { flexGrow: 0 },
|
|
142
|
+
},
|
|
143
|
+
|
|
93
144
|
align: {
|
|
94
145
|
center: { alignItems: 'center' },
|
|
95
146
|
start: { alignItems: 'flex-start' },
|
|
96
147
|
end: { alignItems: 'flex-end' },
|
|
97
148
|
},
|
|
98
149
|
|
|
150
|
+
justify: {
|
|
151
|
+
center: { justifyContent: 'center' },
|
|
152
|
+
start: { justifyContent: 'flex-start' },
|
|
153
|
+
end: { justifyContent: 'flex-end' },
|
|
154
|
+
between: { justifyContent: 'space-between' },
|
|
155
|
+
around: { justifyContent: 'space-around' },
|
|
156
|
+
},
|
|
157
|
+
|
|
99
158
|
...padding,
|
|
100
159
|
...margin,
|
|
160
|
+
|
|
161
|
+
...rounded,
|
|
162
|
+
|
|
163
|
+
border,
|
|
101
164
|
},
|
|
102
165
|
|
|
103
166
|
selectors: {
|
|
104
167
|
dark: {
|
|
105
168
|
bg: bgDark,
|
|
169
|
+
border: borderDark,
|
|
106
170
|
},
|
|
107
171
|
},
|
|
108
172
|
});
|
|
109
173
|
|
|
110
174
|
const Horizontal = create(RNView, {
|
|
175
|
+
base: {
|
|
176
|
+
flex: 1,
|
|
177
|
+
},
|
|
111
178
|
variants: {
|
|
112
179
|
size: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
xl: { width: scale.xl },
|
|
180
|
+
micro: { width: scale.micro, flex: 0 },
|
|
181
|
+
tiny: { width: scale.tiny, flex: 0 },
|
|
182
|
+
small: { width: scale.small, flex: 0 },
|
|
183
|
+
medium: { width: scale.medium, flex: 0 },
|
|
184
|
+
large: { width: scale.large, flex: 0 },
|
|
185
|
+
xl: { width: scale.xl, flex: 0 },
|
|
120
186
|
},
|
|
121
187
|
},
|
|
122
188
|
});
|
|
123
189
|
|
|
124
190
|
const Vertical = create(RNView, {
|
|
191
|
+
base: {
|
|
192
|
+
flex: 1,
|
|
193
|
+
},
|
|
125
194
|
variants: {
|
|
126
195
|
size: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
xl: { height: scale.xl },
|
|
196
|
+
micro: { height: scale.micro, flex: 0 },
|
|
197
|
+
tiny: { height: scale.tiny, flex: 0 },
|
|
198
|
+
small: { height: scale.small, flex: 0 },
|
|
199
|
+
medium: { height: scale.medium, flex: 0 },
|
|
200
|
+
large: { height: scale.large, flex: 0 },
|
|
201
|
+
xl: { height: scale.xl, flex: 0 },
|
|
134
202
|
},
|
|
135
203
|
},
|
|
136
204
|
});
|
|
@@ -142,15 +210,15 @@ export const Spacer = {
|
|
|
142
210
|
|
|
143
211
|
export const Divider = create(RNView, {
|
|
144
212
|
base: {
|
|
145
|
-
|
|
146
|
-
|
|
213
|
+
height: StyleSheet.hairlineWidth,
|
|
214
|
+
backgroundColor: lightTheme.border.default,
|
|
147
215
|
},
|
|
148
216
|
|
|
149
217
|
variants: {
|
|
150
218
|
weight: {
|
|
151
|
-
thin: {
|
|
152
|
-
normal: {
|
|
153
|
-
heavy: {
|
|
219
|
+
thin: { height: StyleSheet.hairlineWidth },
|
|
220
|
+
normal: { height: 1 },
|
|
221
|
+
heavy: { height: 2 },
|
|
154
222
|
},
|
|
155
223
|
|
|
156
224
|
...margin,
|
|
@@ -158,7 +226,10 @@ export const Divider = create(RNView, {
|
|
|
158
226
|
|
|
159
227
|
selectors: {
|
|
160
228
|
dark: {
|
|
161
|
-
|
|
229
|
+
base: {
|
|
230
|
+
height: StyleSheet.hairlineWidth,
|
|
231
|
+
backgroundColor: darkTheme.border.default,
|
|
232
|
+
},
|
|
162
233
|
},
|
|
163
234
|
},
|
|
164
235
|
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet, ViewStyle, ImageStyle, TextStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from './useExpoTheme';
|
|
5
|
+
|
|
6
|
+
type StyleType = ViewStyle | TextStyle | ImageStyle;
|
|
7
|
+
|
|
8
|
+
type Options = {
|
|
9
|
+
base?: StyleType;
|
|
10
|
+
variants?: VariantMap<StyleType>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type VariantMap<T> = { [key: string]: { [key: string]: T } };
|
|
14
|
+
|
|
15
|
+
type Nested<Type> = {
|
|
16
|
+
[Property in keyof Type]?: keyof Type[Property];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type SelectorMap<Variants> = Partial<{
|
|
20
|
+
[K in keyof Variants]?: {
|
|
21
|
+
[T in keyof Variants[K]]?: StyleType;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
type Selectors<Variants> = {
|
|
26
|
+
light?: SelectorMap<Variants>;
|
|
27
|
+
dark?: SelectorMap<Variants>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type SelectorProps = {
|
|
31
|
+
light?: StyleType;
|
|
32
|
+
dark?: StyleType;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export function create<T, O extends Options>(
|
|
36
|
+
component: React.ComponentType<T>,
|
|
37
|
+
config: O & { selectors?: Selectors<O['variants']>; props?: T }
|
|
38
|
+
) {
|
|
39
|
+
config.selectors = config.selectors ?? {};
|
|
40
|
+
config.variants = config.variants ?? {};
|
|
41
|
+
|
|
42
|
+
const Component = React.forwardRef<
|
|
43
|
+
T,
|
|
44
|
+
React.PropsWithChildren<T> & Nested<typeof config['variants']> & { selectors?: SelectorProps }
|
|
45
|
+
>((props, ref) => {
|
|
46
|
+
const theme = useTheme();
|
|
47
|
+
|
|
48
|
+
const variantStyles = stylesForVariants(props, config.variants);
|
|
49
|
+
const selectorStyles = stylesForSelectors(props, config.selectors, { theme });
|
|
50
|
+
const selectorPropsStyles = stylesForSelectorProps(props.selectors, { theme });
|
|
51
|
+
|
|
52
|
+
const variantFreeProps: any = { ...props };
|
|
53
|
+
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
// there could be a conflict between the primitive prop and the variant name
|
|
56
|
+
// for example - variant name "width" and prop "width"
|
|
57
|
+
// in these cases, favor the variant because it is under the users control (e.g they can update the conflicting name)
|
|
58
|
+
|
|
59
|
+
Object.keys(config.variants).forEach((variant) => {
|
|
60
|
+
delete variantFreeProps[variant];
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return React.createElement(component, {
|
|
64
|
+
...config.props,
|
|
65
|
+
...variantFreeProps,
|
|
66
|
+
style: StyleSheet.flatten([
|
|
67
|
+
config.base,
|
|
68
|
+
variantStyles,
|
|
69
|
+
selectorStyles,
|
|
70
|
+
selectorPropsStyles,
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
props.style || {},
|
|
73
|
+
]),
|
|
74
|
+
ref,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return Component;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function stylesForVariants(props: any, variants: any = {}) {
|
|
82
|
+
let styles = {};
|
|
83
|
+
|
|
84
|
+
for (const key in props) {
|
|
85
|
+
if (variants[key]) {
|
|
86
|
+
const value = props[key];
|
|
87
|
+
|
|
88
|
+
const styleValue = variants[key][value];
|
|
89
|
+
if (styleValue) {
|
|
90
|
+
styles = StyleSheet.flatten(StyleSheet.compose(styles, styleValue));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return styles;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function stylesForSelectors(props: any, selectors: any = {}, state: any = {}) {
|
|
99
|
+
const styles: any[] = [];
|
|
100
|
+
|
|
101
|
+
if (state.theme != null) {
|
|
102
|
+
if (selectors[state.theme] != null) {
|
|
103
|
+
const variants = selectors[state.theme];
|
|
104
|
+
const variantStyles = stylesForVariants(props, variants);
|
|
105
|
+
|
|
106
|
+
if (variants.base != null) {
|
|
107
|
+
styles.push(variants.base);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
styles.push(variantStyles);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return StyleSheet.flatten(styles);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function stylesForSelectorProps(selectors: any = {}, state: any = {}) {
|
|
118
|
+
const styles: any[] = [];
|
|
119
|
+
|
|
120
|
+
if (state.theme != null) {
|
|
121
|
+
if (selectors[state.theme] != null) {
|
|
122
|
+
const selectorStyles = selectors[state.theme];
|
|
123
|
+
styles.push(selectorStyles);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return StyleSheet.flatten(styles);
|
|
128
|
+
}
|
|
@@ -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/branch-icon-light.png');
|
|
7
|
+
const icon = require('../../assets/branch-icon.png');
|
|
8
|
+
|
|
9
|
+
export function BranchIcon(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/CheckIcon.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/check-icon-light.png');
|
|
5
7
|
const icon = require('../../assets/check-icon.png');
|
|
6
8
|
|
|
7
9
|
export function CheckIcon(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
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Image } from '../Image';
|
|
4
|
+
|
|
5
|
+
const icon = require('../../assets/clipboard-icon.png');
|
|
6
|
+
|
|
7
|
+
export function ClipboardIcon(props: Partial<React.ComponentProps<typeof Image>>) {
|
|
8
|
+
return <Image source={icon} {...props} />;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Image } from '../Image';
|
|
4
|
+
import { useCurrentTheme } from '../useExpoTheme';
|
|
5
|
+
|
|
6
|
+
const activeLightIcon = require('../../assets/extensions-filled-active-icon-light.png');
|
|
7
|
+
const activeIcon = require('../../assets/extensions-filled-active-icon.png');
|
|
8
|
+
const inactiveLightIcon = require('../../assets/extensions-filled-inactive-icon-light.png');
|
|
9
|
+
const inactiveIcon = require('../../assets/extensions-filled-inactive-icon.png');
|
|
10
|
+
|
|
11
|
+
const iconMap = {
|
|
12
|
+
light: {
|
|
13
|
+
active: activeIcon,
|
|
14
|
+
inactive: inactiveIcon,
|
|
15
|
+
},
|
|
16
|
+
dark: {
|
|
17
|
+
active: activeLightIcon,
|
|
18
|
+
inactive: inactiveLightIcon,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type TabBarIconProps = Partial<React.ComponentProps<typeof Image>> & {
|
|
23
|
+
focused?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function ExtensionsFilledIcon(props: TabBarIconProps) {
|
|
27
|
+
const theme = useCurrentTheme();
|
|
28
|
+
const themedIcon = iconMap[theme];
|
|
29
|
+
const icon = props.focused ? themedIcon.active : themedIcon.inactive;
|
|
30
|
+
return <Image source={icon} {...props} />;
|
|
31
|
+
}
|
|
@@ -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/extensions-icon-light.png');
|
|
7
|
+
const icon = require('../../assets/extensions-icon.png');
|
|
8
|
+
|
|
9
|
+
export function ExtensionsIcon(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,15 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import { Image } from '../Image';
|
|
4
|
+
import { useCurrentTheme } from '../useExpoTheme';
|
|
4
5
|
|
|
6
|
+
const activeLightIcon = require('../../assets/home-filled-active-icon-light.png');
|
|
5
7
|
const activeIcon = require('../../assets/home-filled-active-icon.png');
|
|
8
|
+
const inactiveLightIcon = require('../../assets/home-filled-inactive-icon-light.png');
|
|
6
9
|
const inactiveIcon = require('../../assets/home-filled-inactive-icon.png');
|
|
7
10
|
|
|
11
|
+
const iconMap = {
|
|
12
|
+
light: {
|
|
13
|
+
active: activeIcon,
|
|
14
|
+
inactive: inactiveIcon,
|
|
15
|
+
},
|
|
16
|
+
dark: {
|
|
17
|
+
active: activeLightIcon,
|
|
18
|
+
inactive: inactiveLightIcon,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
8
22
|
type TabBarIconProps = Partial<React.ComponentProps<typeof Image>> & {
|
|
9
23
|
focused?: boolean;
|
|
10
24
|
};
|
|
11
25
|
|
|
12
26
|
export function HomeFilledIcon(props: TabBarIconProps) {
|
|
13
|
-
const
|
|
27
|
+
const theme = useCurrentTheme();
|
|
28
|
+
const themedIcon = iconMap[theme];
|
|
29
|
+
const icon = props.focused ? themedIcon.active : themedIcon.inactive;
|
|
14
30
|
return <Image source={icon} {...props} />;
|
|
15
31
|
}
|
package/src/icons/InfoIcon.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/info-icon-light.png');
|
|
5
7
|
const icon = require('../../assets/info-icon.png');
|
|
6
8
|
|
|
7
9
|
export function InfoIcon(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
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Image } from '../Image';
|
|
4
|
+
|
|
5
|
+
const icon = require('../../assets/inspect-element-icon.png');
|
|
6
|
+
|
|
7
|
+
export function InspectElementIcon(props: Partial<React.ComponentProps<typeof Image>>) {
|
|
8
|
+
return <Image source={icon} {...props} />;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Image } from '../Image';
|
|
4
|
+
|
|
5
|
+
const icon = require('../../assets/loading-indicator-icon.png');
|
|
6
|
+
|
|
7
|
+
export function LoadingIndicatorIcon(props: Partial<React.ComponentProps<typeof Image>>) {
|
|
8
|
+
return <Image source={icon} {...props} />;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Image } from '../Image';
|
|
4
|
+
|
|
5
|
+
const icon = require('../../assets/performance-icon.png');
|
|
6
|
+
|
|
7
|
+
export function PerformanceIcon(props: Partial<React.ComponentProps<typeof Image>>) {
|
|
8
|
+
return <Image source={icon} {...props} />;
|
|
9
|
+
}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import { Image } from '../Image';
|
|
4
|
+
import { useCurrentTheme } from '../useExpoTheme';
|
|
4
5
|
|
|
6
|
+
const activeLightIcon = require('../../assets/settings-filled-active-icon-light.png');
|
|
5
7
|
const activeIcon = require('../../assets/settings-filled-active-icon.png');
|
|
8
|
+
const inactiveLightIcon = require('../../assets/settings-filled-inactive-icon-light.png');
|
|
6
9
|
const inactiveIcon = require('../../assets/settings-filled-inactive-icon.png');
|
|
7
10
|
|
|
11
|
+
const iconMap = {
|
|
12
|
+
light: {
|
|
13
|
+
active: activeIcon,
|
|
14
|
+
inactive: inactiveIcon,
|
|
15
|
+
},
|
|
16
|
+
dark: {
|
|
17
|
+
active: activeLightIcon,
|
|
18
|
+
inactive: inactiveLightIcon,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
8
22
|
type TabBarIconProps = Partial<React.ComponentProps<typeof Image>> & {
|
|
9
23
|
focused?: boolean;
|
|
10
24
|
};
|
|
11
25
|
|
|
12
26
|
export function SettingsFilledIcon(props: TabBarIconProps) {
|
|
13
|
-
const
|
|
27
|
+
const theme = useCurrentTheme();
|
|
28
|
+
const themedIcon = iconMap[theme];
|
|
29
|
+
const icon = props.focused ? themedIcon.active : themedIcon.inactive;
|
|
14
30
|
return <Image source={icon} {...props} />;
|
|
15
31
|
}
|
|
@@ -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/shake-device-icon-light.png');
|
|
5
7
|
const icon = require('../../assets/shake-device-icon.png');
|
|
6
8
|
|
|
7
9
|
export function ShakeDeviceIcon(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
|
}
|
|
@@ -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/show-menu-at-launch-icon-light.png');
|
|
5
7
|
const icon = require('../../assets/show-menu-at-launch-icon.png');
|
|
6
8
|
|
|
7
9
|
export function ShowMenuIcon(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
|
}
|
|
@@ -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/three-finger-long-press-icon-light.png');
|
|
5
7
|
const icon = require('../../assets/three-finger-long-press-icon.png');
|
|
6
8
|
|
|
7
9
|
export function ThreeFingerPressIcon(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
|
}
|
|
@@ -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/update-icon-light.png');
|
|
7
|
+
const icon = require('../../assets/update-icon.png');
|
|
8
|
+
|
|
9
|
+
export function UpdateIcon(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/UserIcon.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/user-icon-light.png');
|
|
5
7
|
const icon = require('../../assets/user-icon.png');
|
|
6
8
|
|
|
7
9
|
export function UserIcon(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
|
}
|