react-native-slot-text 2.0.0 → 2.0.1
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/README.md +1 -4
- package/Slot.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
@@ -10,10 +10,7 @@ This project was created using `bun init` in bun v1.1.21. [Bun](https://bun.sh)
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
https://github.com/user-attachments/assets/e2e22b9a-17a8-4b17-b069-0c6b4854c915
|
15
|
-
|
16
|
-
|
13
|
+
https://github.com/user-attachments/assets/192d168a-6497-4035-9c8e-b39b88dabf56
|
17
14
|
|
18
15
|
|
19
16
|
|
package/Slot.js
CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect, useState } from 'react';
|
3
3
|
import { View } from 'react-native';
|
4
4
|
import { Text } from 'react-native';
|
5
|
-
import Animated, { useSharedValue, withTiming, withSequence, useAnimatedStyle, interpolate, runOnJS } from 'react-native-reanimated';
|
5
|
+
import Animated, { useSharedValue, withTiming, withSequence, useAnimatedStyle, interpolate, runOnJS, Easing } from 'react-native-reanimated';
|
6
6
|
import styles from './styles';
|
7
7
|
const Slot = (props) => {
|
8
8
|
const [value1, setValue1] = useState();
|
@@ -26,7 +26,7 @@ const Slot = (props) => {
|
|
26
26
|
}
|
27
27
|
// Removing slot
|
28
28
|
else if (incomingValue === null) {
|
29
|
-
y.value = withTiming(-1 * props.height, { duration: props.animationDuration }, () => {
|
29
|
+
y.value = withTiming(-1 * props.height, { duration: props.animationDuration, easing: Easing.ease }, () => {
|
30
30
|
props.onCompleted && runOnJS(props.onCompleted)();
|
31
31
|
});
|
32
32
|
margin.value = withTiming(-1 * props.charSizes[currentValue], { duration: props.animationDuration / 2 });
|
@@ -34,7 +34,7 @@ const Slot = (props) => {
|
|
34
34
|
// Adding slot
|
35
35
|
else if (currentValue === null) {
|
36
36
|
margin.value = withTiming(props.charSizes[incomingValue], { duration: props.animationDuration / 2 });
|
37
|
-
incomingY.value = withSequence(withTiming(-1 * props.height, { duration: 0 }), withTiming(0, { duration: props.animationDuration }, () => {
|
37
|
+
incomingY.value = withSequence(withTiming(-1 * props.height, { duration: 0 }), withTiming(0, { duration: props.animationDuration, easing: Easing.ease }, () => {
|
38
38
|
props.onCompleted && runOnJS(props.onCompleted)();
|
39
39
|
}));
|
40
40
|
}
|
@@ -42,12 +42,12 @@ const Slot = (props) => {
|
|
42
42
|
else {
|
43
43
|
margin.value = withTiming((props.charSizes[incomingValue] - props.charSizes[currentValue]), { duration: props.animationDuration / 2 });
|
44
44
|
if (incomingValue > currentValue) {
|
45
|
-
y.value = withTiming(props.height, { duration: props.animationDuration });
|
46
|
-
incomingY.value = withSequence(withTiming(-1 * props.height, { duration: 0 }), withTiming(0, { duration: props.animationDuration }, () => { props.onCompleted && runOnJS(props.onCompleted)(); }));
|
45
|
+
y.value = withTiming(props.height, { duration: props.animationDuration, easing: Easing.ease });
|
46
|
+
incomingY.value = withSequence(withTiming(-1 * props.height, { duration: 0, easing: Easing.ease }), withTiming(0, { duration: props.animationDuration }, () => { props.onCompleted && runOnJS(props.onCompleted)(); }));
|
47
47
|
}
|
48
48
|
else if (incomingValue < currentValue) {
|
49
|
-
y.value = withTiming(-1 * props.height, { duration: props.animationDuration });
|
50
|
-
incomingY.value = withSequence(withTiming(1 * props.height, { duration: 0 }), withTiming(0, { duration: props.animationDuration }, () => { props.onCompleted && runOnJS(props.onCompleted)(); }));
|
49
|
+
y.value = withTiming(-1 * props.height, { duration: props.animationDuration, easing: Easing.ease });
|
50
|
+
incomingY.value = withSequence(withTiming(1 * props.height, { duration: 0, easing: Easing.ease }), withTiming(0, { duration: props.animationDuration }, () => { props.onCompleted && runOnJS(props.onCompleted)(); }));
|
51
51
|
}
|
52
52
|
}
|
53
53
|
}, [props.slot]);
|