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.
Files changed (3) hide show
  1. package/README.md +1 -4
  2. package/Slot.js +7 -7
  3. 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]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-slot-text",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "author": "sc-mitton <scm.mitton@gmail.com> (https://github.com/sc-mitton)",
5
5
  "main": "index.js",
6
6
  "module": "index.ts",