expo-dev-client-components 3.0.8-canary-20251120-e46b3cc → 3.0.8
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 +2 -2
- package/build/Button.d.ts.map +1 -1
- package/build/Button.js +1 -2
- package/build/Button.js.map +1 -1
- package/build/useExpoTheme.d.ts +1 -1
- package/build/useExpoTheme.d.ts.map +1 -1
- package/build/useExpoTheme.js +3 -3
- package/build/useExpoTheme.js.map +1 -1
- package/package.json +4 -3
- package/src/Button.tsx +1 -2
- package/src/useExpoTheme.tsx +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## 3.0.8 — 2025-12-05
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
16
|
|
|
17
17
|
## 3.0.7 — 2025-09-11
|
|
18
18
|
|
package/build/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,QAAQ,EAIT,MAAM,cAAc,CAAC;AAkDtB,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;kJAqDb,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKlB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAkCF,iBAAS,oBAAoB,CAAC,EAC5B,aAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,oBAAoB,qBAgC/D;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,QAAQ,EAIT,MAAM,cAAc,CAAC;AAkDtB,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;kJAqDb,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKlB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAkCF,iBAAS,oBAAoB,CAAC,EAC5B,aAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,oBAAoB,qBAgC/D;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,qBA2B/E"}
|
package/build/Button.js
CHANGED
|
@@ -141,8 +141,7 @@ function FadeOnPressContainer({ activeOpacity = 0.2, ...props }) {
|
|
|
141
141
|
</Container>);
|
|
142
142
|
}
|
|
143
143
|
function HighlightOnPressContainer(props) {
|
|
144
|
-
const
|
|
145
|
-
const theme = systemTheme !== 'unspecified' ? systemTheme : 'light';
|
|
144
|
+
const theme = useColorScheme();
|
|
146
145
|
const [isPressing, setIsPressing] = React.useState(false);
|
|
147
146
|
const onPressIn = React.useCallback(() => {
|
|
148
147
|
setIsPressing(true);
|
package/build/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAA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AC,CAAC;IAEP,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,eAAe,GAAG,aAAa,CAAC;IAEpC,IAAI,KAAK,CAAC,EAAE,IAAI,UAAU,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC5C,eAAe,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,aAAa,GAAG;QACpB,eAAe;KAChB,CAAC;IAEF,OAAO,CACL,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,CAAC,CACjE;MAAA,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,IAAI,CACtE;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { lightTheme, darkTheme, borderRadius, shadows, palette } from '@expo/styleguide-native';\nimport * as React from 'react';\nimport {\n Text as RNText,\n Animated,\n useColorScheme,\n Pressable as RNPressable,\n Easing,\n} from 'react-native';\n\nimport { create } from './create-primitive';\nimport { rounded, margin, padding, text } from './theme';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(RNPressable);\n\nconst Text = create(RNText, {\n base: {\n fontFamily: 'Inter-Regular',\n color: lightTheme.text.default,\n fontSize: 16,\n lineHeight: 22,\n },\n\n props: {\n accessibilityRole: 'text',\n },\n\n variants: {\n ...text,\n\n color: {\n primary: { color: lightTheme.button.primary.foreground },\n secondary: { color: lightTheme.button.secondary.foreground },\n tertiary: { color: lightTheme.button.tertiary.foreground },\n ghost: { color: lightTheme.button.ghost.foreground },\n transparent: { color: lightTheme.button.transparent.foreground },\n default: { color: lightTheme.text.default },\n },\n },\n\n selectors: {\n dark: {\n base: {\n color: darkTheme.text.default,\n },\n\n color: {\n primary: { color: darkTheme.button.primary.foreground },\n secondary: { color: darkTheme.button.secondary.foreground },\n tertiary: { color: darkTheme.button.tertiary.foreground },\n ghost: { color: darkTheme.button.ghost.foreground },\n transparent: { color: darkTheme.button.transparent.foreground },\n default: { color: darkTheme.text.default },\n },\n },\n },\n});\n\nconst Container = create(AnimatedPressable, {\n base: {\n overflow: 'hidden',\n borderRadius: borderRadius.medium,\n },\n\n props: {\n accessibilityRole: 'button',\n android_disableSound: true,\n },\n\n variants: {\n bg: {\n default: { backgroundColor: lightTheme.background.default },\n primary: { backgroundColor: lightTheme.button.primary.background },\n secondary: { backgroundColor: lightTheme.button.secondary.background },\n tertiary: { backgroundColor: lightTheme.button.tertiary.background },\n ghost: { backgroundColor: lightTheme.button.ghost.background },\n transparent: { backgroundColor: lightTheme.button.transparent.background },\n disabled: { backgroundColor: lightTheme.status.default },\n },\n\n border: {\n ghost: { borderColor: lightTheme.button.ghost.border, borderWidth: 1 },\n },\n\n shadow: {\n button: shadows.button,\n },\n\n flex: {\n '1': { flex: 1 },\n '0': { flex: 0 },\n },\n\n ...rounded,\n ...padding,\n ...margin,\n },\n\n selectors: {\n dark: {\n bg: {\n default: { backgroundColor: darkTheme.background.default },\n primary: { backgroundColor: darkTheme.button.primary.background },\n secondary: { backgroundColor: darkTheme.button.secondary.background },\n tertiary: { backgroundColor: darkTheme.button.tertiary.background },\n ghost: { backgroundColor: darkTheme.button.ghost.background },\n transparent: { backgroundColor: darkTheme.button.transparent.background },\n disabled: { backgroundColor: darkTheme.status.default },\n },\n },\n },\n});\n\nexport const Button = {\n Container,\n FadeOnPressContainer,\n HighlightOnPressContainer,\n Text,\n};\n\ntype FadingPressableProps = {\n activeOpacity?: number;\n};\n\ntype NoOptionals<T> = {\n [P in keyof T]-?: T[P];\n};\n\ntype ContainerProps = React.ComponentProps<typeof Container>;\ntype ContainerBackgroundColors = NoOptionals<ContainerProps>['bg'];\n\nconst lightHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: lightTheme.background.secondary,\n primary: lightTheme.background.tertiary,\n secondary: lightTheme.background.quaternary,\n tertiary: palette.light.gray[600],\n ghost: lightTheme.background.tertiary,\n transparent: lightTheme.background.secondary,\n};\n\nconst darkHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: darkTheme.background.secondary,\n primary: darkTheme.background.tertiary,\n secondary: darkTheme.background.quaternary,\n tertiary: palette.dark.gray[600],\n ghost: darkTheme.background.tertiary,\n transparent: darkTheme.background.secondary,\n};\n\nconst highlightColorMap = {\n dark: darkHighlightColorMap,\n light: lightHighlightColorMap,\n};\n\nfunction FadeOnPressContainer({\n activeOpacity = 0.2,\n ...props\n}: React.ComponentProps<typeof Container> & FadingPressableProps) {\n const animatedValue = React.useRef(new Animated.Value(1));\n\n const onPressIn = React.useCallback(() => {\n Animated.timing(animatedValue.current, {\n toValue: activeOpacity,\n duration: 150,\n easing: Easing.inOut(Easing.quad),\n useNativeDriver: true,\n }).start();\n }, []);\n\n const onPressOut = React.useCallback(() => {\n Animated.timing(animatedValue.current, {\n toValue: 1,\n duration: 150,\n easing: Easing.inOut(Easing.quad),\n useNativeDriver: true,\n }).start();\n }, []);\n\n return (\n <Container\n onPressIn={onPressIn}\n onPressOut={onPressOut}\n {...props}\n style={{\n opacity: animatedValue.current,\n }}>\n {props.children}\n </Container>\n );\n}\n\nfunction HighlightOnPressContainer(props: React.ComponentProps<typeof Container>) {\n const systemTheme = useColorScheme();\n const theme = systemTheme !== 'unspecified' ? systemTheme : 'light';\n const [isPressing, setIsPressing] = React.useState(false);\n\n const onPressIn = React.useCallback(() => {\n setIsPressing(true);\n }, []);\n\n const onPressOut = React.useCallback(() => {\n setIsPressing(false);\n }, []);\n\n let backgroundColor = 'transparent';\n\n if (props.bg && isPressing && theme != null) {\n backgroundColor = highlightColorMap[theme][props.bg];\n }\n\n const underlayStyle = {\n backgroundColor,\n };\n\n return (\n <Container onPressIn={onPressIn} onPressOut={onPressOut} {...props}>\n <Animated.View style={underlayStyle}>{props.children}</Animated.View>\n </Container>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,IAAI,MAAM,EACd,QAAQ,EACR,cAAc,EACd,SAAS,IAAI,WAAW,EACxB,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,iBAAiB,GAAG,QAAQ,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;AAExE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE;IAC1B,IAAI,EAAE;QACJ,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO;QAC9B,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;IAED,KAAK,EAAE;QACL,iBAAiB,EAAE,MAAM;KAC1B;IAED,QAAQ,EAAE;QACR,GAAG,IAAI;QAEP,KAAK,EAAE;YACL,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE;YACxD,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE;YAC5D,QAAQ,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,CAA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B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACvC,aAAa,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,aAAa,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,eAAe,GAAG,aAAa,CAAC;IAEpC,IAAI,KAAK,CAAC,EAAE,IAAI,UAAU,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC5C,eAAe,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,aAAa,GAAG;QACpB,eAAe;KAChB,CAAC;IAEF,OAAO,CACL,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,CAAC,CACjE;MAAA,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,IAAI,CACtE;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { lightTheme, darkTheme, borderRadius, shadows, palette } from '@expo/styleguide-native';\nimport * as React from 'react';\nimport {\n Text as RNText,\n Animated,\n useColorScheme,\n Pressable as RNPressable,\n Easing,\n} from 'react-native';\n\nimport { create } from './create-primitive';\nimport { rounded, margin, padding, text } from './theme';\n\nconst AnimatedPressable = Animated.createAnimatedComponent(RNPressable);\n\nconst Text = create(RNText, {\n base: {\n fontFamily: 'Inter-Regular',\n color: lightTheme.text.default,\n fontSize: 16,\n lineHeight: 22,\n },\n\n props: {\n accessibilityRole: 'text',\n },\n\n variants: {\n ...text,\n\n color: {\n primary: { color: lightTheme.button.primary.foreground },\n secondary: { color: lightTheme.button.secondary.foreground },\n tertiary: { color: lightTheme.button.tertiary.foreground },\n ghost: { color: lightTheme.button.ghost.foreground },\n transparent: { color: lightTheme.button.transparent.foreground },\n default: { color: lightTheme.text.default },\n },\n },\n\n selectors: {\n dark: {\n base: {\n color: darkTheme.text.default,\n },\n\n color: {\n primary: { color: darkTheme.button.primary.foreground },\n secondary: { color: darkTheme.button.secondary.foreground },\n tertiary: { color: darkTheme.button.tertiary.foreground },\n ghost: { color: darkTheme.button.ghost.foreground },\n transparent: { color: darkTheme.button.transparent.foreground },\n default: { color: darkTheme.text.default },\n },\n },\n },\n});\n\nconst Container = create(AnimatedPressable, {\n base: {\n overflow: 'hidden',\n borderRadius: borderRadius.medium,\n },\n\n props: {\n accessibilityRole: 'button',\n android_disableSound: true,\n },\n\n variants: {\n bg: {\n default: { backgroundColor: lightTheme.background.default },\n primary: { backgroundColor: lightTheme.button.primary.background },\n secondary: { backgroundColor: lightTheme.button.secondary.background },\n tertiary: { backgroundColor: lightTheme.button.tertiary.background },\n ghost: { backgroundColor: lightTheme.button.ghost.background },\n transparent: { backgroundColor: lightTheme.button.transparent.background },\n disabled: { backgroundColor: lightTheme.status.default },\n },\n\n border: {\n ghost: { borderColor: lightTheme.button.ghost.border, borderWidth: 1 },\n },\n\n shadow: {\n button: shadows.button,\n },\n\n flex: {\n '1': { flex: 1 },\n '0': { flex: 0 },\n },\n\n ...rounded,\n ...padding,\n ...margin,\n },\n\n selectors: {\n dark: {\n bg: {\n default: { backgroundColor: darkTheme.background.default },\n primary: { backgroundColor: darkTheme.button.primary.background },\n secondary: { backgroundColor: darkTheme.button.secondary.background },\n tertiary: { backgroundColor: darkTheme.button.tertiary.background },\n ghost: { backgroundColor: darkTheme.button.ghost.background },\n transparent: { backgroundColor: darkTheme.button.transparent.background },\n disabled: { backgroundColor: darkTheme.status.default },\n },\n },\n },\n});\n\nexport const Button = {\n Container,\n FadeOnPressContainer,\n HighlightOnPressContainer,\n Text,\n};\n\ntype FadingPressableProps = {\n activeOpacity?: number;\n};\n\ntype NoOptionals<T> = {\n [P in keyof T]-?: T[P];\n};\n\ntype ContainerProps = React.ComponentProps<typeof Container>;\ntype ContainerBackgroundColors = NoOptionals<ContainerProps>['bg'];\n\nconst lightHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: lightTheme.background.secondary,\n primary: lightTheme.background.tertiary,\n secondary: lightTheme.background.quaternary,\n tertiary: palette.light.gray[600],\n ghost: lightTheme.background.tertiary,\n transparent: lightTheme.background.secondary,\n};\n\nconst darkHighlightColorMap: Record<ContainerBackgroundColors, string> = {\n disabled: 'transparent',\n default: darkTheme.background.secondary,\n primary: darkTheme.background.tertiary,\n secondary: darkTheme.background.quaternary,\n tertiary: palette.dark.gray[600],\n ghost: darkTheme.background.tertiary,\n transparent: darkTheme.background.secondary,\n};\n\nconst highlightColorMap = {\n dark: darkHighlightColorMap,\n light: lightHighlightColorMap,\n};\n\nfunction FadeOnPressContainer({\n activeOpacity = 0.2,\n ...props\n}: React.ComponentProps<typeof Container> & FadingPressableProps) {\n const animatedValue = React.useRef(new Animated.Value(1));\n\n const onPressIn = React.useCallback(() => {\n Animated.timing(animatedValue.current, {\n toValue: activeOpacity,\n duration: 150,\n easing: Easing.inOut(Easing.quad),\n useNativeDriver: true,\n }).start();\n }, []);\n\n const onPressOut = React.useCallback(() => {\n Animated.timing(animatedValue.current, {\n toValue: 1,\n duration: 150,\n easing: Easing.inOut(Easing.quad),\n useNativeDriver: true,\n }).start();\n }, []);\n\n return (\n <Container\n onPressIn={onPressIn}\n onPressOut={onPressOut}\n {...props}\n style={{\n opacity: animatedValue.current,\n }}>\n {props.children}\n </Container>\n );\n}\n\nfunction HighlightOnPressContainer(props: React.ComponentProps<typeof Container>) {\n const theme = useColorScheme();\n const [isPressing, setIsPressing] = React.useState(false);\n\n const onPressIn = React.useCallback(() => {\n setIsPressing(true);\n }, []);\n\n const onPressOut = React.useCallback(() => {\n setIsPressing(false);\n }, []);\n\n let backgroundColor = 'transparent';\n\n if (props.bg && isPressing && theme != null) {\n backgroundColor = highlightColorMap[theme][props.bg];\n }\n\n const underlayStyle = {\n backgroundColor,\n };\n\n return (\n <Container onPressIn={onPressIn} onPressOut={onPressOut} {...props}>\n <Animated.View style={underlayStyle}>{props.children}</Animated.View>\n </Container>\n );\n}\n"]}
|
package/build/useExpoTheme.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { lightTheme } from '@expo/styleguide-native';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export type ThemePreference = 'light' | 'dark' | '
|
|
3
|
+
export type ThemePreference = 'light' | 'dark' | 'no-preference';
|
|
4
4
|
type Theme = 'light' | 'dark';
|
|
5
5
|
export declare const useTheme: () => Theme;
|
|
6
6
|
type ThemeProviderProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExpoTheme.d.ts","sourceRoot":"","sources":["../src/useExpoTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"useExpoTheme.d.ts","sourceRoot":"","sources":["../src/useExpoTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,CAAC;AACjE,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAG9B,eAAO,MAAM,QAAQ,aAAuC,CAAC;AAE7D,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,eAAiC,EAAE,EAAE,kBAAkB,qBAYhG;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC;AAE1C,wBAAgB,eAAe,IAAI,OAAO,GAAG,MAAM,CAGlD;AAED,wBAAgB,YAAY,IAAI,SAAS,CAQxC;AAED,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7B"}
|
package/build/useExpoTheme.js
CHANGED
|
@@ -3,13 +3,13 @@ import * as React from 'react';
|
|
|
3
3
|
import { useColorScheme } from 'react-native';
|
|
4
4
|
const ThemeContext = React.createContext('light');
|
|
5
5
|
export const useTheme = () => React.useContext(ThemeContext);
|
|
6
|
-
export function ThemeProvider({ children, themePreference = '
|
|
6
|
+
export function ThemeProvider({ children, themePreference = 'no-preference' }) {
|
|
7
7
|
const systemTheme = useColorScheme();
|
|
8
8
|
const theme = React.useMemo(() => {
|
|
9
|
-
if (themePreference !== '
|
|
9
|
+
if (themePreference !== 'no-preference') {
|
|
10
10
|
return themePreference;
|
|
11
11
|
}
|
|
12
|
-
return systemTheme
|
|
12
|
+
return systemTheme ?? 'light';
|
|
13
13
|
}, [themePreference, systemTheme]);
|
|
14
14
|
return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExpoTheme.js","sourceRoot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CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;AACjF,CAAC;AAID,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import { lightTheme, darkTheme, palette } from '@expo/styleguide-native';\nimport * as React from 'react';\nimport { useColorScheme } from 'react-native';\n\nexport type ThemePreference = 'light' | 'dark' | 'no-preference';\ntype Theme = 'light' | 'dark';\n\nconst ThemeContext = React.createContext<Theme>('light');\nexport const useTheme = () => React.useContext(ThemeContext);\n\ntype ThemeProviderProps = {\n children: React.ReactNode;\n themePreference?: ThemePreference;\n};\n\nexport function ThemeProvider({ children, themePreference = 'no-preference' }: ThemeProviderProps) {\n const systemTheme = useColorScheme();\n\n const theme = React.useMemo(() => {\n if (themePreference !== 'no-preference') {\n return themePreference;\n }\n\n return systemTheme ?? 'light';\n }, [themePreference, systemTheme]);\n\n return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;\n}\n\nexport type ExpoTheme = typeof lightTheme;\n\nexport function useCurrentTheme(): 'light' | 'dark' {\n const theme = useTheme();\n return theme;\n}\n\nexport function useExpoTheme(): ExpoTheme {\n const theme = useTheme();\n\n if (theme === 'dark') {\n return darkTheme;\n }\n\n return lightTheme;\n}\n\nexport function useExpoPalette() {\n const theme = useTheme();\n return palette[theme];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-dev-client-components",
|
|
3
|
-
"version": "3.0.8
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Shared JS components and configuration for expo-dev-client",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"homepage": "https://docs.expo.dev",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@expo/styleguide-native": "^1.0.1",
|
|
32
|
-
"expo-module-scripts": "5.
|
|
32
|
+
"expo-module-scripts": "^5.0.8"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@testing-library/react-native": "^13.2.0"
|
|
@@ -43,5 +43,6 @@
|
|
|
43
43
|
"setupFilesAfterEnv": [
|
|
44
44
|
"./setupTests.js"
|
|
45
45
|
]
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "172a69f5f70c1d0e043e1532f924de97210cabc3"
|
|
47
48
|
}
|
package/src/Button.tsx
CHANGED
|
@@ -192,8 +192,7 @@ function FadeOnPressContainer({
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
function HighlightOnPressContainer(props: React.ComponentProps<typeof Container>) {
|
|
195
|
-
const
|
|
196
|
-
const theme = systemTheme !== 'unspecified' ? systemTheme : 'light';
|
|
195
|
+
const theme = useColorScheme();
|
|
197
196
|
const [isPressing, setIsPressing] = React.useState(false);
|
|
198
197
|
|
|
199
198
|
const onPressIn = React.useCallback(() => {
|
package/src/useExpoTheme.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { lightTheme, darkTheme, palette } from '@expo/styleguide-native';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useColorScheme } from 'react-native';
|
|
4
4
|
|
|
5
|
-
export type ThemePreference = 'light' | 'dark' | '
|
|
5
|
+
export type ThemePreference = 'light' | 'dark' | 'no-preference';
|
|
6
6
|
type Theme = 'light' | 'dark';
|
|
7
7
|
|
|
8
8
|
const ThemeContext = React.createContext<Theme>('light');
|
|
@@ -13,15 +13,15 @@ type ThemeProviderProps = {
|
|
|
13
13
|
themePreference?: ThemePreference;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export function ThemeProvider({ children, themePreference = '
|
|
16
|
+
export function ThemeProvider({ children, themePreference = 'no-preference' }: ThemeProviderProps) {
|
|
17
17
|
const systemTheme = useColorScheme();
|
|
18
18
|
|
|
19
19
|
const theme = React.useMemo(() => {
|
|
20
|
-
if (themePreference !== '
|
|
20
|
+
if (themePreference !== 'no-preference') {
|
|
21
21
|
return themePreference;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
return systemTheme
|
|
24
|
+
return systemTheme ?? 'light';
|
|
25
25
|
}, [themePreference, systemTheme]);
|
|
26
26
|
|
|
27
27
|
return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
|