react-native-slot-text 2.2.2 → 2.2.3
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/Slot.js +7 -7
- package/package.json +1 -1
package/Slot.js
CHANGED
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
4
4
|
import { Text } from 'react-native';
|
5
5
|
import Animated, { useSharedValue, withTiming, withSequence, useAnimatedStyle, interpolate, runOnJS, Easing } from 'react-native-reanimated';
|
6
6
|
import styles from './styles';
|
7
|
-
const easing = Easing.bezier(0
|
7
|
+
const easing = Easing.bezier(0, 0.4, 0.4, .8);
|
8
8
|
const Slot = (props) => {
|
9
9
|
const margin = useSharedValue(0);
|
10
10
|
const y = useSharedValue(0);
|
@@ -82,26 +82,26 @@ const Slot = (props) => {
|
|
82
82
|
const currentStyle = useAnimatedStyle(() => ({
|
83
83
|
transform: [
|
84
84
|
{ translateY: y.value },
|
85
|
-
{ scale: interpolate(y.value, [-1 * props.height, 0, props.height], [
|
85
|
+
{ scale: interpolate(y.value, [-1 * props.height, 0, props.height], [.25, 1, .25]) }
|
86
86
|
],
|
87
87
|
marginRight: margin.value,
|
88
|
-
opacity: interpolate(y.value, [-1 *
|
88
|
+
opacity: interpolate(y.value, [-1 * props.height / 2, 0, 1 * props.height / 2], [0, 1, 0]),
|
89
89
|
}));
|
90
90
|
const incomingStyle = useAnimatedStyle(() => {
|
91
91
|
return ({
|
92
92
|
transform: [
|
93
93
|
{ translateY: incomingY.value },
|
94
|
-
{ scale: interpolate(incomingY.value, [-1 * props.height, 0, props.height], [
|
94
|
+
{ scale: interpolate(incomingY.value, [-1 * props.height, 0, props.height], [.25, 1, .25]) },
|
95
95
|
],
|
96
|
-
opacity: interpolate(incomingY.value, [-1 *
|
96
|
+
opacity: interpolate(incomingY.value, [-1 * props.height / 2, 0, 1 * props.height / 2], [0, 1, 0]),
|
97
97
|
position: 'absolute'
|
98
98
|
});
|
99
99
|
});
|
100
100
|
const incomingTextStyle = useAnimatedStyle(() => ({
|
101
|
-
transform: [{ rotateX: `${interpolate(incomingY.value, [-1 * props.height / 2, 0, props.height / 2], [
|
101
|
+
transform: [{ rotateX: `${interpolate(incomingY.value, [-1 * props.height / 2, 0, props.height / 2], [45, 0, -45])}deg` }]
|
102
102
|
}));
|
103
103
|
const currentTextStyle = useAnimatedStyle(() => ({
|
104
|
-
transform: [{ rotateX: `${interpolate(y.value, [-1 * props.height / 2, 0, props.height / 2], [
|
104
|
+
transform: [{ rotateX: `${interpolate(y.value, [-1 * props.height / 2, 0, props.height / 2], [45, 0, -45])}deg` }]
|
105
105
|
}));
|
106
106
|
return (_jsxs(View, { style: styles.slotContainer, children: [_jsx(Animated.View, { style: currentStyle, children: Number.isFinite(props.slot[0]) &&
|
107
107
|
_jsx(Animated.Text, { style: [props.fontStyle, currentTextStyle], children: props.slot[0] }) }), _jsx(Animated.View, { style: incomingStyle, children: Number.isFinite(props.slot[1]) &&
|