|
1 | 1 | import React, {useState} from 'react'; |
| 2 | +import {InteractionManager} from 'react-native'; |
2 | 3 | import {Easing, interpolate, interpolateColor, runOnJS, useAnimatedStyle, useSharedValue, withDelay, withSequence, withTiming} from 'react-native-reanimated'; |
3 | 4 | import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus'; |
4 | 5 | import useTheme from '@hooks/useTheme'; |
@@ -94,25 +95,27 @@ export default function useAnimatedHighlightStyle({ |
94 | 95 | return; |
95 | 96 | } |
96 | 97 | setStartHighlight(false); |
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 | | - })(); |
| 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 | + }); |
116 | 119 | }, [ |
117 | 120 | didScreenTransitionEnd, |
118 | 121 | startHighlight, |
|
0 commit comments