withTiming callback unknown error
See original GitHub issueDescription
I’m want to dismiss overlay when the animation is complete, but app crash when provide withTiming callback function. Maybe I do something wrong?
Screenshots
Snack or minimal code example
import React, { useEffect } from 'react';
import { View, StyleSheet } from 'react-native';
import { Colors, Spacing } from '@styles';
import Animated, {
useAnimatedStyle,
useSharedValue,
withTiming,
useDerivedValue,
} from 'react-native-reanimated';
import { Navigation } from 'react-native-navigation';
export const Toast = function ({ componentId }) {
const progress = useSharedValue(-1);
const translateY = useDerivedValue(() => {
return progress.value * 130;
});
const animatedStyles = useAnimatedStyle(() => {
if (progress.value == 0) {
progress.value = withTiming(-1, null, (isFinished) => {
if (isFinished) {
Navigation.dismissOverlay(componentId);
}
});
}
return {
transform: [{ translateY: translateY.value }],
};
});
useEffect(() => {
progress.value = withTiming(0);
}, []);
return (
<View style={styles.root}>
<Animated.View style={[styles.toast, animatedStyles]} />
</View>
);
};
const styles = StyleSheet.create({
root: {
flex: 1,
backgroundColor:Colors.BLACK,
paddingHorizontal: Spacing.SPACING_LG,
},
toast: {
height: 130,
width: '100%',
borderRadius: Spacing.SPACING_SM,
backgroundColor: Colors.GRAY_DARK,
},
});
Toast.options = {
overlay: {
interceptTouchOutside: false,
},
};
Package versions
- React: “16.13.1”
- React Native: “0.63.2”
- React Native Reanimated: “2.0.0-alpha.7”
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
withTiming | React Native Reanimated - Software Mansion
The provided function will be called when the animation is complete. In case the animation is cancelled, the callback will receive false as...
Read more >Error handling with promises - The Modern JavaScript Tutorial
The handler should analyze errors (custom error classes help) and rethrow unknown ones (maybe they are programming mistakes). It's ok not to use ......
Read more >Plugin Callbacks - Zigbee af API Documentation Silicon Labs
Unknown Special Days Day Id. ... the keep alive process with timing parameters other than the default values. ... Return true on suceess,...
Read more >expo - React native reanimated , application crashs when call ...
My React native expo application crashing without any error when call function() in withTiming() callback. example :
Read more >Node API / Logux
error : server error during action processing. fatal : server error during ... Set callbacks for unknown channel subscription. ... Returns WithTime ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey! Thanks for the repo 😃 I managed to get it working using new release https://github.com/software-mansion/react-native-reanimated/releases/tag/2.0.0-alpha.8
With
runOnJS
functionality such code works:@karol-bisztyga Thank you for your reply. Where I should move this part? To useeffect or another reanimated hook?