@pagopa/io-app-design-system 4.2.0 → 4.3.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/lib/commonjs/components/alert/Alert.js +10 -31
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js +9 -29
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +10 -34
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +20 -53
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +24 -44
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +14 -39
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +13 -32
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +19 -42
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonSolid.js +15 -31
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/lib/commonjs/components/layout/index.js +0 -11
- package/lib/commonjs/components/layout/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js +16 -41
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +13 -41
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemHeader.js +2 -2
- package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +15 -43
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +17 -48
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js +19 -50
- package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +20 -50
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +13 -25
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +4 -5
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
- package/lib/commonjs/components/listitems/PressableListItemBase.js.map +1 -0
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +45 -81
- package/lib/commonjs/components/listitems/__test__/listitem.test.js +3 -3
- package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/commonjs/components/listitems/index.js +11 -11
- package/lib/commonjs/components/listitems/index.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleCredential.js +35 -28
- package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
- package/lib/commonjs/components/modules/PressableModuleBase.js +17 -11
- package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/commonjs/components/modules/index.js +8 -8
- package/lib/commonjs/components/modules/index.js.map +1 -1
- package/lib/commonjs/components/numberpad/NumberButton.js +12 -28
- package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
- package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +20 -0
- package/lib/commonjs/components/stack/Stack.js +4 -3
- package/lib/commonjs/components/stack/Stack.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +15 -21
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/typography/H6.js +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
- package/lib/commonjs/core/IOAnimations.js +6 -12
- package/lib/commonjs/core/IOAnimations.js.map +1 -1
- package/lib/commonjs/hooks/index.js +28 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useListItemAnimation.js +40 -0
- package/lib/commonjs/hooks/useListItemAnimation.js.map +1 -0
- package/lib/commonjs/hooks/useScaleAnimation.js +36 -0
- package/lib/commonjs/hooks/useScaleAnimation.js.map +1 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/fonts.js +1 -1
- package/lib/commonjs/utils/hooks/index.js +28 -0
- package/lib/commonjs/utils/hooks/index.js.map +1 -0
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js +5 -7
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js.map +1 -1
- package/lib/module/components/alert/Alert.js +10 -32
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/alert/AlertEdgeToEdge.js +10 -31
- package/lib/module/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/module/components/banner/Banner.js +10 -33
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
- package/lib/module/components/buttons/ButtonLink.js +23 -56
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +27 -47
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +17 -42
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +16 -35
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +21 -45
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js +17 -34
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/lib/module/components/layout/index.js +0 -1
- package/lib/module/components/layout/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js +17 -43
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +15 -43
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemHeader.js +2 -2
- package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +16 -45
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +17 -47
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/components/listitems/ListItemNavAlert.js +19 -49
- package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +22 -52
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +14 -26
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +3 -4
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
- package/lib/module/components/listitems/PressableListItemBase.js.map +1 -0
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +45 -81
- package/lib/module/components/listitems/__test__/listitem.test.js +1 -1
- package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/module/components/listitems/index.js +1 -1
- package/lib/module/components/listitems/index.js.map +1 -1
- package/lib/module/components/modules/ModuleCredential.js +36 -29
- package/lib/module/components/modules/ModuleCredential.js.map +1 -1
- package/lib/module/components/modules/PressableModuleBase.js +17 -10
- package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/module/components/modules/index.js +1 -1
- package/lib/module/components/modules/index.js.map +1 -1
- package/lib/module/components/numberpad/NumberButton.js +14 -30
- package/lib/module/components/numberpad/NumberButton.js.map +1 -1
- package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +20 -0
- package/lib/module/components/stack/Stack.js +4 -3
- package/lib/module/components/stack/Stack.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +18 -24
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/typography/H6.js +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
- package/lib/module/core/IOAnimations.js +4 -10
- package/lib/module/core/IOAnimations.js.map +1 -1
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useListItemAnimation.js +33 -0
- package/lib/module/hooks/useListItemAnimation.js.map +1 -0
- package/lib/module/hooks/useScaleAnimation.js +29 -0
- package/lib/module/hooks/useScaleAnimation.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/fonts.js +1 -1
- package/lib/module/utils/hooks/index.js +3 -0
- package/lib/module/utils/hooks/index.js.map +1 -0
- package/lib/module/utils/hooks/useSpringPressProgressValue.js +5 -5
- package/lib/module/utils/hooks/useSpringPressProgressValue.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/alert/AlertEdgeToEdge.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/layout/index.d.ts +0 -1
- package/lib/typescript/components/layout/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/{PressableListItemsBase.d.ts → PressableListItemBase.d.ts} +3 -2
- package/lib/typescript/components/listitems/PressableListItemBase.d.ts.map +1 -0
- package/lib/typescript/components/listitems/index.d.ts +1 -1
- package/lib/typescript/components/listitems/index.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleCredential.d.ts +2 -2
- package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
- package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/index.d.ts +1 -1
- package/lib/typescript/components/modules/index.d.ts.map +1 -1
- package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
- package/lib/typescript/components/stack/Stack.d.ts +4 -3
- package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/core/IOAnimations.d.ts +6 -10
- package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +3 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useListItemAnimation.d.ts +10 -0
- package/lib/typescript/hooks/useListItemAnimation.d.ts.map +1 -0
- package/lib/typescript/hooks/useScaleAnimation.d.ts +10 -0
- package/lib/typescript/hooks/useScaleAnimation.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/fonts.d.ts +1 -1
- package/lib/typescript/utils/hooks/index.d.ts +3 -0
- package/lib/typescript/utils/hooks/index.d.ts.map +1 -0
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts +7 -8
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/alert/Alert.tsx +7 -46
- package/src/components/alert/AlertEdgeToEdge.tsx +6 -46
- package/src/components/banner/Banner.tsx +6 -52
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
- package/src/components/buttons/ButtonLink.tsx +32 -89
- package/src/components/buttons/ButtonOutline.tsx +26 -60
- package/src/components/buttons/ButtonSolid.tsx +11 -58
- package/src/components/buttons/IconButton.tsx +10 -47
- package/src/components/buttons/IconButtonContained.tsx +21 -57
- package/src/components/buttons/IconButtonSolid.tsx +15 -46
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/src/components/layout/index.tsx +0 -1
- package/src/components/listitems/ListItemAction.tsx +11 -67
- package/src/components/listitems/ListItemCheckbox.tsx +10 -68
- package/src/components/listitems/ListItemHeader.tsx +2 -2
- package/src/components/listitems/ListItemInfoCopy.tsx +11 -71
- package/src/components/listitems/ListItemNav.tsx +13 -74
- package/src/components/listitems/ListItemNavAlert.tsx +18 -92
- package/src/components/listitems/ListItemRadio.tsx +14 -75
- package/src/components/listitems/ListItemRadioWithAmount.tsx +16 -31
- package/src/components/listitems/ListItemTransaction.tsx +3 -7
- package/src/components/listitems/{PressableListItemsBase.tsx → PressableListItemBase.tsx} +7 -6
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +45 -81
- package/src/components/listitems/__test__/listitem.test.tsx +1 -1
- package/src/components/listitems/index.tsx +1 -1
- package/src/components/modules/ModuleCredential.tsx +49 -39
- package/src/components/modules/PressableModuleBase.tsx +15 -8
- package/src/components/modules/index.tsx +1 -1
- package/src/components/numberpad/NumberButton.tsx +12 -43
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +20 -0
- package/src/components/stack/Stack.tsx +11 -3
- package/src/components/tabs/TabItem.tsx +15 -29
- package/src/components/typography/H6.tsx +1 -1
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
- package/src/core/IOAnimations.ts +8 -10
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/useListItemAnimation.tsx +59 -0
- package/src/hooks/useScaleAnimation.tsx +41 -0
- package/src/index.tsx +1 -0
- package/src/utils/fonts.ts +1 -1
- package/src/utils/hooks/index.tsx +2 -0
- package/src/utils/hooks/useSpringPressProgressValue.ts +14 -8
- package/lib/commonjs/components/layout/FooterWithButtons.js +0 -84
- package/lib/commonjs/components/layout/FooterWithButtons.js.map +0 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +0 -1
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js +0 -56
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
- package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js +0 -41
- package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
- package/lib/module/components/layout/FooterWithButtons.js +0 -75
- package/lib/module/components/layout/FooterWithButtons.js.map +0 -1
- package/lib/module/components/listitems/PressableListItemsBase.js.map +0 -1
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js +0 -47
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
- package/lib/module/components/modules/hooks/useModuleSpringAnimation.js +0 -34
- package/lib/module/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
- package/lib/typescript/components/layout/FooterWithButtons.d.ts +0 -16
- package/lib/typescript/components/layout/FooterWithButtons.d.ts.map +0 -1
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +0 -1
- package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts +0 -13
- package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts.map +0 -1
- package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts +0 -10
- package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts.map +0 -1
- package/src/components/layout/FooterWithButtons.tsx +0 -90
- package/src/components/listitems/hooks/useListItemSpringAnimation.ts +0 -72
- package/src/components/modules/hooks/useModuleSpringAnimation.ts +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
AccessibilityRole,
|
|
4
4
|
GestureResponderEvent,
|
|
@@ -7,28 +7,19 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
ViewStyle
|
|
9
9
|
} from "react-native";
|
|
10
|
-
import Animated
|
|
11
|
-
Extrapolation,
|
|
12
|
-
interpolate,
|
|
13
|
-
SharedValue,
|
|
14
|
-
useAnimatedStyle,
|
|
15
|
-
useDerivedValue,
|
|
16
|
-
useSharedValue,
|
|
17
|
-
withSpring
|
|
18
|
-
} from "react-native-reanimated";
|
|
10
|
+
import Animated from "react-native-reanimated";
|
|
19
11
|
import {
|
|
20
12
|
IOBannerBigSpacing,
|
|
21
13
|
IOBannerRadius,
|
|
22
14
|
IOBannerSmallHSpacing,
|
|
23
15
|
IOBannerSmallVSpacing,
|
|
24
|
-
IOScaleValues,
|
|
25
|
-
IOSpringValues,
|
|
26
16
|
IOStyles,
|
|
27
17
|
useIOExperimentalDesign,
|
|
28
18
|
useIOTheme,
|
|
29
19
|
useIOThemeContext
|
|
30
20
|
} from "../../core";
|
|
31
21
|
import { hexToRgba, IOColors } from "../../core/IOColors";
|
|
22
|
+
import { useScaleAnimation } from "../../hooks";
|
|
32
23
|
import { WithTestID } from "../../utils/types";
|
|
33
24
|
import { IconButton } from "../buttons";
|
|
34
25
|
import {
|
|
@@ -159,7 +150,8 @@ export const Banner = ({
|
|
|
159
150
|
accessibilityLabel,
|
|
160
151
|
testID
|
|
161
152
|
}: Banner) => {
|
|
162
|
-
const
|
|
153
|
+
const { onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
154
|
+
useScaleAnimation("medium");
|
|
163
155
|
|
|
164
156
|
const { isExperimental } = useIOExperimentalDesign();
|
|
165
157
|
const { themeType } = useIOThemeContext();
|
|
@@ -181,40 +173,6 @@ export const Banner = ({
|
|
|
181
173
|
paddingHorizontal: size === "big" ? sizeBigPadding : sizeSmallHPadding
|
|
182
174
|
};
|
|
183
175
|
|
|
184
|
-
// Scaling transformation applied when the button is pressed
|
|
185
|
-
const animationScaleValue = IOScaleValues?.magnifiedButton?.pressedState;
|
|
186
|
-
|
|
187
|
-
// Using a spring-based animation for our interpolations
|
|
188
|
-
const progressPressed = useDerivedValue(() =>
|
|
189
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
// Interpolate animation values from `isPressed` values
|
|
193
|
-
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
194
|
-
// Link color states to the pressed states
|
|
195
|
-
|
|
196
|
-
// Scale down button slightly when pressed
|
|
197
|
-
const scale = interpolate(
|
|
198
|
-
progressPressed.value,
|
|
199
|
-
[0, 1],
|
|
200
|
-
[1, animationScaleValue],
|
|
201
|
-
Extrapolation.CLAMP
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
transform: [{ scale }]
|
|
206
|
-
};
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
const onPressIn = useCallback(() => {
|
|
210
|
-
// eslint-disable-next-line functional/immutable-data
|
|
211
|
-
isPressed.value = 1;
|
|
212
|
-
}, [isPressed]);
|
|
213
|
-
const onPressOut = useCallback(() => {
|
|
214
|
-
// eslint-disable-next-line functional/immutable-data
|
|
215
|
-
isPressed.value = 0;
|
|
216
|
-
}, [isPressed]);
|
|
217
|
-
|
|
218
176
|
/* Generates a complete fallbackAccessibilityLabel by concatenating the title, content, and action
|
|
219
177
|
if they are present. */
|
|
220
178
|
const fallbackAccessibilityLabel = [title, content, action]
|
|
@@ -305,11 +263,7 @@ export const Banner = ({
|
|
|
305
263
|
accessible={false}
|
|
306
264
|
>
|
|
307
265
|
<Animated.View
|
|
308
|
-
style={[
|
|
309
|
-
styles.container,
|
|
310
|
-
dynamicContainerStyles,
|
|
311
|
-
pressedAnimationStyle
|
|
312
|
-
]}
|
|
266
|
+
style={[styles.container, dynamicContainerStyles, scaleAnimatedStyle]}
|
|
313
267
|
>
|
|
314
268
|
{renderMainBlock()}
|
|
315
269
|
</Animated.View>
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { forwardRef, useMemo } from "react";
|
|
2
2
|
import { GestureResponderEvent, Pressable, View } from "react-native";
|
|
3
3
|
import Animated, {
|
|
4
|
-
Extrapolate,
|
|
5
|
-
interpolate,
|
|
6
4
|
interpolateColor,
|
|
7
|
-
useAnimatedProps,
|
|
8
5
|
useAnimatedStyle,
|
|
9
|
-
|
|
10
|
-
useSharedValue,
|
|
11
|
-
withSpring
|
|
6
|
+
useReducedMotion
|
|
12
7
|
} from "react-native-reanimated";
|
|
13
8
|
import {
|
|
14
9
|
IOButtonStyles,
|
|
15
10
|
IOColors,
|
|
16
|
-
|
|
17
|
-
IOSpringValues,
|
|
11
|
+
IOSpacingScale,
|
|
18
12
|
hexToRgba,
|
|
19
13
|
useIOExperimentalDesign
|
|
20
14
|
} from "../../core";
|
|
15
|
+
import { useScaleAnimation } from "../../hooks";
|
|
21
16
|
import { WithTestID } from "../../utils/types";
|
|
22
17
|
import {
|
|
23
18
|
AnimatedIcon,
|
|
@@ -25,7 +20,6 @@ import {
|
|
|
25
20
|
IOIcons,
|
|
26
21
|
IconClassComponent
|
|
27
22
|
} from "../icons";
|
|
28
|
-
import { HSpacer } from "../spacer/Spacer";
|
|
29
23
|
import { IOText, buttonTextFontSize } from "../typography";
|
|
30
24
|
|
|
31
25
|
export type ColorButtonLink = "primary" | "contrast";
|
|
@@ -97,7 +91,7 @@ const mapLegacyColorStates: Record<
|
|
|
97
91
|
|
|
98
92
|
const DISABLED_OPACITY = 0.5;
|
|
99
93
|
|
|
100
|
-
export const ButtonLink =
|
|
94
|
+
export const ButtonLink = forwardRef<View, ButtonLinkProps>(
|
|
101
95
|
(
|
|
102
96
|
{
|
|
103
97
|
color = "primary",
|
|
@@ -112,8 +106,10 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
112
106
|
},
|
|
113
107
|
ref
|
|
114
108
|
) => {
|
|
115
|
-
const isPressed = useSharedValue(0);
|
|
116
109
|
const { isExperimental } = useIOExperimentalDesign();
|
|
110
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
111
|
+
useScaleAnimation();
|
|
112
|
+
const reducedMotion = useReducedMotion();
|
|
117
113
|
|
|
118
114
|
const colorMap = useMemo(
|
|
119
115
|
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
@@ -122,70 +118,20 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
122
118
|
|
|
123
119
|
const AnimatedIOText = Animated.createAnimatedComponent(IOText);
|
|
124
120
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// Using a spring-based animation for our interpolations
|
|
129
|
-
const progressPressed = useDerivedValue(() =>
|
|
130
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
// Interpolate animation values from `isPressed` values
|
|
134
|
-
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
135
|
-
// Link color states to the pressed states
|
|
136
|
-
|
|
137
|
-
// Scale down button slightly when pressed
|
|
138
|
-
const scale = interpolate(
|
|
139
|
-
progressPressed.value,
|
|
140
|
-
[0, 1],
|
|
141
|
-
[1, animationScaleValue],
|
|
142
|
-
Extrapolate.CLAMP
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
transform: [{ scale }]
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
|
|
151
|
-
// Link color states to the pressed states
|
|
152
|
-
|
|
153
|
-
const labelColor = interpolateColor(
|
|
154
|
-
progressPressed.value,
|
|
121
|
+
const pressedColorAnimationStyle = useAnimatedStyle(() => ({
|
|
122
|
+
color: interpolateColor(
|
|
123
|
+
progress.value,
|
|
155
124
|
[0, 1],
|
|
156
125
|
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
color: labelColor
|
|
161
|
-
};
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// Animate the <Icon> color prop
|
|
165
|
-
const pressedColorIconAnimationStyle = useAnimatedProps(() => {
|
|
166
|
-
const iconColor = interpolateColor(
|
|
167
|
-
progressPressed.value,
|
|
168
|
-
[0, 1],
|
|
169
|
-
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
return { color: iconColor };
|
|
173
|
-
});
|
|
126
|
+
)
|
|
127
|
+
}));
|
|
174
128
|
|
|
175
129
|
const AnimatedIconClassComponent =
|
|
176
130
|
Animated.createAnimatedComponent(IconClassComponent);
|
|
177
131
|
|
|
178
|
-
const onPressIn = useCallback(() => {
|
|
179
|
-
// eslint-disable-next-line functional/immutable-data
|
|
180
|
-
isPressed.value = 1;
|
|
181
|
-
}, [isPressed]);
|
|
182
|
-
const onPressOut = useCallback(() => {
|
|
183
|
-
// eslint-disable-next-line functional/immutable-data
|
|
184
|
-
isPressed.value = 0;
|
|
185
|
-
}, [isPressed]);
|
|
186
|
-
|
|
187
132
|
// Icon size
|
|
188
133
|
const iconSize: IOIconSizeScale = 24;
|
|
134
|
+
const iconMargin: IOSpacingScale = 8;
|
|
189
135
|
|
|
190
136
|
return (
|
|
191
137
|
<Pressable
|
|
@@ -208,31 +154,28 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
208
154
|
style={[
|
|
209
155
|
IOButtonStyles.buttonLink,
|
|
210
156
|
iconPosition === "end" && { flexDirection: "row-reverse" },
|
|
157
|
+
{ columnGap: iconMargin },
|
|
211
158
|
disabled ? { opacity: DISABLED_OPACITY } : {},
|
|
212
159
|
/* Prevent Reanimated from overriding background colors
|
|
213
160
|
if button is disabled */
|
|
214
|
-
!disabled &&
|
|
161
|
+
!disabled && !reducedMotion && scaleAnimatedStyle
|
|
215
162
|
]}
|
|
216
163
|
>
|
|
217
|
-
{icon &&
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
)}
|
|
233
|
-
<HSpacer size={8} />
|
|
234
|
-
</>
|
|
235
|
-
)}
|
|
164
|
+
{icon &&
|
|
165
|
+
(!disabled ? (
|
|
166
|
+
<AnimatedIconClassComponent
|
|
167
|
+
name={icon}
|
|
168
|
+
animatedProps={pressedColorAnimationStyle}
|
|
169
|
+
color={colorMap[color]?.label?.default}
|
|
170
|
+
size={iconSize}
|
|
171
|
+
/>
|
|
172
|
+
) : (
|
|
173
|
+
<AnimatedIcon
|
|
174
|
+
name={icon}
|
|
175
|
+
color={colorMap[color]?.label?.disabled}
|
|
176
|
+
size={iconSize}
|
|
177
|
+
/>
|
|
178
|
+
))}
|
|
236
179
|
<AnimatedIOText
|
|
237
180
|
accessible={false}
|
|
238
181
|
accessibilityElementsHidden
|
|
@@ -243,7 +186,7 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
243
186
|
style={
|
|
244
187
|
disabled
|
|
245
188
|
? { color: colorMap[color]?.label?.disabled }
|
|
246
|
-
: { ...
|
|
189
|
+
: { ...pressedColorAnimationStyle }
|
|
247
190
|
}
|
|
248
191
|
numberOfLines={1}
|
|
249
192
|
ellipsizeMode="tail"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ComponentProps,
|
|
1
|
+
import React, { ComponentProps, forwardRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
GestureResponderEvent,
|
|
4
4
|
Pressable,
|
|
@@ -6,24 +6,19 @@ import {
|
|
|
6
6
|
View
|
|
7
7
|
} from "react-native";
|
|
8
8
|
import Animated, {
|
|
9
|
-
Extrapolate,
|
|
10
|
-
interpolate,
|
|
11
9
|
interpolateColor,
|
|
12
10
|
useAnimatedProps,
|
|
13
11
|
useAnimatedStyle,
|
|
14
|
-
|
|
15
|
-
useSharedValue,
|
|
16
|
-
withSpring
|
|
12
|
+
useReducedMotion
|
|
17
13
|
} from "react-native-reanimated";
|
|
18
14
|
import {
|
|
19
15
|
IOButtonLegacyStyles,
|
|
20
16
|
IOButtonStyles,
|
|
21
17
|
IOColors,
|
|
22
|
-
IOScaleValues,
|
|
23
|
-
IOSpringValues,
|
|
24
18
|
hexToRgba,
|
|
25
19
|
useIOExperimentalDesign
|
|
26
20
|
} from "../../core/";
|
|
21
|
+
import { useScaleAnimation } from "../../hooks";
|
|
27
22
|
import { WithTestID } from "../../utils/types";
|
|
28
23
|
import {
|
|
29
24
|
AnimatedIcon,
|
|
@@ -190,6 +185,11 @@ const mapLegacyColorStates: Record<
|
|
|
190
185
|
}
|
|
191
186
|
};
|
|
192
187
|
|
|
188
|
+
// Icon size
|
|
189
|
+
const iconSize: IOIconSizeScale = 20;
|
|
190
|
+
|
|
191
|
+
const DISABLED_OPACITY = 0.5;
|
|
192
|
+
|
|
193
193
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
194
194
|
const IOButtonLegacyStylesLocal = StyleSheet.create({
|
|
195
195
|
buttonWithBorder: {
|
|
@@ -197,18 +197,13 @@ const IOButtonLegacyStylesLocal = StyleSheet.create({
|
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
// Icon size
|
|
201
|
-
const iconSize: IOIconSizeScale = 20;
|
|
202
|
-
|
|
203
|
-
const DISABLED_OPACITY = 0.5;
|
|
204
|
-
|
|
205
200
|
const IOButtonStylesLocal = StyleSheet.create({
|
|
206
201
|
buttonWithBorder: {
|
|
207
202
|
borderWidth: 2
|
|
208
203
|
}
|
|
209
204
|
});
|
|
210
205
|
|
|
211
|
-
export const ButtonOutline =
|
|
206
|
+
export const ButtonOutline = forwardRef<View, ButtonOutline>(
|
|
212
207
|
(
|
|
213
208
|
{
|
|
214
209
|
color = "primary",
|
|
@@ -225,7 +220,9 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
225
220
|
ref
|
|
226
221
|
) => {
|
|
227
222
|
const { isExperimental } = useIOExperimentalDesign();
|
|
228
|
-
const
|
|
223
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
224
|
+
useScaleAnimation();
|
|
225
|
+
const reducedMotion = useReducedMotion();
|
|
229
226
|
|
|
230
227
|
const AnimatedIOText = Animated.createAnimatedComponent(IOText);
|
|
231
228
|
|
|
@@ -243,80 +240,48 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
243
240
|
() => (isExperimental ? IOButtonStylesLocal : IOButtonLegacyStylesLocal),
|
|
244
241
|
[isExperimental]
|
|
245
242
|
);
|
|
246
|
-
// Scaling transformation applied when the button is pressed
|
|
247
|
-
const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
|
|
248
|
-
|
|
249
|
-
// Using a spring-based animation for our interpolations
|
|
250
|
-
const progressPressed = useDerivedValue(() =>
|
|
251
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
252
|
-
);
|
|
253
243
|
|
|
254
244
|
// Interpolate animation values from `isPressed` values
|
|
255
245
|
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
256
246
|
// Link color states to the pressed states
|
|
257
247
|
const backgroundColor = interpolateColor(
|
|
258
|
-
|
|
248
|
+
progress.value,
|
|
259
249
|
[0, 1],
|
|
260
250
|
[colorMap[color].background.default, colorMap[color].background.pressed]
|
|
261
251
|
);
|
|
262
252
|
|
|
263
253
|
const borderColor = interpolateColor(
|
|
264
|
-
|
|
254
|
+
progress.value,
|
|
265
255
|
[0, 1],
|
|
266
256
|
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
267
257
|
);
|
|
268
258
|
|
|
269
|
-
// Scale down button slightly when pressed
|
|
270
|
-
const scale = interpolate(
|
|
271
|
-
progressPressed.value,
|
|
272
|
-
[0, 1],
|
|
273
|
-
[1, animationScaleValue],
|
|
274
|
-
Extrapolate.CLAMP
|
|
275
|
-
);
|
|
276
|
-
|
|
277
259
|
return {
|
|
278
260
|
borderColor,
|
|
279
|
-
backgroundColor
|
|
280
|
-
transform: [{ scale }]
|
|
261
|
+
backgroundColor
|
|
281
262
|
};
|
|
282
263
|
});
|
|
283
264
|
|
|
284
|
-
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const labelColor = interpolateColor(
|
|
288
|
-
progressPressed.value,
|
|
265
|
+
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => ({
|
|
266
|
+
color: interpolateColor(
|
|
267
|
+
progress.value,
|
|
289
268
|
[0, 1],
|
|
290
269
|
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
return {
|
|
294
|
-
color: labelColor
|
|
295
|
-
};
|
|
296
|
-
});
|
|
270
|
+
)
|
|
271
|
+
}));
|
|
297
272
|
|
|
298
273
|
// Animate the <Icon> color prop
|
|
299
|
-
const pressedColorIconAnimationStyle = useAnimatedProps(() => {
|
|
300
|
-
|
|
301
|
-
|
|
274
|
+
const pressedColorIconAnimationStyle = useAnimatedProps(() => ({
|
|
275
|
+
color: interpolateColor(
|
|
276
|
+
progress.value,
|
|
302
277
|
[0, 1],
|
|
303
278
|
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
});
|
|
279
|
+
)
|
|
280
|
+
}));
|
|
307
281
|
|
|
308
282
|
const AnimatedIconClassComponent =
|
|
309
283
|
Animated.createAnimatedComponent(IconClassComponent);
|
|
310
284
|
|
|
311
|
-
const onPressIn = useCallback(() => {
|
|
312
|
-
// eslint-disable-next-line functional/immutable-data
|
|
313
|
-
isPressed.value = 1;
|
|
314
|
-
}, [isPressed]);
|
|
315
|
-
const onPressOut = useCallback(() => {
|
|
316
|
-
// eslint-disable-next-line functional/immutable-data
|
|
317
|
-
isPressed.value = 0;
|
|
318
|
-
}, [isPressed]);
|
|
319
|
-
|
|
320
285
|
return (
|
|
321
286
|
<Pressable
|
|
322
287
|
ref={ref}
|
|
@@ -351,6 +316,7 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
351
316
|
},
|
|
352
317
|
/* Prevent Reanimated from overriding background colors
|
|
353
318
|
if button is disabled */
|
|
319
|
+
!reducedMotion && !disabled && scaleAnimatedStyle,
|
|
354
320
|
!disabled && pressedAnimationStyle
|
|
355
321
|
]}
|
|
356
322
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ComponentProps, useCallback
|
|
1
|
+
import React, { ComponentProps, useCallback } from "react";
|
|
2
2
|
import {
|
|
3
3
|
GestureResponderEvent,
|
|
4
4
|
Pressable,
|
|
@@ -7,25 +7,20 @@ import {
|
|
|
7
7
|
} from "react-native";
|
|
8
8
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
9
9
|
import Animated, {
|
|
10
|
-
Extrapolate,
|
|
11
|
-
interpolate,
|
|
12
10
|
interpolateColor,
|
|
13
11
|
useAnimatedStyle,
|
|
14
|
-
|
|
15
|
-
useSharedValue,
|
|
16
|
-
withSpring
|
|
12
|
+
useReducedMotion
|
|
17
13
|
} from "react-native-reanimated";
|
|
18
14
|
import {
|
|
19
15
|
IOButtonLegacyStyles,
|
|
20
16
|
IOButtonStyles,
|
|
21
17
|
IOColors,
|
|
22
|
-
IOScaleValues,
|
|
23
|
-
IOSpringValues,
|
|
24
18
|
enterTransitionInnerContent,
|
|
25
19
|
enterTransitionInnerContentSmall,
|
|
26
20
|
exitTransitionInnerContent,
|
|
27
21
|
useIOExperimentalDesign
|
|
28
22
|
} from "../../core";
|
|
23
|
+
import { useScaleAnimation } from "../../hooks";
|
|
29
24
|
import { WithTestID } from "../../utils/types";
|
|
30
25
|
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
|
|
31
26
|
import { LoadingSpinner } from "../loadingSpinner";
|
|
@@ -176,21 +171,10 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
176
171
|
},
|
|
177
172
|
ref
|
|
178
173
|
) => {
|
|
179
|
-
const isPressed = useSharedValue(0);
|
|
180
174
|
const { isExperimental } = useIOExperimentalDesign();
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
/* Prevent the component from triggering the `isEntering' transition
|
|
185
|
-
on the on the first render. Solution from this discussion:
|
|
186
|
-
https://github.com/software-mansion/react-native-reanimated/discussions/2513
|
|
187
|
-
*/
|
|
188
|
-
const isMounted = useRef(false);
|
|
189
|
-
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
// eslint-disable-next-line functional/immutable-data
|
|
192
|
-
isMounted.current = true;
|
|
193
|
-
}, []);
|
|
175
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
176
|
+
useScaleAnimation();
|
|
177
|
+
const reducedMotion = useReducedMotion();
|
|
194
178
|
|
|
195
179
|
const colorMap = React.useMemo(
|
|
196
180
|
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
@@ -202,43 +186,18 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
202
186
|
[isExperimental]
|
|
203
187
|
);
|
|
204
188
|
|
|
205
|
-
// Using a spring-based animation for our interpolations
|
|
206
|
-
const progressPressed = useDerivedValue(() =>
|
|
207
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
208
|
-
);
|
|
209
|
-
|
|
210
189
|
// Interpolate animation values from `isPressed` values
|
|
211
190
|
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
212
191
|
// Link color states to the pressed states
|
|
213
192
|
const backgroundColor = interpolateColor(
|
|
214
|
-
|
|
193
|
+
progress.value,
|
|
215
194
|
[0, 1],
|
|
216
195
|
[colorMap[color].default, colorMap[color].pressed]
|
|
217
196
|
);
|
|
218
197
|
|
|
219
|
-
|
|
220
|
-
const scale = interpolate(
|
|
221
|
-
progressPressed.value,
|
|
222
|
-
[0, 1],
|
|
223
|
-
[1, animationScaleValue],
|
|
224
|
-
Extrapolate.CLAMP
|
|
225
|
-
);
|
|
226
|
-
|
|
227
|
-
return {
|
|
228
|
-
backgroundColor,
|
|
229
|
-
transform: [{ scale }]
|
|
230
|
-
};
|
|
198
|
+
return { backgroundColor };
|
|
231
199
|
});
|
|
232
200
|
|
|
233
|
-
const onPressIn = useCallback(() => {
|
|
234
|
-
// eslint-disable-next-line functional/immutable-data
|
|
235
|
-
isPressed.value = 1;
|
|
236
|
-
}, [isPressed]);
|
|
237
|
-
const onPressOut = useCallback(() => {
|
|
238
|
-
// eslint-disable-next-line functional/immutable-data
|
|
239
|
-
isPressed.value = 0;
|
|
240
|
-
}, [isPressed]);
|
|
241
|
-
|
|
242
201
|
const handleOnPress = useCallback(
|
|
243
202
|
(event: GestureResponderEvent) => {
|
|
244
203
|
/* Don't call `onPress` if the button is
|
|
@@ -289,15 +248,14 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
289
248
|
: { backgroundColor: colorMap[color]?.default },
|
|
290
249
|
/* Prevent Reanimated from overriding background colors
|
|
291
250
|
if button is disabled */
|
|
251
|
+
!disabled && !reducedMotion && scaleAnimatedStyle,
|
|
292
252
|
!disabled && pressedAnimationStyle
|
|
293
253
|
]}
|
|
294
254
|
>
|
|
295
255
|
{loading && (
|
|
296
256
|
<Animated.View
|
|
297
257
|
style={buttonStyles.buttonInner}
|
|
298
|
-
entering={
|
|
299
|
-
isMounted.current ? enterTransitionInnerContentSmall : undefined
|
|
300
|
-
}
|
|
258
|
+
entering={enterTransitionInnerContentSmall}
|
|
301
259
|
exiting={exitTransitionInnerContent}
|
|
302
260
|
>
|
|
303
261
|
<LoadingSpinner color={foregroundColor} />
|
|
@@ -310,12 +268,7 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
310
268
|
buttonStyles.buttonInner,
|
|
311
269
|
iconPosition === "end" && { flexDirection: "row-reverse" }
|
|
312
270
|
]}
|
|
313
|
-
entering={
|
|
314
|
-
isMounted.current ? enterTransitionInnerContent : undefined
|
|
315
|
-
}
|
|
316
|
-
/* Temporarily disable the exiting transition because it caused
|
|
317
|
-
a weird glitch on page exit */
|
|
318
|
-
// exiting={exitTransitionInnerContent}
|
|
271
|
+
entering={enterTransitionInnerContent}
|
|
319
272
|
>
|
|
320
273
|
{icon && (
|
|
321
274
|
<>
|