Skip to content

Commit 21fae8f

Browse files
committed
remove the delay
1 parent 6d773bc commit 21fae8f

1 file changed

Lines changed: 19 additions & 22 deletions

File tree

  • src/hooks/useAnimatedHighlightStyle

src/hooks/useAnimatedHighlightStyle/index.ts

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, {useState} from 'react';
2-
import {InteractionManager} from 'react-native';
32
import {Easing, interpolate, interpolateColor, runOnJS, useAnimatedStyle, useSharedValue, withDelay, withSequence, withTiming} from 'react-native-reanimated';
43
import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus';
54
import useTheme from '@hooks/useTheme';
@@ -95,27 +94,25 @@ export default function useAnimatedHighlightStyle({
9594
return;
9695
}
9796
setStartHighlight(false);
98-
InteractionManager.runAfterInteractions(() => {
99-
runOnJS(() => {
100-
nonRepeatableProgress.set(
101-
withDelay(
102-
itemEnterDelay,
103-
withTiming(1, {duration: itemEnterDuration, easing: Easing.inOut(Easing.ease)}, (finished) => {
104-
if (!finished) {
105-
return;
106-
}
107-
108-
repeatableProgress.set(
109-
withSequence(
110-
withDelay(highlightStartDelay, withTiming(1, {duration: highlightStartDuration, easing: Easing.inOut(Easing.ease)})),
111-
withDelay(highlightEndDelay, withTiming(0, {duration: highlightEndDuration, easing: Easing.inOut(Easing.ease)})),
112-
),
113-
);
114-
}),
115-
),
116-
);
117-
})();
118-
});
97+
runOnJS(() => {
98+
nonRepeatableProgress.set(
99+
withDelay(
100+
itemEnterDelay,
101+
withTiming(1, {duration: itemEnterDuration, easing: Easing.inOut(Easing.ease)}, (finished) => {
102+
if (!finished) {
103+
return;
104+
}
105+
106+
repeatableProgress.set(
107+
withSequence(
108+
withDelay(highlightStartDelay, withTiming(1, {duration: highlightStartDuration, easing: Easing.inOut(Easing.ease)})),
109+
withDelay(highlightEndDelay, withTiming(0, {duration: highlightEndDuration, easing: Easing.inOut(Easing.ease)})),
110+
),
111+
);
112+
}),
113+
),
114+
);
115+
})();
119116
}, [
120117
didScreenTransitionEnd,
121118
startHighlight,

0 commit comments

Comments
 (0)