@tamagui/core 1.0.0-alpha.2 → 1.0.0-alpha.7

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 (145) hide show
  1. package/dist/createComponent.js +43 -29
  2. package/dist/createComponent.js.map +2 -2
  3. package/dist/createFont.js +4 -0
  4. package/dist/createFont.js.map +2 -2
  5. package/dist/createTamagui.js +7 -0
  6. package/dist/createTamagui.js.map +2 -2
  7. package/dist/createTokens.js +4 -0
  8. package/dist/createTokens.js.map +2 -2
  9. package/dist/createVariable.js +3 -0
  10. package/dist/createVariable.js.map +2 -2
  11. package/dist/helpers/getSplitStyles.js +1 -13
  12. package/dist/helpers/getSplitStyles.js.map +2 -2
  13. package/dist/helpers/isComponent.js +10 -0
  14. package/dist/helpers/isComponent.js.map +7 -0
  15. package/dist/helpers/isTamaguiComponent.js +10 -0
  16. package/dist/helpers/isTamaguiComponent.js.map +7 -0
  17. package/dist/helpers/isTamaguiElement.js +10 -0
  18. package/dist/helpers/isTamaguiElement.js.map +7 -0
  19. package/dist/helpers/validate.js +60 -0
  20. package/dist/helpers/validate.js.map +7 -0
  21. package/dist/helpers/validateConfig.js +46 -0
  22. package/dist/helpers/validateConfig.js.map +7 -0
  23. package/dist/helpers/validateTokens.js +29 -0
  24. package/dist/helpers/validateTokens.js.map +7 -0
  25. package/dist/hooks/useMedia.js +1 -1
  26. package/dist/hooks/useMedia.js.map +2 -2
  27. package/dist/hooks/useTheme.js +1 -1
  28. package/dist/hooks/useTheme.js.map +2 -2
  29. package/dist/index.cjs +223 -137
  30. package/dist/index.cjs.map +3 -3
  31. package/dist/index.js +1 -2
  32. package/dist/index.js.map +2 -2
  33. package/dist/views/Theme.js +16 -7
  34. package/dist/views/Theme.js.map +2 -2
  35. package/dist/views/ThemeInverse.js +0 -1
  36. package/dist/views/ThemeInverse.js.map +2 -2
  37. package/dist/views/ThemeManagerContext.js +7 -1
  38. package/dist/views/ThemeManagerContext.js.map +2 -2
  39. package/package.json +12 -5
  40. package/src/createComponent.tsx +49 -38
  41. package/src/createFont.ts +5 -0
  42. package/src/createTamagui.ts +8 -0
  43. package/src/createTokens.ts +6 -1
  44. package/src/createVariable.ts +4 -0
  45. package/src/helpers/getSplitStyles.tsx +3 -16
  46. package/src/helpers/isTamaguiElement.tsx +5 -0
  47. package/src/helpers/validate.ts +59 -0
  48. package/src/hooks/useMedia.tsx +1 -1
  49. package/src/hooks/useTheme.tsx +1 -1
  50. package/src/index.ts +1 -2
  51. package/src/types.tsx +1 -0
  52. package/src/views/Theme.tsx +26 -9
  53. package/src/views/ThemeInverse.tsx +0 -1
  54. package/src/views/ThemeManagerContext.tsx +11 -1
  55. package/types.d.ts +3 -5
  56. package/.ultra.cache.json +0 -1
  57. package/_/constants/constants.js +0 -14
  58. package/_/constants/constants.js.map +0 -7
  59. package/_/constants/platform.js +0 -20
  60. package/_/constants/platform.js.map +0 -7
  61. package/_/constants/pseudos.js +0 -18
  62. package/_/constants/pseudos.js.map +0 -7
  63. package/_/constants/rnw.js +0 -22
  64. package/_/constants/rnw.js.map +0 -7
  65. package/_/createComponent.js +0 -427
  66. package/_/createComponent.js.map +0 -7
  67. package/_/createShorthands.js +0 -10
  68. package/_/createShorthands.js.map +0 -7
  69. package/_/createTamagui.js +0 -122
  70. package/_/createTamagui.js.map +0 -7
  71. package/_/createTheme.js +0 -20
  72. package/_/createTheme.js.map +0 -7
  73. package/_/createTokens.js +0 -29
  74. package/_/createTokens.js.map +0 -7
  75. package/_/createVariable.js +0 -22
  76. package/_/createVariable.js.map +0 -7
  77. package/_/helpers/addStylesUsingClassname.js +0 -32
  78. package/_/helpers/addStylesUsingClassname.js.map +0 -7
  79. package/_/helpers/createMediaStyle.js +0 -34
  80. package/_/helpers/createMediaStyle.js.map +0 -7
  81. package/_/helpers/createTamaguiProvider.js +0 -42
  82. package/_/helpers/createTamaguiProvider.js.map +0 -7
  83. package/_/helpers/extendStaticConfig.js +0 -176
  84. package/_/helpers/extendStaticConfig.js.map +0 -7
  85. package/_/helpers/fixNativeShadow.js +0 -8
  86. package/_/helpers/fixNativeShadow.js.map +0 -7
  87. package/_/helpers/fixNativeShadow.native.js +0 -30
  88. package/_/helpers/fixNativeShadow.native.js.map +0 -7
  89. package/_/helpers/getSplitStyles.js +0 -160
  90. package/_/helpers/getSplitStyles.js.map +0 -7
  91. package/_/helpers/getStylesAtomic.js +0 -84
  92. package/_/helpers/getStylesAtomic.js.map +0 -7
  93. package/_/helpers/getStylesAtomic.native.js +0 -10
  94. package/_/helpers/getStylesAtomic.native.js.map +0 -7
  95. package/_/helpers/insertStyleRule.js +0 -24
  96. package/_/helpers/insertStyleRule.js.map +0 -7
  97. package/_/helpers/matchMedia.js +0 -15
  98. package/_/helpers/matchMedia.js.map +0 -7
  99. package/_/helpers/matchMedia.native.js +0 -8
  100. package/_/helpers/matchMedia.native.js.map +0 -7
  101. package/_/helpers/themeable.js +0 -26
  102. package/_/helpers/themeable.js.map +0 -7
  103. package/_/hooks/useConstant.js +0 -15
  104. package/_/hooks/useConstant.js.map +0 -7
  105. package/_/hooks/useFeatures.js +0 -75
  106. package/_/hooks/useFeatures.js.map +0 -7
  107. package/_/hooks/useForceUpdate.js +0 -28
  108. package/_/hooks/useForceUpdate.js.map +0 -7
  109. package/_/hooks/useMedia.js +0 -173
  110. package/_/hooks/useMedia.js.map +0 -7
  111. package/_/hooks/usePressable.js +0 -14
  112. package/_/hooks/usePressable.js.map +0 -7
  113. package/_/hooks/useTheme.js +0 -94
  114. package/_/hooks/useTheme.js.map +0 -7
  115. package/_/index.js +0 -30
  116. package/_/index.js.map +0 -7
  117. package/_/static/postProcessStyles.js +0 -18
  118. package/_/static/postProcessStyles.js.map +0 -7
  119. package/_/static.js +0 -12
  120. package/_/static.js.map +0 -7
  121. package/_/styled.js +0 -21
  122. package/_/styled.js.map +0 -7
  123. package/_/types.js +0 -1
  124. package/_/types.js.map +0 -7
  125. package/_/views/Animated.js +0 -79
  126. package/_/views/Animated.js.map +0 -7
  127. package/_/views/Stack.js +0 -12
  128. package/_/views/Stack.js.map +0 -7
  129. package/_/views/Text.js +0 -60
  130. package/_/views/Text.js.map +0 -7
  131. package/_/views/TextAncestorContext.js +0 -19
  132. package/_/views/TextAncestorContext.js.map +0 -7
  133. package/_/views/Theme.js +0 -57
  134. package/_/views/Theme.js.map +0 -7
  135. package/_/views/ThemeContext.js +0 -6
  136. package/_/views/ThemeContext.js.map +0 -7
  137. package/_/views/ThemeInverse.js +0 -27
  138. package/_/views/ThemeInverse.js.map +0 -7
  139. package/_/views/ThemeManagerContext.js +0 -56
  140. package/_/views/ThemeManagerContext.js.map +0 -7
  141. package/_/views/ThemeProvider.js +0 -45
  142. package/_/views/ThemeProvider.js.map +0 -7
  143. package/src/hooks/useForceUpdate.tsx +0 -26
  144. package/src/views/SafeAreaProvider.tsx +0 -33
  145. package/tsconfig.json +0 -8
package/_/styled.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/styled.ts"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { createComponent } from './createComponent'\nimport { extendStaticConfig } from './helpers/extendStaticConfig'\nimport { StaticComponent, TamaguiConfig, Themes, Tokens } from './types'\n\nexport type GetProps<A> = A extends StaticComponent<infer Props>\n ? Props\n : A extends React.Component<infer Props>\n ? Props\n : {}\n\nexport function styled<\n A extends StaticComponent | React.Component<any>,\n StyledVariants extends void | {\n [key: string]: {\n [key: string]:\n | Partial<GetProps<A>>\n | ((\n val: any,\n config: {\n tokens: TamaguiConfig['tokens']\n theme: Themes extends { [key: string]: infer B } ? B : unknown\n }\n ) => Partial<GetProps<A>>)\n }\n }\n>(\n Component: A,\n options?: GetProps<A> & {\n variants?: StyledVariants\n }\n) {\n const staticConfigProps = (() => {\n if (options) {\n const { variants, ...defaultProps } = options\n return { variants, defaultProps }\n }\n return {}\n })()\n const config = extendStaticConfig(Component, staticConfigProps)\n const component = createComponent(config!) // error is good here its on init\n\n // type ParentVariants = A extends StaticComponent<any, infer Variants> ? Variants : {}\n\n type VariantProps = StyledVariants extends void\n ? {}\n : {\n // ensure variants actually defined\n [Key in keyof StyledVariants]?: keyof StyledVariants[Key] extends `...${infer VariantSpread}`\n ? VariantSpread extends keyof Tokens\n ? keyof Tokens[VariantSpread] extends string | number\n ? `$${keyof Tokens[VariantSpread]}`\n : unknown\n : unknown\n : keyof StyledVariants[Key] extends 'true'\n ? boolean\n : keyof StyledVariants[Key]\n }\n\n return component as StaticComponent<\n GetProps<A> & VariantProps\n // adding this one causes infinite type recursion after a couple styled() exntesions\n // VariantProps\n // typeof config,\n // ParentVariants\n >\n}\n\n// TODO get name\n// const displayName = `styled(Component)`\n// Object.defineProperty(component, 'name', {\n// value: displayName,\n// writable: false,\n// })\n"],
5
- "mappings": ";;AAEA;AACA;AASO,gBAgBL,WACA,SAGA;AACA,QAAM,oBAAqB,OAAM;AAC/B,QAAI,SAAS;AACX,YAAM,EAAE,aAAa,iBAAiB;AACtC,aAAO,EAAE,UAAU;AAAA;AAErB,WAAO;AAAA;AAET,QAAM,SAAS,mBAAmB,WAAW;AAC7C,QAAM,YAAY,gBAAgB;AAmBlC,SAAO;AAAA;AAhDO;",
6
- "names": []
7
- }
package/_/types.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
package/_/types.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,79 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React, { useMemo } from "react";
4
- import {
5
- Animated
6
- } from "react-native";
7
- import { useIsomorphicLayoutEffect } from "../constants/platform";
8
- import { useConstant } from "../hooks/useConstant";
9
- import { Stack } from "./Stack";
10
- const defaultAnimation = {
11
- from: {
12
- opacity: 0,
13
- translateY: 12
14
- },
15
- to: {
16
- opacity: 1,
17
- translateY: 0
18
- }
19
- };
20
- const styleKeys = {
21
- opacity: true,
22
- backgroundColor: true,
23
- borderColor: true
24
- };
25
- const AnimatedStack = /* @__PURE__ */ __name(({
26
- animateState = "in",
27
- animation = defaultAnimation,
28
- velocity = 6,
29
- children,
30
- animated,
31
- ...props
32
- }) => {
33
- const driver = useConstant(() => {
34
- return new Animated.Value(0);
35
- });
36
- const animatedProps = useMemo(() => {
37
- if (!animated) {
38
- return null;
39
- }
40
- const styleProps = {};
41
- const transform = [];
42
- for (const key in animation.from) {
43
- const fromVal = animation.from[key];
44
- const toVal = animation.to[key];
45
- const interpolatedVal = driver.interpolate({
46
- inputRange: [0, 1],
47
- outputRange: [fromVal, toVal]
48
- });
49
- if (styleKeys[key]) {
50
- styleProps[key] = interpolatedVal;
51
- } else {
52
- transform.push({
53
- [key]: interpolatedVal
54
- });
55
- }
56
- }
57
- return { transform, ...styleProps };
58
- }, [animated, animateState]);
59
- useIsomorphicLayoutEffect(() => {
60
- if (!animated) {
61
- return;
62
- }
63
- Animated.spring(driver, {
64
- useNativeDriver: true,
65
- velocity,
66
- toValue: animateState === "in" ? 1 : 0
67
- }).start();
68
- }, [animated, animateState]);
69
- const childrenMemo = useMemo(() => children, [children]);
70
- return /* @__PURE__ */ React.createElement(Stack, {
71
- animated,
72
- ...props,
73
- ...animatedProps
74
- }, childrenMemo);
75
- }, "AnimatedStack");
76
- export {
77
- AnimatedStack
78
- };
79
- //# sourceMappingURL=Animated.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Animated.tsx"],
4
- "sourcesContent": ["import React, { useMemo } from 'react'\nimport {\n Animated,\n PerpectiveTransform,\n RotateTransform,\n RotateXTransform,\n RotateYTransform,\n RotateZTransform,\n ScaleTransform,\n ScaleXTransform,\n ScaleYTransform,\n SkewXTransform,\n SkewYTransform,\n TranslateXTransform,\n TranslateYTransform,\n} from 'react-native'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { useConstant } from '../hooks/useConstant'\nimport { StackProps } from '../types'\nimport { Stack } from './Stack'\n\nconst defaultAnimation = {\n from: {\n opacity: 0,\n translateY: 12,\n },\n to: {\n opacity: 1,\n translateY: 0,\n },\n}\n\ntype AnimatableProps = Partial<\n Pick<StackProps, 'backgroundColor' | 'borderColor' | 'opacity'> &\n PerpectiveTransform &\n RotateTransform &\n RotateXTransform &\n RotateYTransform &\n RotateZTransform &\n ScaleTransform &\n ScaleXTransform &\n ScaleYTransform &\n TranslateXTransform &\n TranslateYTransform &\n SkewXTransform &\n SkewYTransform\n>\n\nconst styleKeys = {\n opacity: true,\n backgroundColor: true,\n borderColor: true,\n}\n\nexport type AnimatedStackProps = StackProps & {\n animateState?: 'in' | 'out'\n velocity?: number\n animation?: {\n from: AnimatableProps\n to: AnimatableProps\n }\n}\n\nexport const AnimatedStack = ({\n animateState = 'in',\n animation = defaultAnimation,\n velocity = 6,\n children,\n animated,\n ...props\n}: AnimatedStackProps) => {\n const driver = useConstant(() => {\n return new Animated.Value(0)\n })\n\n const animatedProps = useMemo(() => {\n if (!animated) {\n return null\n }\n\n const styleProps = {}\n const transform: any = []\n\n for (const key in animation.from) {\n const fromVal = animation.from[key]\n const toVal = animation.to[key]\n const interpolatedVal = driver.interpolate({\n inputRange: [0, 1],\n outputRange: [fromVal, toVal],\n })\n if (styleKeys[key]) {\n styleProps[key] = interpolatedVal\n } else {\n transform.push({\n [key]: interpolatedVal,\n })\n }\n }\n return { transform, ...styleProps }\n }, [animated, animateState])\n\n useIsomorphicLayoutEffect(() => {\n if (!animated) {\n return\n }\n Animated.spring(driver, {\n useNativeDriver: true,\n velocity,\n toValue: animateState === 'in' ? 1 : 0,\n }).start()\n }, [animated, animateState])\n\n const childrenMemo = useMemo(() => children, [children])\n\n return (\n <Stack animated={animated} {...props} {...animatedProps}>\n {childrenMemo}\n </Stack>\n )\n}\n"],
5
- "mappings": ";;AAAA;AACA;AAAA;AAAA;AAgBA;AACA;AAEA;AAEA,MAAM,mBAAmB;AAAA,EACvB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,EAEd,IAAI;AAAA,IACF,SAAS;AAAA,IACT,YAAY;AAAA;AAAA;AAoBhB,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,aAAa;AAAA;AAYR,MAAM,gBAAgB,wBAAC;AAAA,EAC5B,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AAAA,KACG;AAAA,MACqB;AACxB,QAAM,SAAS,YAAY,MAAM;AAC/B,WAAO,IAAI,SAAS,MAAM;AAAA;AAG5B,QAAM,gBAAgB,QAAQ,MAAM;AAClC,QAAI,CAAC,UAAU;AACb,aAAO;AAAA;AAGT,UAAM,aAAa;AACnB,UAAM,YAAiB;AAEvB,eAAW,OAAO,UAAU,MAAM;AAChC,YAAM,UAAU,UAAU,KAAK;AAC/B,YAAM,QAAQ,UAAU,GAAG;AAC3B,YAAM,kBAAkB,OAAO,YAAY;AAAA,QACzC,YAAY,CAAC,GAAG;AAAA,QAChB,aAAa,CAAC,SAAS;AAAA;AAEzB,UAAI,UAAU,MAAM;AAClB,mBAAW,OAAO;AAAA,aACb;AACL,kBAAU,KAAK;AAAA,WACZ,MAAM;AAAA;AAAA;AAAA;AAIb,WAAO,EAAE,cAAc;AAAA,KACtB,CAAC,UAAU;AAEd,4BAA0B,MAAM;AAC9B,QAAI,CAAC,UAAU;AACb;AAAA;AAEF,aAAS,OAAO,QAAQ;AAAA,MACtB,iBAAiB;AAAA,MACjB;AAAA,MACA,SAAS,iBAAiB,OAAO,IAAI;AAAA,OACpC;AAAA,KACF,CAAC,UAAU;AAEd,QAAM,eAAe,QAAQ,MAAM,UAAU,CAAC;AAE9C,SACE,oCAAC,OAAD;AAAA,IAAO;AAAA,OAAwB;AAAA,OAAW;AAAA,KACvC;AAAA,GArDsB;",
6
- "names": []
7
- }
package/_/views/Stack.js DELETED
@@ -1,12 +0,0 @@
1
- import { stackDefaultStyles } from "../constants/constants";
2
- import { createComponent } from "../createComponent";
3
- const Stack = createComponent({
4
- defaultProps: {
5
- ...stackDefaultStyles,
6
- flexDirection: "column"
7
- }
8
- });
9
- export {
10
- Stack
11
- };
12
- //# sourceMappingURL=Stack.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Stack.tsx"],
4
- "sourcesContent": ["import { stackDefaultStyles } from '../constants/constants'\nimport { createComponent } from '../createComponent'\nimport { StackProps } from '../types'\n\nexport const Stack = createComponent<StackProps>({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n },\n})\n\n// test types\n// export const YStack = styled(Stack, {\n// flexDirection: 'column',\n// })\n// // test types\n// const x00 = <Stack missing={0} /> // should err\n// const x0 = <YStack missing={0} /> // should err\n// const x1 = (props: StackProps) => <YStack {...props} />\n// type ys = typeof YStack\n// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown\n"],
5
- "mappings": "AAAA;AACA;AAGO,MAAM,QAAQ,gBAA4B;AAAA,EAC/C,cAAc;AAAA,OACT;AAAA,IACH,eAAe;AAAA;AAAA;",
6
- "names": []
7
- }
package/_/views/Text.js DELETED
@@ -1,60 +0,0 @@
1
- import { isWeb } from "../constants/platform";
2
- import { createComponent } from "../createComponent";
3
- import { stylePropsTextOnly, validStyles } from "../static";
4
- const ellipseStyle = {
5
- maxWidth: "100%",
6
- overflow: "hidden",
7
- textOverflow: "ellipsis",
8
- whiteSpace: "nowrap"
9
- };
10
- const Text = createComponent({
11
- isText: true,
12
- defaultProps: {
13
- display: isWeb ? "inline" : "inline-flex",
14
- boxSizing: "border-box",
15
- fontFamily: "System",
16
- wordWrap: "break-word"
17
- },
18
- variants: {
19
- numberOfLines: {
20
- 1: ellipseStyle,
21
- "[number]": (lines) => lines > 1 ? { WebkitLineClamp: 1 } : null
22
- },
23
- selectable: {
24
- true: {
25
- userSelect: "text"
26
- },
27
- false: {
28
- userSelect: "none"
29
- }
30
- },
31
- pressable: {
32
- true: {
33
- cursor: "pointer"
34
- }
35
- },
36
- ellipse: {
37
- true: isWeb ? ellipseStyle : {
38
- numberOfLines: 1,
39
- lineBreakMode: "clip"
40
- }
41
- }
42
- },
43
- deoptProps: new Set(isWeb ? [] : ["ellipse"]),
44
- validStyles: {
45
- ...validStyles,
46
- ...stylePropsTextOnly,
47
- ...isWeb && {
48
- userSelect: true,
49
- textOverflow: true,
50
- whiteSpace: true,
51
- wordWrap: true,
52
- selectable: true,
53
- cursor: true
54
- }
55
- }
56
- });
57
- export {
58
- Text
59
- };
60
- //# sourceMappingURL=Text.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Text.tsx"],
4
- "sourcesContent": ["import { isWeb } from '../constants/platform'\nimport { createComponent } from '../createComponent'\nimport { stylePropsTextOnly, validStyles } from '../static'\nimport { TextProps } from '../types'\n\nconst ellipseStyle = {\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n}\n\nexport const Text = createComponent<TextProps>({\n isText: true,\n defaultProps: {\n display: isWeb ? 'inline' : 'inline-flex',\n boxSizing: 'border-box',\n fontFamily: 'System',\n wordWrap: 'break-word',\n },\n variants: {\n numberOfLines: {\n 1: ellipseStyle,\n // TODO imply fn, test 1, could do types `>1` `<2`\n '[number]': (lines) => (lines > 1 ? { WebkitLineClamp: 1 } : null),\n },\n\n selectable: {\n true: {\n userSelect: 'text',\n },\n false: {\n userSelect: 'none',\n },\n },\n\n pressable: {\n true: {\n cursor: 'pointer',\n },\n },\n\n ellipse: {\n true: isWeb\n ? ellipseStyle\n : {\n numberOfLines: 1,\n lineBreakMode: 'clip',\n },\n },\n },\n // TODO document\n deoptProps: new Set(isWeb ? [] : ['ellipse']),\n validStyles: {\n ...validStyles,\n ...stylePropsTextOnly,\n ...(isWeb && {\n userSelect: true,\n textOverflow: true,\n whiteSpace: true,\n wordWrap: true,\n selectable: true,\n cursor: true,\n }),\n },\n})\n"],
5
- "mappings": "AAAA;AACA;AACA;AAGA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA;AAGP,MAAM,OAAO,gBAA2B;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,IACZ,SAAS,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA;AAAA,EAEZ,UAAU;AAAA,IACR,eAAe;AAAA,MACb,GAAG;AAAA,MAEH,YAAY,CAAC,UAAW,QAAQ,IAAI,EAAE,iBAAiB,MAAM;AAAA;AAAA,IAG/D,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,YAAY;AAAA;AAAA,MAEd,OAAO;AAAA,QACL,YAAY;AAAA;AAAA;AAAA,IAIhB,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,QAAQ;AAAA;AAAA;AAAA,IAIZ,SAAS;AAAA,MACP,MAAM,QACF,eACA;AAAA,QACE,eAAe;AAAA,QACf,eAAe;AAAA;AAAA;AAAA;AAAA,EAKzB,YAAY,IAAI,IAAI,QAAQ,KAAK,CAAC;AAAA,EAClC,aAAa;AAAA,OACR;AAAA,OACA;AAAA,OACC,SAAS;AAAA,MACX,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,19 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- var _a;
4
- import React from "react";
5
- import { rnw } from "../constants/rnw";
6
- const TextAncestorContext = (_a = rnw) == null ? void 0 : _a.TextAncestorContext;
7
- const TextAncestorProvider = /* @__PURE__ */ __name((props) => {
8
- if (TextAncestorContext) {
9
- return /* @__PURE__ */ React.createElement(TextAncestorContext.Provider, {
10
- value: false
11
- }, props.children);
12
- }
13
- return props.children;
14
- }, "TextAncestorProvider");
15
- export {
16
- TextAncestorContext,
17
- TextAncestorProvider
18
- };
19
- //# sourceMappingURL=TextAncestorContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/TextAncestorContext.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { rnw } from '../constants/rnw'\n\nexport const TextAncestorContext = rnw?.TextAncestorContext\n\nexport const TextAncestorProvider = (props) => {\n if (TextAncestorContext) {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n }\n return props.children\n}\n"],
5
- "mappings": ";;AAAA;AAAA;AAEA;AAEO,MAAM,sBAAsB,iCAAK;AAEjC,MAAM,uBAAuB,wBAAC,UAAU;AAC7C,MAAI,qBAAqB;AACvB,WAAO,oCAAC,oBAAoB,UAArB;AAAA,MAA8B,OAAO;AAAA,OAAQ,MAAM;AAAA;AAE5D,SAAO,MAAM;AAAA,GAJqB;",
6
- "names": []
7
- }
package/_/views/Theme.js DELETED
@@ -1,57 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React, { useContext, useState } from "react";
4
- import { isWeb, useIsomorphicLayoutEffect } from "../constants/platform";
5
- import { getThemeParentClassName } from "../createTamagui";
6
- import { useConstant } from "../hooks/useConstant";
7
- import { ThemeContext } from "./ThemeContext";
8
- import { ThemeManager, ThemeManagerContext } from "./ThemeManagerContext";
9
- const Theme = /* @__PURE__ */ __name((props) => {
10
- var _a, _b;
11
- const parent = useContext(ThemeManagerContext);
12
- const themes = useContext(ThemeContext);
13
- const [parentName, setParentName] = useState(parent.name || "light");
14
- if (!themes) {
15
- console.warn("no themes???", props);
16
- return props.children;
17
- }
18
- const name = props.name;
19
- const theme = themes[name] || themes[`${name}-${parentName}`];
20
- const themeManager = useConstant(() => {
21
- const manager = new ThemeManager();
22
- if (name) {
23
- manager.setActiveTheme(name, themes[name]);
24
- }
25
- return manager;
26
- });
27
- useIsomorphicLayoutEffect(() => {
28
- themeManager.setActiveTheme(name, theme);
29
- return parent.onChangeTheme((next) => {
30
- if (next) {
31
- themeManager.setActiveTheme(next, themes[next]);
32
- setParentName(next);
33
- }
34
- });
35
- }, [themes, name]);
36
- if (!name) {
37
- return props.children;
38
- }
39
- const contents = themeManager ? /* @__PURE__ */ React.createElement(ThemeManagerContext.Provider, {
40
- value: themeManager
41
- }, props.children) : props.children;
42
- if (isWeb) {
43
- if (props.disableThemeClass) {
44
- return contents;
45
- }
46
- const color = (_b = (_a = themes[name]) == null ? void 0 : _a["color"]) == null ? void 0 : _b["variable"];
47
- return /* @__PURE__ */ React.createElement("div", {
48
- className: getThemeParentClassName(name),
49
- style: { display: "contents", color }
50
- }, contents);
51
- }
52
- return contents;
53
- }, "Theme");
54
- export {
55
- Theme
56
- };
57
- //# sourceMappingURL=Theme.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/Theme.tsx"],
4
- "sourcesContent": ["import React, { useContext, useState } from 'react'\n\nimport { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getThemeParentClassName } from '../createTamagui'\nimport { useConstant } from '../hooks/useConstant'\nimport { ThemeName, Themes } from '../types'\nimport { ThemeContext } from './ThemeContext'\nimport { ThemeManager, ThemeManagerContext } from './ThemeManagerContext'\n\nexport type ThemeProps = {\n disableThemeClass?: boolean\n name: ThemeName | null\n children?: any\n}\n\nexport const Theme = (props: ThemeProps) => {\n const parent = useContext(ThemeManagerContext)\n const themes = useContext(ThemeContext)\n const [parentName, setParentName] = useState(parent.name || 'light')\n if (!themes) {\n console.warn('no themes???', props)\n return props.children\n }\n const name = props.name as string\n const theme = themes[name] || themes[`${name}-${parentName}`]\n const themeManager = useConstant<ThemeManager>(() => {\n const manager = new ThemeManager()\n if (name) {\n manager.setActiveTheme(name, themes[name])\n }\n return manager\n })\n\n useIsomorphicLayoutEffect(() => {\n themeManager.setActiveTheme(name, theme)\n return parent.onChangeTheme((next) => {\n if (next) {\n themeManager.setActiveTheme(next, themes[next])\n setParentName(next)\n }\n })\n }, [themes, name])\n\n if (!name) {\n return props.children\n }\n\n const contents = themeManager ? (\n <ThemeManagerContext.Provider value={themeManager}>\n {props.children}\n </ThemeManagerContext.Provider>\n ) : (\n props.children\n )\n\n if (isWeb) {\n if (props.disableThemeClass) {\n return contents\n }\n const color = themes[name]?.['color']?.['variable']\n return (\n <div\n className={getThemeParentClassName(name)}\n // in order to provide currentColor, set color by default\n style={{ display: 'contents', color }}\n >\n {contents}\n </div>\n )\n }\n\n return contents\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AAEA;AACA;AAQO,MAAM,QAAQ,wBAAC,UAAsB;AAf5C;AAgBE,QAAM,SAAS,WAAW;AAC1B,QAAM,SAAS,WAAW;AAC1B,QAAM,CAAC,YAAY,iBAAiB,SAAS,OAAO,QAAQ;AAC5D,MAAI,CAAC,QAAQ;AACX,YAAQ,KAAK,gBAAgB;AAC7B,WAAO,MAAM;AAAA;AAEf,QAAM,OAAO,MAAM;AACnB,QAAM,QAAQ,OAAO,SAAS,OAAO,GAAG,QAAQ;AAChD,QAAM,eAAe,YAA0B,MAAM;AACnD,UAAM,UAAU,IAAI;AACpB,QAAI,MAAM;AACR,cAAQ,eAAe,MAAM,OAAO;AAAA;AAEtC,WAAO;AAAA;AAGT,4BAA0B,MAAM;AAC9B,iBAAa,eAAe,MAAM;AAClC,WAAO,OAAO,cAAc,CAAC,SAAS;AACpC,UAAI,MAAM;AACR,qBAAa,eAAe,MAAM,OAAO;AACzC,sBAAc;AAAA;AAAA;AAAA,KAGjB,CAAC,QAAQ;AAEZ,MAAI,CAAC,MAAM;AACT,WAAO,MAAM;AAAA;AAGf,QAAM,WAAW,eACf,oCAAC,oBAAoB,UAArB;AAAA,IAA8B,OAAO;AAAA,KAClC,MAAM,YAGT,MAAM;AAGR,MAAI,OAAO;AACT,QAAI,MAAM,mBAAmB;AAC3B,aAAO;AAAA;AAET,UAAM,QAAQ,mBAAO,UAAP,mBAAe,aAAf,mBAA0B;AACxC,WACE,oCAAC,OAAD;AAAA,MACE,WAAW,wBAAwB;AAAA,MAEnC,OAAO,EAAE,SAAS,YAAY;AAAA,OAE7B;AAAA;AAKP,SAAO;AAAA,GAxDY;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- import { createContext } from "react";
2
- const ThemeContext = createContext(null);
3
- export {
4
- ThemeContext
5
- };
6
- //# sourceMappingURL=ThemeContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/ThemeContext.tsx"],
4
- "sourcesContent": ["import { createContext } from 'react'\n\nimport { Themes } from '../types'\n\nexport const ThemeContext = createContext<Themes>(null as any)\n"],
5
- "mappings": "AAAA;AAIO,MAAM,eAAe,cAAsB;",
6
- "names": []
7
- }
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React from "react";
4
- import { useDefaultThemeName, useThemeName } from "../hooks/useTheme";
5
- import { Theme } from "./Theme";
6
- let inversions = {
7
- light: "dark",
8
- dark: "light"
9
- };
10
- function setThemeInversions(next) {
11
- inversions = next;
12
- }
13
- __name(setThemeInversions, "setThemeInversions");
14
- const ThemeInverse = /* @__PURE__ */ __name((props) => {
15
- const themeName = useThemeName();
16
- const defaultTheme = useDefaultThemeName();
17
- const name = inversions[themeName] || inversions[defaultTheme] || null;
18
- console.log("todo fixme invert", { themeName, defaultTheme, next: name });
19
- return /* @__PURE__ */ React.createElement(Theme, {
20
- name
21
- }, props.children);
22
- }, "ThemeInverse");
23
- export {
24
- ThemeInverse,
25
- setThemeInversions
26
- };
27
- //# sourceMappingURL=ThemeInverse.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/ThemeInverse.tsx"],
4
- "sourcesContent": ["import React from 'react'\n\nimport { useDefaultThemeName, useThemeName } from '../hooks/useTheme'\nimport { Theme } from './Theme'\n\ntype StringRecord = { [key: string]: string }\n\nlet inversions: StringRecord = {\n light: 'dark',\n dark: 'light',\n}\n\nexport function setThemeInversions(next: StringRecord) {\n inversions = next\n}\n\nexport const ThemeInverse = (props: { children: any }) => {\n const themeName = useThemeName()\n const defaultTheme = useDefaultThemeName()\n const name = inversions[themeName] || inversions[defaultTheme] || null\n console.log('todo fixme invert', { themeName, defaultTheme, next: name })\n return <Theme name={name}>{props.children}</Theme>\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AAIA,IAAI,aAA2B;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,4BAA4B,MAAoB;AACrD,eAAa;AAAA;AADC;AAIT,MAAM,eAAe,wBAAC,UAA6B;AACxD,QAAM,YAAY;AAClB,QAAM,eAAe;AACrB,QAAM,OAAO,WAAW,cAAc,WAAW,iBAAiB;AAClE,UAAQ,IAAI,qBAAqB,EAAE,WAAW,cAAc,MAAM;AAClE,SAAO,oCAAC,OAAD;AAAA,IAAO;AAAA,KAAa,MAAM;AAAA,GALP;",
6
- "names": []
7
- }
@@ -1,56 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { createContext } from "react";
4
- class ThemeManager {
5
- constructor() {
6
- this.name = "light";
7
- this.keys = new Map();
8
- this.listeners = new Map();
9
- this.callbacks = new Set();
10
- this.theme = null;
11
- }
12
- setActiveTheme(name, theme) {
13
- if (name === this.name)
14
- return;
15
- this.name = name;
16
- this.theme = theme;
17
- this.update();
18
- }
19
- track(uuid, keys) {
20
- if (!this.name)
21
- return;
22
- this.keys.set(uuid, keys);
23
- }
24
- update() {
25
- var _a;
26
- if (!this.name) {
27
- this.keys.clear();
28
- }
29
- for (const [uuid, keys] of this.keys.entries()) {
30
- if (keys.size) {
31
- (_a = this.listeners.get(uuid)) == null ? void 0 : _a();
32
- }
33
- }
34
- this.callbacks.forEach((cb) => cb(this.name));
35
- }
36
- onChangeTheme(cb) {
37
- this.callbacks.add(cb);
38
- return () => {
39
- this.callbacks.delete(cb);
40
- };
41
- }
42
- onUpdate(uuid, cb) {
43
- this.listeners.set(uuid, cb);
44
- return () => {
45
- this.listeners.delete(uuid);
46
- this.keys.delete(uuid);
47
- };
48
- }
49
- }
50
- __name(ThemeManager, "ThemeManager");
51
- const ThemeManagerContext = createContext(new ThemeManager());
52
- export {
53
- ThemeManager,
54
- ThemeManagerContext
55
- };
56
- //# sourceMappingURL=ThemeManagerContext.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/ThemeManagerContext.tsx"],
4
- "sourcesContent": ["import { createContext } from 'react'\n\nexport class ThemeManager {\n name: string | null = 'light'\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n callbacks = new Set<Function>()\n theme = null\n\n setActiveTheme(name: string | null, theme?: any) {\n if (name === this.name) return\n this.name = name\n this.theme = theme\n this.update()\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n update() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.callbacks.forEach((cb) => cb(this.name))\n }\n\n onChangeTheme(cb: (name: string | null) => void) {\n this.callbacks.add(cb)\n return () => {\n this.callbacks.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager>(new ThemeManager())\n"],
5
- "mappings": ";;AAAA;AAEO,mBAAmB;AAAA,EAAnB,cAFP;AAGE,gBAAsB;AACtB,gBAAO,IAAI;AACX,qBAAY,IAAI;AAChB,qBAAY,IAAI;AAChB,iBAAQ;AAAA;AAAA,EAER,eAAe,MAAqB,OAAa;AAC/C,QAAI,SAAS,KAAK;AAAM;AACxB,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK;AAAA;AAAA,EAGP,MAAM,MAAW,MAAmB;AAClC,QAAI,CAAC,KAAK;AAAM;AAChB,SAAK,KAAK,IAAI,MAAM;AAAA;AAAA,EAGtB,SAAS;AArBX;AAsBI,QAAI,CAAC,KAAK,MAAM;AACd,WAAK,KAAK;AAAA;AAEZ,eAAW,CAAC,MAAM,SAAS,KAAK,KAAK,WAAW;AAC9C,UAAI,KAAK,MAAM;AACb,mBAAK,UAAU,IAAI,UAAnB;AAAA;AAAA;AAGJ,SAAK,UAAU,QAAQ,CAAC,OAAO,GAAG,KAAK;AAAA;AAAA,EAGzC,cAAc,IAAmC;AAC/C,SAAK,UAAU,IAAI;AACnB,WAAO,MAAM;AACX,WAAK,UAAU,OAAO;AAAA;AAAA;AAAA,EAI1B,SAAS,MAAW,IAAc;AAChC,SAAK,UAAU,IAAI,MAAM;AACzB,WAAO,MAAM;AACX,WAAK,UAAU,OAAO;AACtB,WAAK,KAAK,OAAO;AAAA;AAAA;AAAA;AA1ChB;AA+CA,MAAM,sBAAsB,cAA4B,IAAI;",
6
- "names": []
7
- }
@@ -1,45 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import React, { useMemo } from "react";
4
- import { useIsomorphicLayoutEffect } from "../constants/platform";
5
- import { getHasConfigured, getThemeParentClassName } from "../createTamagui";
6
- import { Theme } from "./Theme";
7
- import { ThemeContext } from "./ThemeContext";
8
- const GET_DEFAULT_THEME = "___TGUI";
9
- const ThemeProvider = /* @__PURE__ */ __name((props) => {
10
- if (!getHasConfigured()) {
11
- throw new Error(`Missing configureThemes() call, add to your root file`);
12
- }
13
- useIsomorphicLayoutEffect(() => {
14
- if (props.disableRootThemeClass) {
15
- return;
16
- }
17
- if (typeof document !== "undefined") {
18
- const cns = getThemeParentClassName(`${props.defaultTheme}`).split(" ");
19
- cns.forEach((cn) => document.body.classList.add(cn));
20
- return () => {
21
- cns.forEach((cn) => document.body.classList.remove(cn));
22
- };
23
- }
24
- }, []);
25
- const themeContext = useMemo(() => {
26
- return new Proxy(props.themes, {
27
- get(target, key) {
28
- if (key === GET_DEFAULT_THEME)
29
- return props.defaultTheme;
30
- return Reflect.get(target, key);
31
- }
32
- });
33
- }, [props.themes]);
34
- return /* @__PURE__ */ React.createElement(ThemeContext.Provider, {
35
- value: themeContext
36
- }, /* @__PURE__ */ React.createElement(Theme, {
37
- name: props.defaultTheme,
38
- disableThemeClass: props.disableRootThemeClass
39
- }, props.children));
40
- }, "ThemeProvider");
41
- export {
42
- GET_DEFAULT_THEME,
43
- ThemeProvider
44
- };
45
- //# sourceMappingURL=ThemeProvider.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/views/ThemeProvider.tsx"],
4
- "sourcesContent": ["import React, { useMemo } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../constants/platform'\nimport { getHasConfigured, getThemeParentClassName } from '../createTamagui'\nimport { Theme } from './Theme'\nimport { ThemeContext } from './ThemeContext'\n\nexport type ThemeProviderProps = {\n themes: any\n defaultTheme: string\n disableRootThemeClass?: boolean\n children?: any\n}\n\nexport const GET_DEFAULT_THEME = '___TGUI'\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n if (!getHasConfigured()) {\n throw new Error(`Missing configureThemes() call, add to your root file`)\n }\n\n // ensure theme is attached to root body node as well to work with modals by default\n useIsomorphicLayoutEffect(() => {\n if (props.disableRootThemeClass) {\n return\n }\n if (typeof document !== 'undefined') {\n const cns = getThemeParentClassName(`${props.defaultTheme}`).split(' ')\n cns.forEach((cn) => document.body.classList.add(cn))\n return () => {\n cns.forEach((cn) => document.body.classList.remove(cn))\n }\n }\n }, [])\n\n const themeContext = useMemo(() => {\n return new Proxy(props.themes, {\n get(target, key) {\n if (key === GET_DEFAULT_THEME) return props.defaultTheme\n return Reflect.get(target, key)\n },\n })\n }, [props.themes])\n\n return (\n <ThemeContext.Provider value={themeContext}>\n <Theme name={props.defaultTheme} disableThemeClass={props.disableRootThemeClass}>\n {props.children}\n </Theme>\n </ThemeContext.Provider>\n )\n}\n"],
5
- "mappings": ";;AAAA;AAEA;AACA;AACA;AACA;AASO,MAAM,oBAAoB;AAE1B,MAAM,gBAAgB,wBAAC,UAA8B;AAC1D,MAAI,CAAC,oBAAoB;AACvB,UAAM,IAAI,MAAM;AAAA;AAIlB,4BAA0B,MAAM;AAC9B,QAAI,MAAM,uBAAuB;AAC/B;AAAA;AAEF,QAAI,OAAO,aAAa,aAAa;AACnC,YAAM,MAAM,wBAAwB,GAAG,MAAM,gBAAgB,MAAM;AACnE,UAAI,QAAQ,CAAC,OAAO,SAAS,KAAK,UAAU,IAAI;AAChD,aAAO,MAAM;AACX,YAAI,QAAQ,CAAC,OAAO,SAAS,KAAK,UAAU,OAAO;AAAA;AAAA;AAAA,KAGtD;AAEH,QAAM,eAAe,QAAQ,MAAM;AACjC,WAAO,IAAI,MAAM,MAAM,QAAQ;AAAA,MAC7B,IAAI,QAAQ,KAAK;AACf,YAAI,QAAQ;AAAmB,iBAAO,MAAM;AAC5C,eAAO,QAAQ,IAAI,QAAQ;AAAA;AAAA;AAAA,KAG9B,CAAC,MAAM;AAEV,SACE,oCAAC,aAAa,UAAd;AAAA,IAAuB,OAAO;AAAA,KAC5B,oCAAC,OAAD;AAAA,IAAO,MAAM,MAAM;AAAA,IAAc,mBAAmB,MAAM;AAAA,KACvD,MAAM;AAAA,GA/Bc;",
6
- "names": []
7
- }
@@ -1,26 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react'
2
-
3
- // ensures no updates after unmount
4
-
5
- export function useForceUpdate() {
6
- const setState = useState(0)[1]
7
- const internal = useRef<{ update: Function; isMounted: boolean }>()
8
- if (!internal.current) {
9
- internal.current = {
10
- isMounted: true,
11
- update: () => {
12
- if (internal.current!.isMounted) {
13
- setState(Math.random())
14
- }
15
- },
16
- }
17
- }
18
-
19
- useEffect(() => {
20
- return () => {
21
- internal.current!.isMounted = false
22
- }
23
- }, [])
24
-
25
- return internal.current.update
26
- }
@@ -1,33 +0,0 @@
1
- import React from 'react'
2
- import { Platform } from 'react-native'
3
- import {
4
- Metrics,
5
- SafeAreaProvider as RNSafeAreaProvider,
6
- initialWindowMetrics as defaultInitialWindowMetrics,
7
- } from 'react-native-safe-area-context'
8
-
9
- let defaultMetrics: Metrics | null = null
10
-
11
- export const SafeAreaProvider = ({
12
- initialWindowMetrics,
13
- children,
14
- }: {
15
- children?: any
16
- initialWindowMetrics?: any
17
- }) => {
18
- if (!initialWindowMetrics && !defaultMetrics) {
19
- defaultMetrics = Platform.select({
20
- web: {
21
- frame: { x: 0, y: 0, width: 0, height: 0 },
22
- insets: { top: 0, left: 0, right: 0, bottom: 0 },
23
- },
24
- default: defaultInitialWindowMetrics,
25
- })
26
- }
27
-
28
- return (
29
- <RNSafeAreaProvider initialMetrics={initialWindowMetrics ?? defaultMetrics}>
30
- {children}
31
- </RNSafeAreaProvider>
32
- )
33
- }
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig",
3
- "compilerOptions": {
4
- "rootDir": "../..",
5
- "jsx": "preserve"
6
- },
7
- "include": ["src"]
8
- }