@fountain-ui/core 2.0.0-beta.14 → 2.0.0-beta.17
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/build/commonjs/ButtonBase/ButtonBase.js +3 -2
- package/build/commonjs/ButtonBase/ButtonBase.js.map +1 -1
- package/build/commonjs/CircularProgress/CircularProgress.js +15 -11
- package/build/commonjs/CircularProgress/CircularProgress.js.map +1 -1
- package/build/commonjs/Tabs/IndexAwareTab.js +13 -7
- package/build/commonjs/Tabs/IndexAwareTab.js.map +1 -1
- package/build/commonjs/Tabs/InternalContext.js +17 -0
- package/build/commonjs/Tabs/InternalContext.js.map +1 -0
- package/build/commonjs/Tabs/ScrollableTabsView.js +34 -0
- package/build/commonjs/Tabs/ScrollableTabsView.js.map +1 -0
- package/build/commonjs/Tabs/TabIndicator.js +55 -20
- package/build/commonjs/Tabs/TabIndicator.js.map +1 -1
- package/build/commonjs/Tabs/TabIndicatorProps.js.map +1 -1
- package/build/commonjs/Tabs/Tabs.js +29 -26
- package/build/commonjs/Tabs/Tabs.js.map +1 -1
- package/build/commonjs/Tabs/TabsProps.js.map +1 -1
- package/build/commonjs/Tabs/index.js.map +1 -1
- package/build/commonjs/Tabs/types.js +2 -0
- package/build/commonjs/Tabs/types.js.map +1 -0
- package/build/commonjs/Tabs/useIndexStore.js +30 -0
- package/build/commonjs/Tabs/useIndexStore.js.map +1 -0
- package/build/commonjs/Tabs/useScrollViewReaction.js +32 -25
- package/build/commonjs/Tabs/useScrollViewReaction.js.map +1 -1
- package/build/commonjs/hooks/index.js +8 -0
- package/build/commonjs/hooks/index.js.map +1 -1
- package/build/commonjs/hooks/useCollapsibleAppBar.js +1 -1
- package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useSyncAnimatedValue.js +37 -0
- package/build/commonjs/hooks/useSyncAnimatedValue.js.map +1 -0
- package/build/commonjs/hooks/useValidWindowDimensions/index.ios.js +14 -7
- package/build/commonjs/hooks/useValidWindowDimensions/index.ios.js.map +1 -1
- package/build/commonjs/index.js +14 -0
- package/build/commonjs/index.js.map +1 -1
- package/build/commonjs/store/MockStore.js +23 -0
- package/build/commonjs/store/MockStore.js.map +1 -0
- package/build/commonjs/store/SimpleStore.js +45 -0
- package/build/commonjs/store/SimpleStore.js.map +1 -0
- package/build/commonjs/store/index.js +24 -0
- package/build/commonjs/store/index.js.map +1 -0
- package/build/commonjs/store/types.js +2 -0
- package/build/commonjs/store/types.js.map +1 -0
- package/build/commonjs/types/index.js.map +1 -1
- package/build/module/ButtonBase/ButtonBase.js +3 -2
- package/build/module/ButtonBase/ButtonBase.js.map +1 -1
- package/build/module/CircularProgress/CircularProgress.js +15 -11
- package/build/module/CircularProgress/CircularProgress.js.map +1 -1
- package/build/module/Tabs/IndexAwareTab.js +12 -8
- package/build/module/Tabs/IndexAwareTab.js.map +1 -1
- package/build/module/Tabs/InternalContext.js +7 -0
- package/build/module/Tabs/InternalContext.js.map +1 -0
- package/build/module/Tabs/ScrollableTabsView.js +21 -0
- package/build/module/Tabs/ScrollableTabsView.js.map +1 -0
- package/build/module/Tabs/TabIndicator.js +51 -17
- package/build/module/Tabs/TabIndicator.js.map +1 -1
- package/build/module/Tabs/TabIndicatorProps.js.map +1 -1
- package/build/module/Tabs/Tabs.js +27 -25
- package/build/module/Tabs/Tabs.js.map +1 -1
- package/build/module/Tabs/TabsProps.js.map +1 -1
- package/build/module/Tabs/index.js.map +1 -1
- package/build/module/Tabs/types.js +2 -0
- package/build/module/Tabs/types.js.map +1 -0
- package/build/module/Tabs/useIndexStore.js +20 -0
- package/build/module/Tabs/useIndexStore.js.map +1 -0
- package/build/module/Tabs/useScrollViewReaction.js +29 -24
- package/build/module/Tabs/useScrollViewReaction.js.map +1 -1
- package/build/module/hooks/index.js +1 -0
- package/build/module/hooks/index.js.map +1 -1
- package/build/module/hooks/useCollapsibleAppBar.js +1 -1
- package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useSyncAnimatedValue.js +27 -0
- package/build/module/hooks/useSyncAnimatedValue.js.map +1 -0
- package/build/module/hooks/useValidWindowDimensions/index.ios.js +15 -9
- package/build/module/hooks/useValidWindowDimensions/index.ios.js.map +1 -1
- package/build/module/index.js +1 -0
- package/build/module/index.js.map +1 -1
- package/build/module/store/MockStore.js +14 -0
- package/build/module/store/MockStore.js.map +1 -0
- package/build/module/store/SimpleStore.js +36 -0
- package/build/module/store/SimpleStore.js.map +1 -0
- package/build/module/store/index.js +3 -0
- package/build/module/store/index.js.map +1 -0
- package/build/module/store/types.js +2 -0
- package/build/module/store/types.js.map +1 -0
- package/build/module/types/index.js.map +1 -1
- package/build/typescript/CircularProgress/CircularProgress.d.ts +1 -1
- package/build/typescript/Tabs/IndexAwareTab.d.ts +0 -2
- package/build/typescript/Tabs/InternalContext.d.ts +7 -0
- package/build/typescript/Tabs/ScrollableTabsView.d.ts +6 -0
- package/build/typescript/Tabs/TabIndicatorProps.d.ts +4 -5
- package/build/typescript/Tabs/Tabs.d.ts +2 -2
- package/build/typescript/Tabs/TabsProps.d.ts +6 -14
- package/build/typescript/Tabs/index.d.ts +2 -1
- package/build/typescript/Tabs/types.d.ts +9 -0
- package/build/typescript/Tabs/useIndexStore.d.ts +3 -0
- package/build/typescript/Tabs/useScrollViewReaction.d.ts +1 -2
- package/build/typescript/hooks/index.d.ts +1 -0
- package/build/typescript/hooks/useSyncAnimatedValue.d.ts +6 -0
- package/build/typescript/hooks/useValidWindowDimensions/index.ios.d.ts +2 -1
- package/build/typescript/index.d.ts +1 -0
- package/build/typescript/store/MockStore.d.ts +6 -0
- package/build/typescript/store/SimpleStore.d.ts +9 -0
- package/build/typescript/store/index.d.ts +3 -0
- package/build/typescript/store/types.d.ts +8 -0
- package/build/typescript/types/index.d.ts +6 -0
- package/package.json +2 -2
- package/src/ButtonBase/ButtonBase.tsx +6 -2
- package/src/CircularProgress/CircularProgress.tsx +23 -15
- package/src/Tabs/IndexAwareTab.tsx +10 -13
- package/src/Tabs/InternalContext.ts +13 -0
- package/src/Tabs/ScrollableTabsView.tsx +26 -0
- package/src/Tabs/TabIndicator.tsx +45 -21
- package/src/Tabs/TabIndicatorProps.ts +4 -5
- package/src/Tabs/Tabs.tsx +48 -46
- package/src/Tabs/TabsProps.ts +8 -26
- package/src/Tabs/index.ts +2 -1
- package/src/Tabs/types.ts +18 -0
- package/src/Tabs/useIndexStore.ts +25 -0
- package/src/Tabs/useScrollViewReaction.ts +18 -21
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCollapsibleAppBar.ts +1 -1
- package/src/hooks/useSyncAnimatedValue.ts +37 -0
- package/src/hooks/useValidWindowDimensions/index.ios.ts +16 -10
- package/src/index.ts +2 -0
- package/src/store/MockStore.ts +17 -0
- package/src/store/SimpleStore.ts +36 -0
- package/src/store/index.ts +3 -0
- package/src/store/types.ts +9 -0
- package/src/types/index.ts +7 -0
|
@@ -29,7 +29,7 @@ const ORIGINAL_SCALE = 1;
|
|
|
29
29
|
const MINIFIED_SCALE = .96; // at "node_modules/react-native/Libraries/Pressability.js"
|
|
30
30
|
// const DEFAULT_MIN_PRESS_DURATION = 130;
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const SCALE_EFFECT_PRESS_IN_DELAY = 130;
|
|
33
33
|
|
|
34
34
|
const startTimingAnimationWithDefaults = (value, toValue) => {
|
|
35
35
|
_reactNative.Animated.timing(value, {
|
|
@@ -92,13 +92,14 @@ function ButtonBase(props) {
|
|
|
92
92
|
scale
|
|
93
93
|
}]
|
|
94
94
|
};
|
|
95
|
+
const pressDelay = pressEffect === 'scale' ? SCALE_EFFECT_PRESS_IN_DELAY : 0;
|
|
95
96
|
return /*#__PURE__*/_react.default.createElement(_animated.AnimatedPressable, _extends({
|
|
96
97
|
disabled: disabled,
|
|
97
98
|
onPress: handlePress,
|
|
98
99
|
onPressIn: handlePressIn,
|
|
99
100
|
onPressOut: handlePressOut,
|
|
100
101
|
style: [animatedStyle, styleProp],
|
|
101
|
-
unstable_pressDelay:
|
|
102
|
+
unstable_pressDelay: pressDelay
|
|
102
103
|
}, otherProps), typeof children !== 'function' ? _ref => {
|
|
103
104
|
let {
|
|
104
105
|
hovered
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ORIGINAL_OPACITY","DISABLED_OPACITY","ACTIVE_OPACITY","ORIGINAL_SCALE","MINIFIED_SCALE","
|
|
1
|
+
{"version":3,"names":["ORIGINAL_OPACITY","DISABLED_OPACITY","ACTIVE_OPACITY","ORIGINAL_SCALE","MINIFIED_SCALE","SCALE_EFFECT_PRESS_IN_DELAY","startTimingAnimationWithDefaults","value","toValue","Animated","timing","duration","useNativeDriver","start","ButtonBase","props","children","disabled","disableThrottle","onPress","pressEffect","style","styleProp","throttleMillis","otherProps","handlePress","useThrottle","periodMillis","callback","opacity","useRef","Value","current","scale","useEffect","setValue","startScaleAnimation","useCallback","pressIn","isHover","startOpacityAnimation","startPressAnimation","handlePressIn","handlePressOut","animatedStyle","transform","pressDelay","hovered","undefined"],"sources":["ButtonBase.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport { useThrottle } from '../hooks';\nimport { AnimatedPressable } from '../animated';\nimport type ButtonBaseProps from './ButtonBaseProps';\n\ninterface StartPressAnimation {\n (pressIn: boolean, isHover: boolean): void;\n}\n\nexport const ORIGINAL_OPACITY = 1;\nexport const DISABLED_OPACITY = .3;\nconst ACTIVE_OPACITY = .65;\n\nconst ORIGINAL_SCALE = 1;\nconst MINIFIED_SCALE = .96;\n\n// at \"node_modules/react-native/Libraries/Pressability.js\"\n// const DEFAULT_MIN_PRESS_DURATION = 130;\nconst SCALE_EFFECT_PRESS_IN_DELAY = 130;\n\ntype TimingAnimationValue = Animated.Value | Animated.ValueXY;\ntype TimingAnimationToValue = Animated.TimingAnimationConfig['toValue'];\n\nconst startTimingAnimationWithDefaults = (\n value: TimingAnimationValue,\n toValue: TimingAnimationToValue,\n) => {\n Animated.timing(value, {\n toValue,\n duration: 150,\n useNativeDriver: true,\n }).start();\n};\n\nexport default function ButtonBase(props: ButtonBaseProps) {\n const {\n children,\n disabled = false,\n disableThrottle = false,\n onPress,\n pressEffect = 'opacity',\n style: styleProp,\n throttleMillis = 650,\n ...otherProps\n } = props;\n\n const handlePress = useThrottle({\n periodMillis: disableThrottle ? 0 : throttleMillis,\n callback: onPress,\n });\n\n const opacity = useRef<Animated.Value>(new Animated.Value(ORIGINAL_OPACITY)).current;\n const scale = useRef<Animated.Value>(new Animated.Value(ORIGINAL_SCALE)).current;\n\n useEffect(() => {\n opacity.setValue(disabled ? DISABLED_OPACITY : ORIGINAL_OPACITY);\n }, [disabled]);\n\n const startScaleAnimation = useCallback<StartPressAnimation>((pressIn, isHover) => {\n if (!isHover) {\n startTimingAnimationWithDefaults(\n scale,\n pressIn ? MINIFIED_SCALE : ORIGINAL_SCALE,\n );\n }\n }, []);\n\n const startOpacityAnimation = useCallback<StartPressAnimation>((pressIn) => {\n if (pressIn) {\n opacity.setValue(ACTIVE_OPACITY);\n } else {\n startTimingAnimationWithDefaults(opacity, ORIGINAL_OPACITY);\n }\n }, []);\n\n const startPressAnimation = useCallback<StartPressAnimation>((pressIn, isHover = false) => {\n if (pressEffect === 'scale') {\n startScaleAnimation(pressIn, isHover);\n } else if (pressEffect === 'opacity') {\n startOpacityAnimation(pressIn, isHover);\n }\n }, [pressEffect]);\n\n const handlePressIn = useCallback(() => {\n startPressAnimation(true, false);\n }, [startPressAnimation]);\n\n const handlePressOut = useCallback(() => {\n startPressAnimation(false, false);\n }, [startPressAnimation]);\n\n const animatedStyle = {\n opacity,\n transform: [{ scale }],\n };\n\n const pressDelay = pressEffect === 'scale'\n ? SCALE_EFFECT_PRESS_IN_DELAY\n : 0;\n\n return (\n <AnimatedPressable\n disabled={disabled}\n onPress={handlePress}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n style={[\n animatedStyle,\n styleProp,\n ]}\n unstable_pressDelay={pressDelay}\n {...otherProps}\n >\n {typeof children !== 'function' ? (\n ({ hovered }) => {\n if (hovered !== undefined && !disabled) {\n startPressAnimation(hovered, true);\n }\n\n return children;\n }\n ) : children}\n </AnimatedPressable>\n );\n};\n"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAOO,MAAMA,gBAAgB,GAAG,CAAzB;;AACA,MAAMC,gBAAgB,GAAG,EAAzB;;AACP,MAAMC,cAAc,GAAG,GAAvB;AAEA,MAAMC,cAAc,GAAG,CAAvB;AACA,MAAMC,cAAc,GAAG,GAAvB,C,CAEA;AACA;;AACA,MAAMC,2BAA2B,GAAG,GAApC;;AAKA,MAAMC,gCAAgC,GAAG,CACrCC,KADqC,EAErCC,OAFqC,KAGpC;EACDC,qBAAA,CAASC,MAAT,CAAgBH,KAAhB,EAAuB;IACnBC,OADmB;IAEnBG,QAAQ,EAAE,GAFS;IAGnBC,eAAe,EAAE;EAHE,CAAvB,EAIGC,KAJH;AAKH,CATD;;AAWe,SAASC,UAAT,CAAoBC,KAApB,EAA4C;EACvD,MAAM;IACFC,QADE;IAEFC,QAAQ,GAAG,KAFT;IAGFC,eAAe,GAAG,KAHhB;IAIFC,OAJE;IAKFC,WAAW,GAAG,SALZ;IAMFC,KAAK,EAAEC,SANL;IAOFC,cAAc,GAAG,GAPf;IAQF,GAAGC;EARD,IASFT,KATJ;EAWA,MAAMU,WAAW,GAAG,IAAAC,kBAAA,EAAY;IAC5BC,YAAY,EAAET,eAAe,GAAG,CAAH,GAAOK,cADR;IAE5BK,QAAQ,EAAET;EAFkB,CAAZ,CAApB;EAKA,MAAMU,OAAO,GAAG,IAAAC,aAAA,EAAuB,IAAIrB,qBAAA,CAASsB,KAAb,CAAmB/B,gBAAnB,CAAvB,EAA6DgC,OAA7E;EACA,MAAMC,KAAK,GAAG,IAAAH,aAAA,EAAuB,IAAIrB,qBAAA,CAASsB,KAAb,CAAmB5B,cAAnB,CAAvB,EAA2D6B,OAAzE;EA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AD,CAFoB,CAAvB;EAIA,MAAMG,aAAa,GAAG;IAClBf,OADkB;IAElBgB,SAAS,EAAE,CAAC;MAAEZ;IAAF,CAAD;EAFO,CAAtB;EAKA,MAAMa,UAAU,GAAG1B,WAAW,KAAK,OAAhB,GACbf,2BADa,GAEb,CAFN;EAIA,oBACI,6BAAC,2BAAD;IACI,QAAQ,EAAEY,QADd;IAEI,OAAO,EAAEQ,WAFb;IAGI,SAAS,EAAEiB,aAHf;IAII,UAAU,EAAEC,cAJhB;IAKI,KAAK,EAAE,CACHC,aADG,EAEHtB,SAFG,CALX;IASI,mBAAmB,EAAEwB;EATzB,GAUQtB,UAVR,GAYK,OAAOR,QAAP,KAAoB,UAApB,GACG,QAAiB;IAAA,IAAhB;MAAE+B;IAAF,CAAgB;;IACb,IAAIA,OAAO,KAAKC,SAAZ,IAAyB,CAAC/B,QAA9B,EAAwC;MACpCwB,mBAAmB,CAACM,OAAD,EAAU,IAAV,CAAnB;IACH;;IAED,OAAO/B,QAAP;EACH,CAPJ,GAQGA,QApBR,CADJ;AAwBH;;AAAA"}
|
|
@@ -7,7 +7,7 @@ exports.default = CircularProgress;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
12
|
var _icons = require("../internal/icons");
|
|
13
13
|
|
|
@@ -15,10 +15,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
const ANIMATION_CONFIG = {
|
|
19
|
-
duration: 900,
|
|
20
|
-
easing: _reactNativeReanimated.Easing.linear
|
|
21
|
-
};
|
|
22
18
|
const MIN_ROTATE_DEGREE = 0;
|
|
23
19
|
const MAX_ROTATE_DEGREE = 360;
|
|
24
20
|
|
|
@@ -36,16 +32,24 @@ function CircularProgress(props) {
|
|
|
36
32
|
style: styleProp
|
|
37
33
|
} = props;
|
|
38
34
|
const styles = useStyles();
|
|
39
|
-
const rotate = (0,
|
|
40
|
-
const animatedStyle =
|
|
35
|
+
const rotate = (0, _react.useRef)(new _reactNative.Animated.Value(MIN_ROTATE_DEGREE)).current;
|
|
36
|
+
const animatedStyle = {
|
|
41
37
|
transform: [{
|
|
42
|
-
rotate:
|
|
38
|
+
rotate: rotate.interpolate({
|
|
39
|
+
inputRange: [MIN_ROTATE_DEGREE, MAX_ROTATE_DEGREE],
|
|
40
|
+
outputRange: [`${MIN_ROTATE_DEGREE}deg`, `${MAX_ROTATE_DEGREE}deg`]
|
|
41
|
+
})
|
|
43
42
|
}]
|
|
44
|
-
}
|
|
43
|
+
};
|
|
45
44
|
(0, _react.useEffect)(() => {
|
|
46
|
-
|
|
45
|
+
_reactNative.Animated.loop(_reactNative.Animated.timing(rotate, {
|
|
46
|
+
toValue: MAX_ROTATE_DEGREE,
|
|
47
|
+
duration: 900,
|
|
48
|
+
easing: _reactNative.Easing.linear,
|
|
49
|
+
useNativeDriver: true
|
|
50
|
+
})).start();
|
|
47
51
|
}, []);
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
49
53
|
children: /*#__PURE__*/_react.default.createElement(_icons.CircularProgress, null),
|
|
50
54
|
style: [animatedStyle, styles.root, styleProp]
|
|
51
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["MIN_ROTATE_DEGREE","MAX_ROTATE_DEGREE","useStyles","root","alignItems","justifyContent","CircularProgress","props","style","styleProp","styles","rotate","useRef","Animated","Value","current","animatedStyle","transform","interpolate","inputRange","outputRange","useEffect","loop","timing","toValue","duration","easing","Easing","linear","useNativeDriver","start"],"sources":["CircularProgress.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { Animated, Easing } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { CircularProgress as CircularProgressIcon } from '../internal/icons';\nimport { OverridableComponentProps } from '../types';\n\ntype CircularProgressStyles = NamedStylesStringUnion<'root'>;\n\nconst MIN_ROTATE_DEGREE = 0;\nconst MAX_ROTATE_DEGREE = 360;\n\nconst useStyles: UseStyles<CircularProgressStyles> = function (): CircularProgressStyles {\n return {\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n },\n };\n};\n\nexport default function CircularProgress(props: OverridableComponentProps<ViewProps>) {\n const { style: styleProp } = props;\n\n const styles = useStyles();\n\n const rotate = useRef(new Animated.Value(MIN_ROTATE_DEGREE)).current;\n\n const animatedStyle = {\n transform: [{\n rotate: rotate.interpolate({\n inputRange: [MIN_ROTATE_DEGREE, MAX_ROTATE_DEGREE],\n outputRange: [`${MIN_ROTATE_DEGREE}deg`, `${MAX_ROTATE_DEGREE}deg`],\n }),\n }],\n };\n\n useEffect(() => {\n Animated.loop(\n Animated.timing(\n rotate,\n {\n toValue: MAX_ROTATE_DEGREE,\n duration: 900,\n easing: Easing.linear,\n useNativeDriver: true,\n },\n ),\n ).start();\n }, []);\n\n return (\n <Animated.View\n children={<CircularProgressIcon/>}\n style={[\n animatedStyle,\n styles.root,\n styleProp,\n ]}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7,18 +7,24 @@ exports.default = IndexAwareTab;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _InternalContext = _interopRequireDefault(require("./InternalContext"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
|
|
12
14
|
function IndexAwareTab(props) {
|
|
13
15
|
const {
|
|
14
16
|
children,
|
|
15
|
-
index
|
|
16
|
-
sharedIndex
|
|
17
|
+
index
|
|
17
18
|
} = props;
|
|
18
|
-
const [selected, setSelected] = (0, _react.useState)(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
19
|
+
const [selected, setSelected] = (0, _react.useState)(false);
|
|
20
|
+
const {
|
|
21
|
+
indexStore
|
|
22
|
+
} = (0, _react.useContext)(_InternalContext.default);
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
24
|
+
return indexStore.subscribe(currentIndex => {
|
|
25
|
+
setSelected(currentIndex === index);
|
|
26
|
+
});
|
|
27
|
+
}, [indexStore, index]);
|
|
22
28
|
return /*#__PURE__*/(0, _react.cloneElement)(children, {
|
|
23
29
|
selected
|
|
24
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IndexAwareTab","props","children","index","
|
|
1
|
+
{"version":3,"names":["IndexAwareTab","props","children","index","selected","setSelected","useState","indexStore","useContext","InternalContext","useEffect","subscribe","currentIndex","cloneElement"],"sources":["IndexAwareTab.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { cloneElement, useContext, useEffect, useState } from 'react';\nimport InternalContext from './InternalContext';\n\nexport interface IndexAwareTabProps {\n children: ReactElement;\n index: number;\n}\n\nexport default function IndexAwareTab(props: IndexAwareTabProps) {\n const {\n children,\n index,\n } = props;\n\n const [selected, setSelected] = useState(false);\n\n const { indexStore } = useContext(InternalContext);\n\n useEffect(() => {\n return indexStore.subscribe((currentIndex) => {\n setSelected(currentIndex === index);\n });\n }, [indexStore, index]);\n\n return cloneElement(children, { selected });\n};\n"],"mappings":";;;;;;;AACA;;AACA;;;;AAOe,SAASA,aAAT,CAAuBC,KAAvB,EAAkD;EAC7D,MAAM;IACFC,QADE;IAEFC;EAFE,IAGFF,KAHJ;EAKA,MAAM,CAACG,QAAD,EAAWC,WAAX,IAA0B,IAAAC,eAAA,EAAS,KAAT,CAAhC;EAEA,MAAM;IAAEC;EAAF,IAAiB,IAAAC,iBAAA,EAAWC,wBAAX,CAAvB;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACZ,OAAOH,UAAU,CAACI,SAAX,CAAsBC,YAAD,IAAkB;MAC1CP,WAAW,CAACO,YAAY,KAAKT,KAAlB,CAAX;IACH,CAFM,CAAP;EAGH,CAJD,EAIG,CAACI,UAAD,EAAaJ,KAAb,CAJH;EAMA,oBAAO,IAAAU,mBAAA,EAAaX,QAAb,EAAuB;IAAEE;EAAF,CAAvB,CAAP;AACH;;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _store = require("../store");
|
|
11
|
+
|
|
12
|
+
const InternalContext = /*#__PURE__*/(0, _react.createContext)({
|
|
13
|
+
indexStore: new _store.MockStore()
|
|
14
|
+
});
|
|
15
|
+
var _default = InternalContext;
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
//# sourceMappingURL=InternalContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InternalContext","createContext","indexStore","MockStore"],"sources":["InternalContext.ts"],"sourcesContent":["import { createContext } from 'react';\nimport type { MonoStore } from '../store';\nimport { MockStore } from '../store';\n\nexport interface InternalContextValue {\n indexStore: MonoStore<number>;\n}\n\nconst InternalContext = createContext<InternalContextValue>({\n indexStore: new MockStore(),\n});\n\nexport default InternalContext;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAMA,MAAMA,eAAe,gBAAG,IAAAC,oBAAA,EAAoC;EACxDC,UAAU,EAAE,IAAIC,gBAAJ;AAD4C,CAApC,CAAxB;eAIeH,e"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ScrollableTabsView;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _useScrollViewReaction = _interopRequireDefault(require("./useScrollViewReaction"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
+
|
|
18
|
+
function ScrollableTabsView(props) {
|
|
19
|
+
const {
|
|
20
|
+
coordinates,
|
|
21
|
+
...scrollViewProps
|
|
22
|
+
} = props;
|
|
23
|
+
const {
|
|
24
|
+
scrollViewRef,
|
|
25
|
+
onLayout
|
|
26
|
+
} = (0, _useScrollViewReaction.default)(coordinates);
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, _extends({
|
|
28
|
+
ref: scrollViewRef,
|
|
29
|
+
onLayout: onLayout
|
|
30
|
+
}, scrollViewProps));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
;
|
|
34
|
+
//# sourceMappingURL=ScrollableTabsView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ScrollableTabsView","props","coordinates","scrollViewProps","scrollViewRef","onLayout","useScrollViewReaction"],"sources":["ScrollableTabsView.tsx"],"sourcesContent":["import React from 'react';\nimport type { ScrollViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport TabCoordinate from './TabCoordinate';\nimport useScrollViewReaction from './useScrollViewReaction';\n\nexport interface ScrollableTabsViewProps extends ScrollViewProps {\n coordinates: TabCoordinate[];\n}\n\nexport default function ScrollableTabsView(props: ScrollableTabsViewProps) {\n const {\n coordinates,\n ...scrollViewProps\n } = props;\n\n const { scrollViewRef, onLayout } = useScrollViewReaction(coordinates);\n\n return (\n <ScrollView\n ref={scrollViewRef}\n onLayout={onLayout}\n {...scrollViewProps}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;;;AAMe,SAASA,kBAAT,CAA4BC,KAA5B,EAA4D;EACvE,MAAM;IACFC,WADE;IAEF,GAAGC;EAFD,IAGFF,KAHJ;EAKA,MAAM;IAAEG,aAAF;IAAiBC;EAAjB,IAA8B,IAAAC,8BAAA,EAAsBJ,WAAtB,CAApC;EAEA,oBACI,6BAAC,uBAAD;IACI,GAAG,EAAEE,aADT;IAEI,QAAQ,EAAEC;EAFd,GAGQF,eAHR,EADJ;AAOH;;AAAA"}
|
|
@@ -5,29 +5,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = TabIndicator;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
12
|
var _styles = require("../styles");
|
|
13
13
|
|
|
14
14
|
var _TabCoordinate = require("./TabCoordinate");
|
|
15
15
|
|
|
16
|
+
var _InternalContext = _interopRequireDefault(require("./InternalContext"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
16
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
21
|
|
|
18
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
23
|
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
24
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
25
|
|
|
26
|
+
const INDICATOR_WIDTH = 10;
|
|
27
|
+
const INDICATOR_HEIGHT = 4;
|
|
28
|
+
const SCROLLABLE_TABS_INSET = 12 * 2;
|
|
29
|
+
|
|
24
30
|
const useStyles = function () {
|
|
25
31
|
const theme = (0, _styles.useTheme)();
|
|
26
32
|
return {
|
|
27
33
|
root: {
|
|
28
34
|
backgroundColor: theme.palette.secondary.main,
|
|
35
|
+
left: 0,
|
|
29
36
|
bottom: 0,
|
|
30
|
-
|
|
37
|
+
width: INDICATOR_WIDTH,
|
|
38
|
+
height: INDICATOR_HEIGHT,
|
|
31
39
|
position: 'absolute'
|
|
32
40
|
},
|
|
33
41
|
disabled: {
|
|
@@ -36,39 +44,66 @@ const useStyles = function () {
|
|
|
36
44
|
};
|
|
37
45
|
};
|
|
38
46
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
const startAnimation = (value, toValue) => {
|
|
48
|
+
_reactNative.Animated.timing(value, {
|
|
49
|
+
toValue: toValue,
|
|
50
|
+
duration: 300,
|
|
51
|
+
easing: _reactNative.Easing.bezier(0.25, 1, 0.5, 1),
|
|
52
|
+
useNativeDriver: true
|
|
53
|
+
}).start();
|
|
42
54
|
};
|
|
43
55
|
|
|
44
56
|
function TabIndicator(props) {
|
|
45
57
|
const {
|
|
46
58
|
coordinates,
|
|
47
59
|
disabled,
|
|
60
|
+
initialIndex,
|
|
48
61
|
scrollable,
|
|
49
|
-
sharedIndex,
|
|
50
62
|
style,
|
|
51
63
|
...otherProps
|
|
52
64
|
} = props;
|
|
53
65
|
const styles = useStyles();
|
|
54
|
-
const
|
|
55
|
-
const index = sharedIndex.value;
|
|
66
|
+
const computeAnimationValues = (0, _react.useCallback)(currentIndex => {
|
|
56
67
|
const {
|
|
57
68
|
x1,
|
|
58
69
|
x2
|
|
59
|
-
} = coordinates[
|
|
70
|
+
} = coordinates[currentIndex] ?? _TabCoordinate.defaultCoordinate;
|
|
60
71
|
const tabWidth = x2 - x1;
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const nextWidth = tabWidth - totalInset;
|
|
72
|
+
const nextTranslateX = x1 + (tabWidth - INDICATOR_WIDTH) / 2;
|
|
73
|
+
const inset = scrollable ? SCROLLABLE_TABS_INSET : 0;
|
|
74
|
+
const nextScaleX = (tabWidth - inset) / INDICATOR_WIDTH;
|
|
65
75
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
tx: nextTranslateX,
|
|
77
|
+
sx: nextScaleX
|
|
68
78
|
};
|
|
69
79
|
}, [coordinates, scrollable]);
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
const {
|
|
81
|
+
tx: initialTx,
|
|
82
|
+
sx: initialSx
|
|
83
|
+
} = computeAnimationValues(initialIndex);
|
|
84
|
+
const translateX = (0, _react.useRef)(new _reactNative.Animated.Value(initialTx)).current;
|
|
85
|
+
const scaleX = (0, _react.useRef)(new _reactNative.Animated.Value(initialSx)).current;
|
|
86
|
+
const {
|
|
87
|
+
indexStore
|
|
88
|
+
} = (0, _react.useContext)(_InternalContext.default);
|
|
89
|
+
(0, _react.useEffect)(() => {
|
|
90
|
+
return indexStore.subscribe(currentIndex => {
|
|
91
|
+
const {
|
|
92
|
+
tx,
|
|
93
|
+
sx
|
|
94
|
+
} = computeAnimationValues(currentIndex);
|
|
95
|
+
startAnimation(translateX, tx);
|
|
96
|
+
startAnimation(scaleX, sx);
|
|
97
|
+
});
|
|
98
|
+
}, [indexStore, computeAnimationValues]);
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, _extends({
|
|
100
|
+
style: [styles.root, disabled ? styles.disabled : undefined, {
|
|
101
|
+
transform: [{
|
|
102
|
+
translateX
|
|
103
|
+
}, {
|
|
104
|
+
scaleX
|
|
105
|
+
}]
|
|
106
|
+
}, style]
|
|
72
107
|
}, otherProps));
|
|
73
108
|
}
|
|
74
109
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","backgroundColor","palette","secondary","main","bottom","height","position","disabled","
|
|
1
|
+
{"version":3,"names":["INDICATOR_WIDTH","INDICATOR_HEIGHT","SCROLLABLE_TABS_INSET","useStyles","theme","useTheme","root","backgroundColor","palette","secondary","main","left","bottom","width","height","position","disabled","startAnimation","value","toValue","Animated","timing","duration","easing","Easing","bezier","useNativeDriver","start","TabIndicator","props","coordinates","initialIndex","scrollable","style","otherProps","styles","computeAnimationValues","useCallback","currentIndex","x1","x2","defaultCoordinate","tabWidth","nextTranslateX","inset","nextScaleX","tx","sx","initialTx","initialSx","translateX","useRef","Value","current","scaleX","indexStore","useContext","InternalContext","useEffect","subscribe","undefined","transform"],"sources":["TabIndicator.tsx"],"sourcesContent":["import React, { useCallback, useContext, useEffect, useRef } from 'react';\nimport { Animated, Easing } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport type TabIndicatorProps from './TabIndicatorProps';\nimport { defaultCoordinate } from './TabCoordinate';\nimport InternalContext from './InternalContext';\n\ntype TabIndicatorStyles = NamedStylesStringUnion<'root' | 'disabled'>;\n\nconst INDICATOR_WIDTH = 10;\nconst INDICATOR_HEIGHT = 4;\n\nconst SCROLLABLE_TABS_INSET = 12 * 2;\n\nconst useStyles: UseStyles<TabIndicatorStyles> = function (): TabIndicatorStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: theme.palette.secondary.main,\n left: 0,\n bottom: 0,\n width: INDICATOR_WIDTH,\n height: INDICATOR_HEIGHT,\n position: 'absolute',\n },\n disabled: {\n height: 0,\n },\n };\n};\n\nconst startAnimation = (value: Animated.Value, toValue: number) => {\n Animated.timing(value, {\n toValue: toValue,\n duration: 300,\n easing: Easing.bezier(0.25, 1, 0.5, 1),\n useNativeDriver: true,\n }).start();\n};\n\nexport default function TabIndicator(props: TabIndicatorProps) {\n const {\n coordinates,\n disabled,\n initialIndex,\n scrollable,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const computeAnimationValues = useCallback((currentIndex: number) => {\n const { x1, x2 } = coordinates[currentIndex] ?? defaultCoordinate;\n\n const tabWidth = x2 - x1;\n\n const nextTranslateX = x1 + (tabWidth - INDICATOR_WIDTH) / 2;\n\n const inset = scrollable ? SCROLLABLE_TABS_INSET : 0;\n const nextScaleX = (tabWidth - inset) / INDICATOR_WIDTH;\n\n return { tx: nextTranslateX, sx: nextScaleX };\n }, [coordinates, scrollable]);\n\n const {\n tx: initialTx,\n sx: initialSx,\n } = computeAnimationValues(initialIndex);\n\n const translateX = useRef(new Animated.Value(initialTx)).current;\n const scaleX = useRef(new Animated.Value(initialSx)).current;\n\n const { indexStore } = useContext(InternalContext);\n\n useEffect(() => {\n return indexStore.subscribe(currentIndex => {\n const { tx, sx } = computeAnimationValues(currentIndex);\n\n startAnimation(translateX, tx);\n startAnimation(scaleX, sx);\n });\n }, [indexStore, computeAnimationValues]);\n\n return (\n <Animated.View\n style={[\n styles.root,\n disabled ? styles.disabled : undefined,\n { transform: [{ translateX }, { scaleX }] },\n style,\n ]}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAEA;;AACA;;;;;;;;;;AAIA,MAAMA,eAAe,GAAG,EAAxB;AACA,MAAMC,gBAAgB,GAAG,CAAzB;AAEA,MAAMC,qBAAqB,GAAG,KAAK,CAAnC;;AAEA,MAAMC,SAAwC,GAAG,YAAgC;EAC7E,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,eAAe,EAAEH,KAAK,CAACI,OAAN,CAAcC,SAAd,CAAwBC,IADvC;MAEFC,IAAI,EAAE,CAFJ;MAGFC,MAAM,EAAE,CAHN;MAIFC,KAAK,EAAEb,eAJL;MAKFc,MAAM,EAAEb,gBALN;MAMFc,QAAQ,EAAE;IANR,CADH;IASHC,QAAQ,EAAE;MACNF,MAAM,EAAE;IADF;EATP,CAAP;AAaH,CAhBD;;AAkBA,MAAMG,cAAc,GAAG,CAACC,KAAD,EAAwBC,OAAxB,KAA4C;EAC/DC,qBAAA,CAASC,MAAT,CAAgBH,KAAhB,EAAuB;IACnBC,OAAO,EAAEA,OADU;IAEnBG,QAAQ,EAAE,GAFS;IAGnBC,MAAM,EAAEC,mBAAA,CAAOC,MAAP,CAAc,IAAd,EAAoB,CAApB,EAAuB,GAAvB,EAA4B,CAA5B,CAHW;IAInBC,eAAe,EA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CAAqBrB,YAAY,IAAI;MACxC,MAAM;QAAEQ,EAAF;QAAMC;MAAN,IAAaX,sBAAsB,CAACE,YAAD,CAAzC;MAEArB,cAAc,CAACiC,UAAD,EAAaJ,EAAb,CAAd;MACA7B,cAAc,CAACqC,MAAD,EAASP,EAAT,CAAd;IACH,CALM,CAAP;EAMH,CAPD,EAOG,CAACQ,UAAD,EAAanB,sBAAb,CAPH;EASA,oBACI,6BAAC,qBAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHD,MAAM,CAAC7B,IADJ,EAEHU,QAAQ,GAAGmB,MAAM,CAACnB,QAAV,GAAqB4C,SAF1B,EAGH;MAAEC,SAAS,EAAE,CAAC;QAAEX;MAAF,CAAD,EAAiB;QAAEI;MAAF,CAAjB;IAAb,CAHG,EAIHrB,KAJG;EADX,GAOQC,UAPR,EADJ;AAWH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TabIndicatorProps.ts"],"sourcesContent":["import type { ViewProps } from 'react-native';\nimport type {
|
|
1
|
+
{"version":3,"names":[],"sources":["TabIndicatorProps.ts"],"sourcesContent":["import type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\nimport type TabCoordinate from './TabCoordinate';\n\nexport default interface TabIndicatorProps extends OverridableComponentProps<ViewProps, {\n /**\n * Tab item coordinates.\n */\n coordinates: TabCoordinate[];\n\n /**\n * If `true`, the indicator is disabled.\n */\n disabled: boolean;\n\n /**\n * Initial index.\n */\n initialIndex: number;\n\n /**\n * If `true`, the tab will be able to scroll.\n */\n scrollable: boolean;\n}> {}\n"],"mappings":""}
|
|
@@ -9,17 +9,21 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
12
|
-
var _reactNativeReanimated = require("react-native-reanimated");
|
|
13
|
-
|
|
14
12
|
var _styles = require("../styles");
|
|
15
13
|
|
|
14
|
+
var _hooks = require("../hooks");
|
|
15
|
+
|
|
16
16
|
var _TabIndicator = _interopRequireDefault(require("./TabIndicator"));
|
|
17
17
|
|
|
18
|
+
var _ScrollableTabsView = _interopRequireDefault(require("./ScrollableTabsView"));
|
|
19
|
+
|
|
18
20
|
var _IndexAwareTab = _interopRequireDefault(require("./IndexAwareTab"));
|
|
19
21
|
|
|
20
22
|
var _useTabCoordinates = _interopRequireDefault(require("./useTabCoordinates"));
|
|
21
23
|
|
|
22
|
-
var
|
|
24
|
+
var _useIndexStore = _interopRequireDefault(require("./useIndexStore"));
|
|
25
|
+
|
|
26
|
+
var _InternalContext = _interopRequireDefault(require("./InternalContext"));
|
|
23
27
|
|
|
24
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
29
|
|
|
@@ -53,18 +57,19 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(function Tabs(props, ref) {
|
|
|
53
57
|
onChange,
|
|
54
58
|
scrollable = false,
|
|
55
59
|
style,
|
|
56
|
-
variant = 'primary'
|
|
60
|
+
variant = 'primary',
|
|
61
|
+
UNSTABLE_sharedIndex
|
|
57
62
|
} = props;
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
const fallbackSharedIndex = (0, _hooks.useSyncAnimatedValue)({
|
|
64
|
+
initialValue: initialIndex
|
|
65
|
+
});
|
|
66
|
+
const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;
|
|
61
67
|
|
|
62
68
|
const setTab = newIndex => {
|
|
63
|
-
sharedIndex.
|
|
69
|
+
sharedIndex.animatedValue.setValue(newIndex);
|
|
64
70
|
};
|
|
65
71
|
|
|
66
72
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
67
|
-
getCurrentIndex,
|
|
68
73
|
setTab
|
|
69
74
|
}), [sharedIndex]);
|
|
70
75
|
const styles = useStyles();
|
|
@@ -72,10 +77,7 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(function Tabs(props, ref) {
|
|
|
72
77
|
coordinates,
|
|
73
78
|
updateCoordinate
|
|
74
79
|
} = (0, _useTabCoordinates.default)(children);
|
|
75
|
-
const
|
|
76
|
-
scrollViewRef,
|
|
77
|
-
onLayout
|
|
78
|
-
} = (0, _useScrollViewReaction.default)(sharedIndex, coordinates);
|
|
80
|
+
const indexStore = (0, _useIndexStore.default)(sharedIndex);
|
|
79
81
|
const isReadyToRenderIndicator = coordinates.length > 0;
|
|
80
82
|
|
|
81
83
|
const tabElements = _react.default.Children.map(children, (child, index) => {
|
|
@@ -104,7 +106,7 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(function Tabs(props, ref) {
|
|
|
104
106
|
|
|
105
107
|
|
|
106
108
|
const tabElement = /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
107
|
-
enableIndicator: !disableIndicator && isReadyToRenderIndicator,
|
|
109
|
+
enableIndicator: !disableIndicator && !isReadyToRenderIndicator,
|
|
108
110
|
onLayout,
|
|
109
111
|
onPress,
|
|
110
112
|
onMouseDown,
|
|
@@ -113,34 +115,35 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)(function Tabs(props, ref) {
|
|
|
113
115
|
});
|
|
114
116
|
return /*#__PURE__*/_react.default.createElement(_IndexAwareTab.default, {
|
|
115
117
|
children: tabElement,
|
|
116
|
-
index: index
|
|
117
|
-
sharedIndex: sharedIndex
|
|
118
|
+
index: index
|
|
118
119
|
});
|
|
119
120
|
});
|
|
120
121
|
|
|
121
|
-
const tabIndicator = /*#__PURE__*/_react.default.createElement(_TabIndicator.default, {
|
|
122
|
+
const tabIndicator = isReadyToRenderIndicator ? /*#__PURE__*/_react.default.createElement(_TabIndicator.default, {
|
|
122
123
|
coordinates: coordinates,
|
|
123
124
|
disabled: disableIndicator,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
initialIndex: sharedIndex.initialValue,
|
|
126
|
+
scrollable: scrollable
|
|
127
|
+
}) : null;
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement(_InternalContext.default.Provider, {
|
|
129
|
+
value: {
|
|
130
|
+
indexStore
|
|
131
|
+
}
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
130
133
|
style: (0, _styles.css)([styles.root, scrollable ? undefined : styles.fixedRoot, style])
|
|
131
|
-
}, scrollable ? /*#__PURE__*/_react.default.createElement(
|
|
134
|
+
}, scrollable ? /*#__PURE__*/_react.default.createElement(_ScrollableTabsView.default, {
|
|
132
135
|
automaticallyAdjustContentInsets: false,
|
|
133
136
|
bounces: false,
|
|
134
137
|
contentContainerStyle: styles.scrollableContainer,
|
|
138
|
+
coordinates: coordinates,
|
|
135
139
|
directionalLockEnabled: true,
|
|
136
140
|
horizontal: true,
|
|
137
|
-
ref: scrollViewRef,
|
|
138
141
|
scrollsToTop: false,
|
|
139
142
|
showsHorizontalScrollIndicator: false,
|
|
140
143
|
showsVerticalScrollIndicator: false,
|
|
141
144
|
keyboardDismissMode: keyboardDismissMode,
|
|
142
145
|
keyboardShouldPersistTaps: keyboardShouldPersistTaps
|
|
143
|
-
}, tabElements, tabIndicator) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tabElements, tabIndicator));
|
|
146
|
+
}, tabElements, tabIndicator) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tabElements, tabIndicator)));
|
|
144
147
|
});
|
|
145
148
|
var _default = Tabs;
|
|
146
149
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","fixedRoot","flexDirection","fixedTab","flex","scrollableContainer","paddingHorizontal","spacing","Tabs","forwardRef","props","ref","children","initialIndex","disableIndicator","keyboardDismissMode","keyboardShouldPersistTaps","onChange","scrollable","style","variant","
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","fixedRoot","flexDirection","fixedTab","flex","scrollableContainer","paddingHorizontal","spacing","Tabs","forwardRef","props","ref","children","initialIndex","disableIndicator","keyboardDismissMode","keyboardShouldPersistTaps","onChange","scrollable","style","variant","UNSTABLE_sharedIndex","fallbackSharedIndex","useSyncAnimatedValue","initialValue","sharedIndex","setTab","newIndex","animatedValue","setValue","useImperativeHandle","styles","coordinates","updateCoordinate","useTabCoordinates","indexStore","useIndexStore","isReadyToRenderIndicator","length","tabElements","React","Children","map","child","index","onLayout","event","x","width","nativeEvent","layout","onMouseDown","e","preventDefault","onPress","tabElement","cloneElement","enableIndicator","undefined","tabIndicator","css"],"sources":["Tabs.tsx"],"sourcesContent":["import React, { cloneElement, forwardRef, useImperativeHandle } from 'react';\nimport type { GestureResponderEvent, LayoutChangeEvent } from 'react-native';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport { useSyncAnimatedValue } from '../hooks';\nimport type TabsProps from './TabsProps';\nimport type { TabsInstance } from './types';\nimport TabIndicator from './TabIndicator';\nimport ScrollableTabsView from './ScrollableTabsView';\nimport IndexAwareTab from './IndexAwareTab';\nimport useTabCoordinates from './useTabCoordinates';\nimport useIndexStore from './useIndexStore';\nimport InternalContext from './InternalContext';\n\ntype TabsStyleKeys =\n | 'root'\n | 'fixedRoot'\n | 'fixedTab'\n | 'scrollableContainer';\n\ntype TabsStyles = NamedStylesStringUnion<TabsStyleKeys>;\n\nconst useStyles: UseStyles<TabsStyles> = function (): TabsStyles {\n const theme = useTheme();\n\n return {\n root: {},\n fixedRoot: {\n flexDirection: 'row',\n },\n fixedTab: {\n flex: 1,\n },\n scrollableContainer: {\n paddingHorizontal: theme.spacing(1),\n },\n };\n};\n\nconst Tabs = forwardRef<TabsInstance, TabsProps>(function Tabs(props, ref) {\n const {\n children,\n initialIndex = 0,\n disableIndicator = false,\n keyboardDismissMode = 'none',\n keyboardShouldPersistTaps = 'never',\n onChange,\n scrollable = false,\n style,\n variant = 'primary',\n UNSTABLE_sharedIndex,\n } = props;\n\n const fallbackSharedIndex = useSyncAnimatedValue({ initialValue: initialIndex });\n\n const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;\n\n const setTab = (newIndex: number) => {\n sharedIndex.animatedValue.setValue(newIndex);\n };\n\n useImperativeHandle(\n ref,\n () => ({\n setTab,\n }),\n [sharedIndex],\n );\n\n const styles = useStyles();\n\n const { coordinates, updateCoordinate } = useTabCoordinates(children);\n\n const indexStore = useIndexStore(sharedIndex);\n\n const isReadyToRenderIndicator = coordinates.length > 0;\n\n const tabElements = React.Children.map(children, (child, index) => {\n const onLayout = (event: LayoutChangeEvent) => {\n const { x, width } = event.nativeEvent.layout;\n\n updateCoordinate(index, x, width);\n };\n\n const onMouseDown = (e: GestureResponderEvent) => {\n if (keyboardShouldPersistTaps === 'always') {\n e.preventDefault();\n }\n };\n\n const onPress = () => {\n setTab(index);\n\n onChange?.(index);\n // @ts-ignore\n child.props.onPress?.();\n };\n\n // @ts-ignore\n const tabElement = cloneElement(child, {\n enableIndicator: !disableIndicator && !isReadyToRenderIndicator,\n onLayout,\n onPress,\n onMouseDown,\n variant,\n style: scrollable ? undefined : styles.fixedTab,\n });\n\n return (\n <IndexAwareTab\n children={tabElement}\n index={index}\n />\n );\n });\n\n const tabIndicator = isReadyToRenderIndicator ? (\n <TabIndicator\n coordinates={coordinates}\n disabled={disableIndicator}\n initialIndex={sharedIndex.initialValue}\n scrollable={scrollable}\n />\n ) : null;\n\n return (\n <InternalContext.Provider value={{ indexStore }}>\n <View\n style={css([\n styles.root,\n scrollable ? undefined : styles.fixedRoot,\n style,\n ])}\n >\n {scrollable ? (\n <ScrollableTabsView\n automaticallyAdjustContentInsets={false}\n bounces={false}\n contentContainerStyle={styles.scrollableContainer}\n coordinates={coordinates}\n directionalLockEnabled={true}\n horizontal={true}\n scrollsToTop={false}\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n keyboardDismissMode={keyboardDismissMode}\n keyboardShouldPersistTaps={keyboardShouldPersistTaps}\n >\n {tabElements}\n {tabIndicator}\n </ScrollableTabsView>\n ) : (\n <React.Fragment>\n {tabElements}\n {tabIndicator}\n </React.Fragment>\n )}\n </View>\n </InternalContext.Provider>\n );\n});\n\nexport default Tabs;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAUA,MAAMA,SAAgC,GAAG,YAAwB;EAC7D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,SAAS,EAAE;MACPC,aAAa,EAAE;IADR,CAFR;IAKHC,QAAQ,EAAE;MACNC,IAAI,EAAE;IADA,CALP;IAQHC,mBAAmB,EAAE;MACjBC,iBAAiB,EAAER,KAAK,CAACS,OAAN,CAAc,CAAd;IADF;EARlB,CAAP;AAYH,CAfD;;AAiBA,MAAMC,IAAI,gBAAG,IAAAC,iBAAA,EAAoC,SAASD,IAAT,CAAcE,KAAd,EAAqBC,GAArB,EAA0B;EACvE,MAAM;IACFC,QADE;IAEFC,YAAY,GAAG,CAFb;IAGFC,gBAAgB,GAAG,KAHjB;IAIFC,mBAAmB,GAAG,MAJpB;IAKFC,yBAAyB,GAAG,OAL1B;IAMFC,QANE;IAOFC,UAAU,GAAG,KAPX;IAQFC,KARE;IASFC,OAAO,GAAG,SATR;IAUFC;EAVE,IAWFX,KAXJ;EAaA,MAAMY,mBAAmB,GAAG,IAAAC,2BAAA,EAAqB;IAAEC,YAAY,EAAEX;EAAhB,CAArB,CAA5B;EAEA,MAAMY,WAAW,GAAGJ,oBAAoB,IAAIC,mBAA5C;;EAEA,MAAMI,MAAM,GAAIC,QAAD,IAAsB;IACjCF,WAAW,CAACG,aAAZ,CAA0BC,QAA1B,CAAmCF,QAAnC;EACH,CAFD;;EAIA,IAAAG,0BAAA,EACInB,GADJ,EAEI,OAAO;IACHe;EADG,CAAP,CAFJ,EAKI,CAACD,WAAD,CALJ;EAQA,MAA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,UADd;MAEI,KAAK,EAAEX;IAFX,EADJ;EAMH,CArCmB,CAApB;;EAuCA,MAAMe,YAAY,GAAGtB,wBAAwB,gBACzC,6BAAC,qBAAD;IACI,WAAW,EAAEL,WADjB;IAEI,QAAQ,EAAElB,gBAFd;IAGI,YAAY,EAAEW,WAAW,CAACD,YAH9B;IAII,UAAU,EAAEN;EAJhB,EADyC,GAOzC,IAPJ;EASA,oBACI,6BAAC,wBAAD,CAAiB,QAAjB;IAA0B,KAAK,EAAE;MAAEiB;IAAF;EAAjC,gBACI,6BAAC,iBAAD;IACI,KAAK,EAAE,IAAAyB,WAAA,EAAI,CACP7B,MAAM,CAAC/B,IADA,EAEPkB,UAAU,GAAGwC,SAAH,GAAe3B,MAAM,CAAC9B,SAFzB,EAGPkB,KAHO,CAAJ;EADX,GAOKD,UAAU,gBACP,6BAAC,2BAAD;IACI,gCAAgC,EAAE,KADtC;IAEI,OAAO,EAAE,KAFb;IAGI,qBAAqB,EAAEa,MAAM,CAAC1B,mBAHlC;IAII,WAAW,EAAE2B,WAJjB;IAKI,sBAAsB,EAAE,IAL5B;IAMI,UAAU,EAAE,IANhB;IAOI,YAAY,EAAE,KAPlB;IAQI,8BAA8B,EAAE,KARpC;IASI,4BAA4B,EAAE,KATlC;IAUI,mBAAmB,EAAEjB,mBAVzB;IAWI,yBAAyB,EAAEC;EAX/B,GAaKuB,WAbL,EAcKoB,YAdL,CADO,gBAkBP,6BAAC,cAAD,CAAO,QAAP,QACKpB,WADL,EAEKoB,YAFL,CAzBR,CADJ,CADJ;AAmCH,CAzHY,CAAb;eA2HenD,I"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["TabsProps.ts"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { TabVariant } from '../Tab';\nimport type { OverridableComponentProps } from '../types';\
|
|
1
|
+
{"version":3,"names":[],"sources":["TabsProps.ts"],"sourcesContent":["import type { ReactNode, Ref } from 'react';\nimport type { Animated, ViewProps } from 'react-native';\nimport type { TabVariant } from '../Tab';\nimport type { OverridableComponentProps, SyncAnimatedValue } from '../types';\nimport type { KeyboardDismissMode, KeyboardShouldPersistTaps, TabsInstance } from './types';\n\nexport default interface TabsProps extends OverridableComponentProps<ViewProps, {\n ref?: Ref<TabsInstance>;\n\n /**\n * Collection of Tab components.\n */\n children: ReactNode;\n\n /**\n * If `true`, the indicator is disabled.\n * @default false\n */\n disableIndicator?: boolean;\n\n /**\n * Index of initial tab that should be selected.\n * @default 0\n */\n initialIndex?: number;\n\n /**\n * keyboard dismissing condition of dragging.\n * @default 'none'\n */\n keyboardDismissMode?: KeyboardDismissMode,\n\n /**\n * keyboard persisting condition of tapping.\n * @default 'never'\n */\n keyboardShouldPersistTaps?: KeyboardShouldPersistTaps,\n\n /**\n * Callback fired when a tab is selected.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * If `true`, the component will be able to scroll.\n * @default false\n */\n scrollable?: boolean;\n\n /**\n * Unstable API.\n */\n UNSTABLE_sharedIndex?: SyncAnimatedValue;\n\n /**\n * The variant to use.\n * @default 'primary'\n */\n variant?: TabVariant;\n}> {}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Tabs';\nexport type { default as TabsProps
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Tabs';\nexport type { default as TabsProps } from './TabsProps';\nexport type { TabsInstance } from './types';\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type KeyboardDismissMode =\n 'none'\n | 'on-drag'\n | 'interactive'; // ios only\n\nexport type KeyboardShouldPersistTaps =\n 'never'\n | boolean\n | 'always'\n | 'handled'; // app only\n\nexport interface TabsInstance {\n /**\n * Function to scroll to a specific tab. Invalid index is ignored.\n * @param index\n */\n setTab: (index: number) => void;\n}\n"],"mappings":""}
|