@tamagui/core 1.0.0-alpha.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/.ultra.cache.json +1 -0
- package/_/constants/constants.js +14 -0
- package/_/constants/constants.js.map +7 -0
- package/_/constants/platform.js +20 -0
- package/_/constants/platform.js.map +7 -0
- package/_/constants/pseudos.js +18 -0
- package/_/constants/pseudos.js.map +7 -0
- package/_/constants/rnw.js +22 -0
- package/_/constants/rnw.js.map +7 -0
- package/_/createComponent.js +427 -0
- package/_/createComponent.js.map +7 -0
- package/_/createShorthands.js +10 -0
- package/_/createShorthands.js.map +7 -0
- package/_/createTamagui.js +122 -0
- package/_/createTamagui.js.map +7 -0
- package/_/createTheme.js +20 -0
- package/_/createTheme.js.map +7 -0
- package/_/createTokens.js +29 -0
- package/_/createTokens.js.map +7 -0
- package/_/createVariable.js +22 -0
- package/_/createVariable.js.map +7 -0
- package/_/helpers/addStylesUsingClassname.js +32 -0
- package/_/helpers/addStylesUsingClassname.js.map +7 -0
- package/_/helpers/createMediaStyle.js +34 -0
- package/_/helpers/createMediaStyle.js.map +7 -0
- package/_/helpers/createTamaguiProvider.js +42 -0
- package/_/helpers/createTamaguiProvider.js.map +7 -0
- package/_/helpers/extendStaticConfig.js +176 -0
- package/_/helpers/extendStaticConfig.js.map +7 -0
- package/_/helpers/fixNativeShadow.js +8 -0
- package/_/helpers/fixNativeShadow.js.map +7 -0
- package/_/helpers/fixNativeShadow.native.js +30 -0
- package/_/helpers/fixNativeShadow.native.js.map +7 -0
- package/_/helpers/getSplitStyles.js +160 -0
- package/_/helpers/getSplitStyles.js.map +7 -0
- package/_/helpers/getStylesAtomic.js +84 -0
- package/_/helpers/getStylesAtomic.js.map +7 -0
- package/_/helpers/getStylesAtomic.native.js +10 -0
- package/_/helpers/getStylesAtomic.native.js.map +7 -0
- package/_/helpers/insertStyleRule.js +24 -0
- package/_/helpers/insertStyleRule.js.map +7 -0
- package/_/helpers/matchMedia.js +15 -0
- package/_/helpers/matchMedia.js.map +7 -0
- package/_/helpers/matchMedia.native.js +8 -0
- package/_/helpers/matchMedia.native.js.map +7 -0
- package/_/helpers/themeable.js +26 -0
- package/_/helpers/themeable.js.map +7 -0
- package/_/hooks/useConstant.js +15 -0
- package/_/hooks/useConstant.js.map +7 -0
- package/_/hooks/useFeatures.js +75 -0
- package/_/hooks/useFeatures.js.map +7 -0
- package/_/hooks/useForceUpdate.js +28 -0
- package/_/hooks/useForceUpdate.js.map +7 -0
- package/_/hooks/useMedia.js +173 -0
- package/_/hooks/useMedia.js.map +7 -0
- package/_/hooks/usePressable.js +14 -0
- package/_/hooks/usePressable.js.map +7 -0
- package/_/hooks/useTheme.js +94 -0
- package/_/hooks/useTheme.js.map +7 -0
- package/_/index.js +30 -0
- package/_/index.js.map +7 -0
- package/_/static/postProcessStyles.js +18 -0
- package/_/static/postProcessStyles.js.map +7 -0
- package/_/static.js +12 -0
- package/_/static.js.map +7 -0
- package/_/styled.js +21 -0
- package/_/styled.js.map +7 -0
- package/_/types.js +1 -0
- package/_/types.js.map +7 -0
- package/_/views/Animated.js +79 -0
- package/_/views/Animated.js.map +7 -0
- package/_/views/Stack.js +12 -0
- package/_/views/Stack.js.map +7 -0
- package/_/views/Text.js +60 -0
- package/_/views/Text.js.map +7 -0
- package/_/views/TextAncestorContext.js +19 -0
- package/_/views/TextAncestorContext.js.map +7 -0
- package/_/views/Theme.js +57 -0
- package/_/views/Theme.js.map +7 -0
- package/_/views/ThemeContext.js +6 -0
- package/_/views/ThemeContext.js.map +7 -0
- package/_/views/ThemeInverse.js +27 -0
- package/_/views/ThemeInverse.js.map +7 -0
- package/_/views/ThemeManagerContext.js +56 -0
- package/_/views/ThemeManagerContext.js.map +7 -0
- package/_/views/ThemeProvider.js +45 -0
- package/_/views/ThemeProvider.js.map +7 -0
- package/dist/constants/constants.js +14 -0
- package/dist/constants/constants.js.map +7 -0
- package/dist/constants/platform.js +19 -0
- package/dist/constants/platform.js.map +7 -0
- package/dist/constants/pseudos.js +18 -0
- package/dist/constants/pseudos.js.map +7 -0
- package/dist/constants/rnw.js +22 -0
- package/dist/constants/rnw.js.map +7 -0
- package/dist/constants/styleConstants.js +46 -0
- package/dist/constants/styleConstants.js.map +7 -0
- package/dist/createComponent.js +445 -0
- package/dist/createComponent.js.map +7 -0
- package/dist/createFont.js +24 -0
- package/dist/createFont.js.map +7 -0
- package/dist/createShorthands.js +10 -0
- package/dist/createShorthands.js.map +7 -0
- package/dist/createTamagui.js +159 -0
- package/dist/createTamagui.js.map +7 -0
- package/dist/createTheme.js +20 -0
- package/dist/createTheme.js.map +7 -0
- package/dist/createTokens.js +29 -0
- package/dist/createTokens.js.map +7 -0
- package/dist/createVariable.js +22 -0
- package/dist/createVariable.js.map +7 -0
- package/dist/helpers/addStylesUsingClassname.js +57 -0
- package/dist/helpers/addStylesUsingClassname.js.map +7 -0
- package/dist/helpers/createMediaStyle.js +34 -0
- package/dist/helpers/createMediaStyle.js.map +7 -0
- package/dist/helpers/createPropMapper.js +153 -0
- package/dist/helpers/createPropMapper.js.map +7 -0
- package/dist/helpers/createTamaguiProvider.js +25 -0
- package/dist/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/helpers/extendStaticConfig.js +59 -0
- package/dist/helpers/extendStaticConfig.js.map +7 -0
- package/dist/helpers/fixNativeShadow.js +8 -0
- package/dist/helpers/fixNativeShadow.js.map +7 -0
- package/dist/helpers/fixNativeShadow.native.js +30 -0
- package/dist/helpers/fixNativeShadow.native.js.map +7 -0
- package/dist/helpers/getSplitStyles.js +160 -0
- package/dist/helpers/getSplitStyles.js.map +7 -0
- package/dist/helpers/getStylesAtomic.js +83 -0
- package/dist/helpers/getStylesAtomic.js.map +7 -0
- package/dist/helpers/getStylesAtomic.native.js +10 -0
- package/dist/helpers/getStylesAtomic.native.js.map +7 -0
- package/dist/helpers/insertStyleRule.js +24 -0
- package/dist/helpers/insertStyleRule.js.map +7 -0
- package/dist/helpers/isObj.js +7 -0
- package/dist/helpers/isObj.js.map +7 -0
- package/dist/helpers/matchMedia.js +15 -0
- package/dist/helpers/matchMedia.js.map +7 -0
- package/dist/helpers/matchMedia.native.js +8 -0
- package/dist/helpers/matchMedia.native.js.map +7 -0
- package/dist/helpers/pseudos.js +1 -0
- package/dist/helpers/pseudos.js.map +7 -0
- package/dist/helpers/themeable.js +26 -0
- package/dist/helpers/themeable.js.map +7 -0
- package/dist/hooks/useConstant.js +15 -0
- package/dist/hooks/useConstant.js.map +7 -0
- package/dist/hooks/useFeatures.js +75 -0
- package/dist/hooks/useFeatures.js.map +7 -0
- package/dist/hooks/useForceUpdate.js +28 -0
- package/dist/hooks/useForceUpdate.js.map +7 -0
- package/dist/hooks/useMedia.js +171 -0
- package/dist/hooks/useMedia.js.map +7 -0
- package/dist/hooks/usePressable.js +13 -0
- package/dist/hooks/usePressable.js.map +7 -0
- package/dist/hooks/useTheme.js +93 -0
- package/dist/hooks/useTheme.js.map +7 -0
- package/dist/index.cjs +2125 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +7 -0
- package/dist/packages/core/src/constants/constants.d.ts +8 -0
- package/dist/packages/core/src/constants/constants.d.ts.map +1 -0
- package/dist/packages/core/src/constants/platform.d.ts +9 -0
- package/dist/packages/core/src/constants/platform.d.ts.map +1 -0
- package/dist/packages/core/src/constants/pseudos.d.ts +15 -0
- package/dist/packages/core/src/constants/pseudos.d.ts.map +1 -0
- package/dist/packages/core/src/constants/rnw.d.ts +2 -0
- package/dist/packages/core/src/constants/rnw.d.ts.map +1 -0
- package/dist/packages/core/src/createComponent.d.ts +16 -0
- package/dist/packages/core/src/createComponent.d.ts.map +1 -0
- package/dist/packages/core/src/createShorthands.d.ts +2 -0
- package/dist/packages/core/src/createShorthands.d.ts.map +1 -0
- package/dist/packages/core/src/createTamagui.d.ts +37 -0
- package/dist/packages/core/src/createTamagui.d.ts.map +1 -0
- package/dist/packages/core/src/createTheme.d.ts +5 -0
- package/dist/packages/core/src/createTheme.d.ts.map +1 -0
- package/dist/packages/core/src/createTokens.d.ts +45 -0
- package/dist/packages/core/src/createTokens.d.ts.map +1 -0
- package/dist/packages/core/src/createVariable.d.ts +14 -0
- package/dist/packages/core/src/createVariable.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts +2 -0
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts +8 -0
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts +5 -0
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts +5 -0
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts +2 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts +2 -0
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts +15 -0
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts +3 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts +2 -0
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts +2 -0
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/matchMedia.d.ts +2 -0
- package/dist/packages/core/src/helpers/matchMedia.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts +3 -0
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts.map +1 -0
- package/dist/packages/core/src/helpers/themeable.d.ts +10 -0
- package/dist/packages/core/src/helpers/themeable.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useConstant.d.ts +2 -0
- package/dist/packages/core/src/hooks/useConstant.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useFeatures.d.ts +5 -0
- package/dist/packages/core/src/hooks/useFeatures.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts +2 -0
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useMedia.d.ts +16 -0
- package/dist/packages/core/src/hooks/useMedia.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/usePressable.d.ts +3 -0
- package/dist/packages/core/src/hooks/usePressable.d.ts.map +1 -0
- package/dist/packages/core/src/hooks/useTheme.d.ts +18 -0
- package/dist/packages/core/src/hooks/useTheme.d.ts.map +1 -0
- package/dist/packages/core/src/index.d.ts +27 -0
- package/dist/packages/core/src/index.d.ts.map +1 -0
- package/dist/packages/core/src/static/postProcessStyles.d.ts +7 -0
- package/dist/packages/core/src/static/postProcessStyles.d.ts.map +1 -0
- package/dist/packages/core/src/static.d.ts +12 -0
- package/dist/packages/core/src/static.d.ts.map +1 -0
- package/dist/packages/core/src/styled.d.ts +16 -0
- package/dist/packages/core/src/styled.d.ts.map +1 -0
- package/dist/packages/core/src/types.d.ts +305 -0
- package/dist/packages/core/src/types.d.ts.map +1 -0
- package/dist/packages/core/src/views/Animated.d.ts +15 -0
- package/dist/packages/core/src/views/Animated.d.ts.map +1 -0
- package/dist/packages/core/src/views/Stack.d.ts +3 -0
- package/dist/packages/core/src/views/Stack.d.ts.map +1 -0
- package/dist/packages/core/src/views/Text.d.ts +3 -0
- package/dist/packages/core/src/views/Text.d.ts.map +1 -0
- package/dist/packages/core/src/views/TextAncestorContext.d.ts +3 -0
- package/dist/packages/core/src/views/TextAncestorContext.d.ts.map +1 -0
- package/dist/packages/core/src/views/Theme.d.ts +8 -0
- package/dist/packages/core/src/views/Theme.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeContext.d.ts +18 -0
- package/dist/packages/core/src/views/ThemeContext.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeInverse.d.ts +10 -0
- package/dist/packages/core/src/views/ThemeInverse.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts +15 -0
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts.map +1 -0
- package/dist/packages/core/src/views/ThemeProvider.d.ts +10 -0
- package/dist/packages/core/src/views/ThemeProvider.d.ts.map +1 -0
- package/dist/packages/helpers/src/AllRules.d.ts +3 -0
- package/dist/packages/helpers/src/AllRules.d.ts.map +1 -0
- package/dist/packages/helpers/src/concatClassName.d.ts +2 -0
- package/dist/packages/helpers/src/concatClassName.d.ts.map +1 -0
- package/dist/packages/helpers/src/index.d.ts +5 -0
- package/dist/packages/helpers/src/index.d.ts.map +1 -0
- package/dist/packages/helpers/src/types.d.ts +8 -0
- package/dist/packages/helpers/src/types.d.ts.map +1 -0
- package/dist/packages/helpers/src/validStyleProps.d.ts +475 -0
- package/dist/packages/helpers/src/validStyleProps.d.ts.map +1 -0
- package/dist/static/postProcessStyles.js +18 -0
- package/dist/static/postProcessStyles.js.map +7 -0
- package/dist/static.js +15 -0
- package/dist/static.js.map +7 -0
- package/dist/styled.js +21 -0
- package/dist/styled.js.map +7 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +7 -0
- package/dist/views/Animated.js +79 -0
- package/dist/views/Animated.js.map +7 -0
- package/dist/views/SafeAreaProvider.js +30 -0
- package/dist/views/SafeAreaProvider.js.map +7 -0
- package/dist/views/Stack.js +12 -0
- package/dist/views/Stack.js.map +7 -0
- package/dist/views/Text.js +60 -0
- package/dist/views/Text.js.map +7 -0
- package/dist/views/TextAncestorContext.js +18 -0
- package/dist/views/TextAncestorContext.js.map +7 -0
- package/dist/views/Theme.js +56 -0
- package/dist/views/Theme.js.map +7 -0
- package/dist/views/ThemeContext.js +6 -0
- package/dist/views/ThemeContext.js.map +7 -0
- package/dist/views/ThemeInverse.js +27 -0
- package/dist/views/ThemeInverse.js.map +7 -0
- package/dist/views/ThemeManagerContext.js +55 -0
- package/dist/views/ThemeManagerContext.js.map +7 -0
- package/dist/views/ThemeProvider.js +45 -0
- package/dist/views/ThemeProvider.js.map +7 -0
- package/package.json +33 -0
- package/src/constants/constants.ts +12 -0
- package/src/constants/platform.ts +15 -0
- package/src/constants/pseudos.ts +14 -0
- package/src/constants/rnw.tsx +20 -0
- package/src/createComponent.tsx +596 -0
- package/src/createFont.ts +26 -0
- package/src/createShorthands.ts +5 -0
- package/src/createTamagui.ts +207 -0
- package/src/createTheme.ts +19 -0
- package/src/createTokens.ts +83 -0
- package/src/createVariable.ts +22 -0
- package/src/helpers/addStylesUsingClassname.tsx +60 -0
- package/src/helpers/createMediaStyle.ts +46 -0
- package/src/helpers/createPropMapper.ts +184 -0
- package/src/helpers/createTamaguiProvider.tsx +22 -0
- package/src/helpers/extendStaticConfig.ts +68 -0
- package/src/helpers/fixNativeShadow.native.tsx +27 -0
- package/src/helpers/fixNativeShadow.tsx +2 -0
- package/src/helpers/getSplitStyles.tsx +210 -0
- package/src/helpers/getStylesAtomic.native.ts +3 -0
- package/src/helpers/getStylesAtomic.ts +103 -0
- package/src/helpers/insertStyleRule.tsx +18 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/matchMedia.native.ts +3 -0
- package/src/helpers/matchMedia.ts +9 -0
- package/src/helpers/themeable.tsx +42 -0
- package/src/hooks/useConstant.tsx +10 -0
- package/src/hooks/useFeatures.tsx +78 -0
- package/src/hooks/useForceUpdate.tsx +26 -0
- package/src/hooks/useMedia.tsx +194 -0
- package/src/hooks/usePressable.tsx +9 -0
- package/src/hooks/useTheme.tsx +107 -0
- package/src/index.ts +33 -0
- package/src/static/postProcessStyles.tsx +20 -0
- package/src/static.ts +22 -0
- package/src/styled.ts +82 -0
- package/src/types.tsx +561 -0
- package/src/views/Animated.tsx +121 -0
- package/src/views/SafeAreaProvider.tsx +33 -0
- package/src/views/Stack.tsx +21 -0
- package/src/views/Text.tsx +66 -0
- package/src/views/TextAncestorContext.tsx +12 -0
- package/src/views/Theme.tsx +73 -0
- package/src/views/ThemeContext.tsx +5 -0
- package/src/views/ThemeInverse.tsx +23 -0
- package/src/views/ThemeManagerContext.tsx +50 -0
- package/src/views/ThemeProvider.tsx +52 -0
- package/tsconfig.json +8 -0
- package/types.d.ts +558 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { StaticComponent, StaticConfig, StaticConfigParsed } from '../types'
|
|
4
|
+
import { createPropMapper } from './createPropMapper'
|
|
5
|
+
|
|
6
|
+
export function extendStaticConfig(
|
|
7
|
+
// can be undefined when loading with @tamagui/fake-react-native
|
|
8
|
+
// could be fixed a bit cleaner
|
|
9
|
+
Component?: StaticComponent | React.Component<any>,
|
|
10
|
+
config: StaticConfig = {}
|
|
11
|
+
): StaticConfigParsed | null {
|
|
12
|
+
const parent = (Component || {}) as any
|
|
13
|
+
if (!parent.staticConfig) {
|
|
14
|
+
// if no static config, we are extending an external component
|
|
15
|
+
parent.staticConfig = {
|
|
16
|
+
Component,
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const variants = {
|
|
21
|
+
...parent.staticConfig.variants,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// merge variants without clobbering previous... can we tho (typed??
|
|
25
|
+
if (config.variants) {
|
|
26
|
+
for (const key in config.variants) {
|
|
27
|
+
if (variants[key]) {
|
|
28
|
+
variants[key] = {
|
|
29
|
+
...variants[key],
|
|
30
|
+
...config.variants[key],
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
variants[key] = config.variants[key]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return parseStaticConfig({
|
|
39
|
+
...parent.staticConfig,
|
|
40
|
+
isZStack: config.isZStack || parent.staticConfig.isZStack,
|
|
41
|
+
variants,
|
|
42
|
+
isText: config.isText || parent.staticConfig.isText || false,
|
|
43
|
+
neverFlatten: config.neverFlatten ?? parent.staticConfig.neverFlatten,
|
|
44
|
+
ensureOverriddenProp: config.ensureOverriddenProp ?? parent.staticConfig.ensureOverriddenProp,
|
|
45
|
+
validStyles: config.validStyles
|
|
46
|
+
? {
|
|
47
|
+
...parent.staticConfig.validStyles,
|
|
48
|
+
...config.validStyles,
|
|
49
|
+
}
|
|
50
|
+
: parent.staticConfig.validStyles,
|
|
51
|
+
validPropsExtra: {
|
|
52
|
+
...parent.staticConfig.validPropsExtra,
|
|
53
|
+
...config.validPropsExtra,
|
|
54
|
+
},
|
|
55
|
+
defaultProps: {
|
|
56
|
+
...parent.staticConfig.defaultProps,
|
|
57
|
+
...config.defaultProps,
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const parseStaticConfig = (config: StaticConfig): StaticConfigParsed => {
|
|
63
|
+
return {
|
|
64
|
+
...config,
|
|
65
|
+
parsed: true,
|
|
66
|
+
propMapper: createPropMapper(config),
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const matchRgba =
|
|
2
|
+
/rgba\(\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*,\s*([\d\.]{1,})\s*\)$/
|
|
3
|
+
|
|
4
|
+
export function fixNativeShadow(props: any) {
|
|
5
|
+
if (props.shadowColor) {
|
|
6
|
+
if (!!!('shadowOffset' in props)) {
|
|
7
|
+
// fixes some broken shadows
|
|
8
|
+
props.shadowOffset = {
|
|
9
|
+
width: 0,
|
|
10
|
+
height: 0,
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (!!!('shadowOpacity' in props)) {
|
|
14
|
+
const c = `${props.shadowColor}`
|
|
15
|
+
// react native has issues sometimes with rgba()
|
|
16
|
+
if (c[0] === 'r' && c[3] === 'a') {
|
|
17
|
+
const [_, r, g, b, a] = c.match(matchRgba) || []
|
|
18
|
+
if (typeof a !== 'string') {
|
|
19
|
+
console.warn('non valid rgba', c)
|
|
20
|
+
return props
|
|
21
|
+
}
|
|
22
|
+
props.shadowColor = `rgb(${r},${g},${b})`
|
|
23
|
+
props.shadowOpacity = +a
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AllRules,
|
|
3
|
+
stylePropsText,
|
|
4
|
+
stylePropsTransform,
|
|
5
|
+
validStyles,
|
|
6
|
+
validStylesPseudo,
|
|
7
|
+
} from '@tamagui/helpers'
|
|
8
|
+
import { ViewStyle } from 'react-native'
|
|
9
|
+
|
|
10
|
+
import { isWeb } from '../constants/platform'
|
|
11
|
+
import { mediaQueryConfig } from '../hooks/useMedia'
|
|
12
|
+
import { StaticConfigParsed, ThemeObject } from '../types'
|
|
13
|
+
import { createMediaStyle } from './createMediaStyle'
|
|
14
|
+
import { fixNativeShadow } from './fixNativeShadow'
|
|
15
|
+
import { getStylesAtomic } from './getStylesAtomic'
|
|
16
|
+
import { insertStyleRule } from './insertStyleRule'
|
|
17
|
+
|
|
18
|
+
export type SplitStyles = ReturnType<typeof getSplitStyles>
|
|
19
|
+
|
|
20
|
+
// TODO run over this, should be able to cut it down quite a bit
|
|
21
|
+
|
|
22
|
+
export const getSplitStyles = (
|
|
23
|
+
props: { [key: string]: any },
|
|
24
|
+
staticConfig: StaticConfigParsed,
|
|
25
|
+
theme: ThemeObject,
|
|
26
|
+
isSplittingDefaultProps?: boolean
|
|
27
|
+
) => {
|
|
28
|
+
const validStyleProps = staticConfig.isText ? stylePropsText : validStyles
|
|
29
|
+
const viewProps: Record<string, any> = {}
|
|
30
|
+
const style: any[] = []
|
|
31
|
+
const blacklistProps = isSplittingDefaultProps ? blacklistDefaultProps : blacklistFinalProps
|
|
32
|
+
|
|
33
|
+
let pseudos: { hoverStyle?: ViewStyle; pressStyle?: ViewStyle } | null = null
|
|
34
|
+
let cur: ViewStyle | null = null
|
|
35
|
+
let classNames: string[] | null = null
|
|
36
|
+
|
|
37
|
+
for (const keyInit in props) {
|
|
38
|
+
// be sure to sync next few lines below to getSubStyle (*1)
|
|
39
|
+
const valInit = props[keyInit]
|
|
40
|
+
|
|
41
|
+
// media
|
|
42
|
+
if (keyInit[0] === '$') {
|
|
43
|
+
const mediaKey = keyInit.slice(1)
|
|
44
|
+
|
|
45
|
+
if (!mediaQueryConfig[mediaKey]) {
|
|
46
|
+
// this isn't a media key, pass through
|
|
47
|
+
viewProps[keyInit] = valInit
|
|
48
|
+
continue
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// dont check if media is active, we just apply *all* media styles
|
|
52
|
+
// we combine the media props on top regular props, could proxy this
|
|
53
|
+
// TODO test proxy here instead of merge
|
|
54
|
+
const mediaProps = { ...props, ...valInit }
|
|
55
|
+
// TODO media + hover
|
|
56
|
+
const mediaStyle = getSubStyle(valInit, staticConfig, theme, props)
|
|
57
|
+
const mediaStyles = getStylesAtomic(mediaStyle)
|
|
58
|
+
if (process.env.NODE_ENV === 'development') {
|
|
59
|
+
if (props['debug']) {
|
|
60
|
+
console.log('mediaStyles', keyInit, { mediaProps, mediaStyle, mediaStyles })
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const style of mediaStyles) {
|
|
64
|
+
if (isWeb) {
|
|
65
|
+
const out = createMediaStyle(style, mediaKey, mediaQueryConfig)
|
|
66
|
+
classNames = classNames || []
|
|
67
|
+
classNames.push(out.identifier)
|
|
68
|
+
AllRules.add(out.styleRule)
|
|
69
|
+
insertStyleRule(out.styleRule)
|
|
70
|
+
if (process.env.NODE_ENV === 'development' && props['debug']) {
|
|
71
|
+
console.log('mediaProp', style.identifier, out, mediaProps, mediaStyle, mediaStyles)
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
console.log('TODO native media style logic')
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
continue
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// pseudo
|
|
81
|
+
if (validStylesPseudo[keyInit]) {
|
|
82
|
+
if (!valInit) continue
|
|
83
|
+
pseudos = pseudos || {}
|
|
84
|
+
pseudos[keyInit] = getSubStyle(valInit, staticConfig, theme, props)
|
|
85
|
+
continue
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const out = staticConfig.propMapper(keyInit, valInit, theme, props)
|
|
89
|
+
|
|
90
|
+
const expanded = out === true || !out ? [[keyInit, valInit]] : Object.entries(out)
|
|
91
|
+
|
|
92
|
+
for (const [key, val] of expanded) {
|
|
93
|
+
// const val = valueMap(valInit) ?? valInit
|
|
94
|
+
const keyFirstChar = key[0]
|
|
95
|
+
if (key === 'style' || (keyFirstChar === '_' && key.startsWith('_style'))) {
|
|
96
|
+
if (cur) {
|
|
97
|
+
// process last
|
|
98
|
+
fixNativeShadow(cur)
|
|
99
|
+
style.push(cur)
|
|
100
|
+
cur = null
|
|
101
|
+
}
|
|
102
|
+
fixNativeShadow(val)
|
|
103
|
+
style.push(val)
|
|
104
|
+
continue
|
|
105
|
+
}
|
|
106
|
+
// expand flex so it merged with flexShrink etc properly
|
|
107
|
+
// TODO this shouldn't be here...
|
|
108
|
+
if (key === 'flex') {
|
|
109
|
+
cur = cur || {}
|
|
110
|
+
// see spec for flex shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/flex
|
|
111
|
+
// TODO this fixed a behavior but need to find / document / test
|
|
112
|
+
Object.assign(cur, {
|
|
113
|
+
flexGrow: val,
|
|
114
|
+
flexShrink: 1,
|
|
115
|
+
})
|
|
116
|
+
continue
|
|
117
|
+
}
|
|
118
|
+
if (!isWeb && key === 'pointerEvents') {
|
|
119
|
+
viewProps[key] = val
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
122
|
+
if (validStyleProps[key]) {
|
|
123
|
+
// transforms
|
|
124
|
+
if (key in stylePropsTransform) {
|
|
125
|
+
cur = cur || {}
|
|
126
|
+
mergeTransform(cur, key, val)
|
|
127
|
+
continue
|
|
128
|
+
}
|
|
129
|
+
cur = cur || {}
|
|
130
|
+
cur[key] = val
|
|
131
|
+
continue
|
|
132
|
+
}
|
|
133
|
+
// TODO this blacklist should be configurable + better set up
|
|
134
|
+
if (!blacklistProps[key]) {
|
|
135
|
+
viewProps[key] = val
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// push last style
|
|
140
|
+
if (cur) {
|
|
141
|
+
fixNativeShadow(cur)
|
|
142
|
+
style.push(cur)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (process.env.NODE_ENV === 'development') {
|
|
146
|
+
if (props['debug']) {
|
|
147
|
+
console.log(' 🥚 splitProps:', { props, viewProps, style })
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
viewProps,
|
|
153
|
+
style,
|
|
154
|
+
pseudos,
|
|
155
|
+
classNames,
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const getSubStyle = (
|
|
160
|
+
styleIn: Object,
|
|
161
|
+
staticConfig: StaticConfigParsed,
|
|
162
|
+
theme: ThemeObject,
|
|
163
|
+
props: any
|
|
164
|
+
): ViewStyle => {
|
|
165
|
+
const styleOut: ViewStyle = {}
|
|
166
|
+
for (const key in styleIn) {
|
|
167
|
+
// be sure to sync next few lines below to loop above (*1)
|
|
168
|
+
const val = styleIn[key]
|
|
169
|
+
const out = staticConfig.propMapper(key, val, theme, props)
|
|
170
|
+
const expanded = out === true || !out ? [[key, val]] : Object.entries(out)
|
|
171
|
+
for (const [skey, sval] of expanded) {
|
|
172
|
+
// const sval = valueMap(valInit)
|
|
173
|
+
if (skey in stylePropsTransform) {
|
|
174
|
+
mergeTransform(styleOut, skey, sval)
|
|
175
|
+
} else {
|
|
176
|
+
styleOut[skey] = sval
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
fixNativeShadow(styleOut)
|
|
181
|
+
return styleOut
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const blacklistDefaultProps = {
|
|
185
|
+
...validStyles,
|
|
186
|
+
...stylePropsText,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const blacklistFinalProps = {
|
|
190
|
+
...blacklistDefaultProps,
|
|
191
|
+
tag: true,
|
|
192
|
+
debug: true,
|
|
193
|
+
space: true,
|
|
194
|
+
hitSlop: true,
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const mapTransformKeys = {
|
|
198
|
+
x: 'translateX',
|
|
199
|
+
y: 'translateY',
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const mergeTransform = (obj: ViewStyle, key: string, val: any) => {
|
|
203
|
+
const transform: any[] = obj.transform
|
|
204
|
+
? Array.isArray(obj.transform)
|
|
205
|
+
? obj.transform
|
|
206
|
+
: [obj.transform]
|
|
207
|
+
: []
|
|
208
|
+
transform.push({ [mapTransformKeys[key] || key]: val })
|
|
209
|
+
obj.transform = transform
|
|
210
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AllRules, StyleObject } from '@tamagui/helpers'
|
|
2
|
+
import { ViewStyle } from 'react-native'
|
|
3
|
+
|
|
4
|
+
import { pseudos } from '../constants/pseudos'
|
|
5
|
+
import { rnw } from '../constants/rnw'
|
|
6
|
+
|
|
7
|
+
const generateStyle = (style: any) => {
|
|
8
|
+
const { atomic, createCompileableStyle, createReactDOMStyle, i18Style } = rnw
|
|
9
|
+
return {
|
|
10
|
+
...atomic(createCompileableStyle(createReactDOMStyle(i18Style(style)))),
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const borderDefaults = {
|
|
15
|
+
borderWidth: 'borderStyle',
|
|
16
|
+
borderBottomWidth: 'borderBottomStyle',
|
|
17
|
+
borderTopWidth: 'borderTopStyle',
|
|
18
|
+
borderLeftWidth: 'borderLeftStyle',
|
|
19
|
+
borderRightWidth: 'borderRightStyle',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getStylesAtomic(style: any, avoidCollection = false) {
|
|
23
|
+
const styles: { [key: string]: ViewStyle } = {
|
|
24
|
+
base: {},
|
|
25
|
+
}
|
|
26
|
+
// split pseudos
|
|
27
|
+
for (const key in style) {
|
|
28
|
+
if (!!pseudos[key]) {
|
|
29
|
+
styles[key] = style[key]
|
|
30
|
+
} else {
|
|
31
|
+
styles.base[key] = style[key]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return Object.keys(styles)
|
|
35
|
+
.map((key) => {
|
|
36
|
+
return getAtomicStyle(styles[key], pseudos[key], avoidCollection)
|
|
37
|
+
})
|
|
38
|
+
.flat()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const importantRegex = /\!important*/g
|
|
42
|
+
|
|
43
|
+
function getAtomicStyle(
|
|
44
|
+
style: ViewStyle,
|
|
45
|
+
pseudo?: { name: string; priority: number },
|
|
46
|
+
avoidCollection?: boolean
|
|
47
|
+
): StyleObject[] {
|
|
48
|
+
if (style == null || typeof style !== 'object') {
|
|
49
|
+
throw new Error(`Wrong style type: "${typeof style}": ${style}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// why is this diff from react-native-web!? need to figure out
|
|
53
|
+
for (const key in borderDefaults) {
|
|
54
|
+
if (key in style) {
|
|
55
|
+
style[borderDefaults[key]] = style[borderDefaults[key]] ?? 'solid'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const all = generateStyle(style)
|
|
60
|
+
return Object.keys(all).map((key) => {
|
|
61
|
+
const val = all[key]
|
|
62
|
+
const hash = val.identifier.slice(`${val.identifier}`.lastIndexOf('-') + 1)
|
|
63
|
+
// pseudos have a `--` to be easier to find with concatClassNames
|
|
64
|
+
const psuedoPrefix = pseudo ? `-${pseudo.name}-` : ''
|
|
65
|
+
const identifier = `_${val.property}-${psuedoPrefix}${hash}`
|
|
66
|
+
const className = `.${identifier}`
|
|
67
|
+
const rules = val.rules.map((rule) => {
|
|
68
|
+
if (pseudo) {
|
|
69
|
+
const psuedoPrefixSelect = [...Array(pseudo.priority)].map(() => ':root').join('') + ' '
|
|
70
|
+
let res = rule
|
|
71
|
+
.replace(`.${val.identifier}`, `${psuedoPrefixSelect} ${className}`)
|
|
72
|
+
.replace('{', `:${pseudo.name}{`)
|
|
73
|
+
|
|
74
|
+
if (pseudo.name === 'hover') {
|
|
75
|
+
// hover styles need to be conditional
|
|
76
|
+
// perhaps this can be generalized but for now lets just shortcut
|
|
77
|
+
// and hardcode for hover styles, if we need to later we can
|
|
78
|
+
// WEIRD SYNTAX, SEE:
|
|
79
|
+
// https://stackoverflow.com/questions/40532204/media-query-for-devices-supporting-hover
|
|
80
|
+
res = `@media not all and (hover: none) { ${res} }`
|
|
81
|
+
}
|
|
82
|
+
return res
|
|
83
|
+
}
|
|
84
|
+
return rule.replace(`.${val.identifier}`, className).replace(importantRegex, '')
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
if (!avoidCollection) {
|
|
88
|
+
if (rules.length > 1) {
|
|
89
|
+
console.warn('have never seen more than one, verifying')
|
|
90
|
+
}
|
|
91
|
+
AllRules.add(rules[0])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const result: StyleObject = {
|
|
95
|
+
property: val.property,
|
|
96
|
+
value: val.value,
|
|
97
|
+
identifier,
|
|
98
|
+
className,
|
|
99
|
+
rules,
|
|
100
|
+
}
|
|
101
|
+
return result
|
|
102
|
+
})
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isWeb } from '../constants/platform'
|
|
2
|
+
|
|
3
|
+
export function insertStyleRule(rule: string) {
|
|
4
|
+
if (typeof window === 'undefined') {
|
|
5
|
+
return
|
|
6
|
+
}
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
if (!isWeb) {
|
|
9
|
+
console.warn('non web platform, dont use this')
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const sheet = window.document.styleSheets[0]
|
|
14
|
+
if (!sheet) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
sheet.insertRule(rule, sheet.cssRules.length)
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isObj = (x: any) => x && !Array.isArray(x) && typeof x === 'object'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { ReactElement, forwardRef } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Theme } from '../views/Theme'
|
|
4
|
+
import { ThemeInverse } from '../views/ThemeInverse'
|
|
5
|
+
|
|
6
|
+
export type ThemeableProps = {
|
|
7
|
+
theme?: string | null
|
|
8
|
+
themeInverse?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const themeable: ThemeableHOC = function graphql<
|
|
12
|
+
R extends ReactElement<any, any> | null,
|
|
13
|
+
P extends ThemeableProps = {}
|
|
14
|
+
>(component: (props: P) => R) {
|
|
15
|
+
const withThemeComponent = forwardRef(function WithTheme({ themeInverse, ...rest }: P, ref) {
|
|
16
|
+
const el = React.createElement(component, { ...rest, ref } as any) as R
|
|
17
|
+
if (themeInverse) {
|
|
18
|
+
return (<ThemeInverse>{el}</ThemeInverse>) as R
|
|
19
|
+
}
|
|
20
|
+
if (rest.theme) {
|
|
21
|
+
return (<Theme name={rest.theme || null}>{el}</Theme>) as R
|
|
22
|
+
}
|
|
23
|
+
return el
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const withTheme: {
|
|
27
|
+
(props: P): R
|
|
28
|
+
displayName: string
|
|
29
|
+
} = withThemeComponent as any
|
|
30
|
+
|
|
31
|
+
withTheme.displayName = `Themed(${
|
|
32
|
+
(component as any)?.displayName || (component as any)?.name || 'Anonymous'
|
|
33
|
+
})`
|
|
34
|
+
|
|
35
|
+
return withTheme
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ThemeableHOC {
|
|
39
|
+
<R extends ReactElement<any, any> | null, P extends ThemeableProps = {}>(
|
|
40
|
+
component: (props: P) => R
|
|
41
|
+
): (props: P) => R
|
|
42
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { isWeb, useIsomorphicLayoutEffect } from '../constants/platform'
|
|
4
|
+
import { addMediaQueryListener, removeMediaQueryListener } from './useMedia'
|
|
5
|
+
|
|
6
|
+
// only needed on native
|
|
7
|
+
// dynamic loading of features to avoid heavy views
|
|
8
|
+
|
|
9
|
+
const createDefinition = ({ Component, propNames }: { Component; propNames: string[] }) => ({
|
|
10
|
+
isEnabled: (props: any) => propNames.some((name) => !!props[name]),
|
|
11
|
+
Component,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const mediaQueryPropNames = [
|
|
15
|
+
'$xs',
|
|
16
|
+
'$sm',
|
|
17
|
+
'$md',
|
|
18
|
+
'$lg',
|
|
19
|
+
'$xl',
|
|
20
|
+
'$xxl',
|
|
21
|
+
'$pointerCoarse',
|
|
22
|
+
'$hoverNone',
|
|
23
|
+
'$tall',
|
|
24
|
+
'$short',
|
|
25
|
+
'$gtSm',
|
|
26
|
+
'$notXs',
|
|
27
|
+
'$gtMd',
|
|
28
|
+
'$gtLg',
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const featureDefinitions = {
|
|
32
|
+
measureLayout: createDefinition({
|
|
33
|
+
Component: (props) => {
|
|
34
|
+
console.log('measure', props)
|
|
35
|
+
return null
|
|
36
|
+
},
|
|
37
|
+
propNames: ['onLayout'],
|
|
38
|
+
}),
|
|
39
|
+
|
|
40
|
+
// will update the parent whenever media query changes
|
|
41
|
+
mediaQuery: createDefinition({
|
|
42
|
+
Component: (props) => {
|
|
43
|
+
if (isWeb) {
|
|
44
|
+
// no need for media queries are inserted and run in css
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const keys = mediaQueryPropNames.flatMap((x) => (x in props ? x.slice(1) : []))
|
|
49
|
+
useIsomorphicLayoutEffect(() => {
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
addMediaQueryListener(key, props._utils.forceUpdate)
|
|
52
|
+
}
|
|
53
|
+
return () => {
|
|
54
|
+
for (const key of keys) {
|
|
55
|
+
removeMediaQueryListener(key, props._utils.forceUpdate)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, [keys.join(',')])
|
|
59
|
+
return null
|
|
60
|
+
},
|
|
61
|
+
propNames: mediaQueryPropNames,
|
|
62
|
+
}),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const featureNames = Object.keys(featureDefinitions)
|
|
66
|
+
const numFeatures = featureNames.length
|
|
67
|
+
|
|
68
|
+
export const useFeatures = (props: any, utils?: { forceUpdate?: Function }) => {
|
|
69
|
+
const features: JSX.Element[] = []
|
|
70
|
+
for (let i = 0; i < numFeatures; i++) {
|
|
71
|
+
const name = featureNames[i]
|
|
72
|
+
const { isEnabled, Component } = featureDefinitions[name] as any //FeatureDefinition
|
|
73
|
+
if (isEnabled(props) && Component) {
|
|
74
|
+
features.push(<Component key={name} {...props} _utils={utils} />)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return features
|
|
78
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|