You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a bottom sheet everthing was fine bottom when withTiming excutes its third param callback function on that calling for JS thread with runOnJS function app crash any help will appreciated
// ====== ==== Error occurs on below cmd when i remove this everything working fine=====================
runOnJS(handleHide)();
//=======================================
});
},
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I created a bottom sheet everthing was fine bottom when withTiming excutes its third param callback function on that calling for JS thread with runOnJS function app crash any help will appreciated
Thanks in advance
My Code
`
const {width: W, height: H} = Dimensions.get('screen');
interface SheetProps {
show: boolean;
hide: () => void;
}
interface Context {
y: number;
}
const duration = 400;
function Sheet({show, hide}: SheetProps) {
// const mainContentRef = useRef(null);
//const scrollRef = useRef(null);
const slideUpAnimation = useDerivedValue(() => {
const value = show ? 1 : 0;
return withTiming(value, {duration});
}, [show]);
const dragY = useSharedValue(0);
const pangesture = useAnimatedGestureHandler<
PanGestureHandlerGestureEvent,
{y: number}>({
onStart: (_, ctx) => {
ctx.y = dragY.value;
},
onActive: ({translationY}, ctx) => {
dragY.value = translationY + ctx.y;
},
onEnd: () => {
// ====== ==== Error occurs on below cmd when i remove this everything working fine=====================
runOnJS(handleHide)();
//=======================================
});
},
});
const handleHide = () => {
hide();
setTimeout(() => {
dragY.value = 0;
}, duration);
};
const containerStyle = useAnimatedStyle(() => {
const opacity = interpolate(
slideUpAnimation.value,
[0, 0.2, 1],
[0, 1, 1],
Extrapolate.CLAMP,
);
const translateY = interpolate(
slideUpAnimation.value,
[0, 1],
[H, 0],
Extrapolate.CLAMP,
);
return {
zIndex: 10,
transform: [{translateY}],
opacity,
};
});
const mainContainer = useAnimatedStyle(() => {
return {
transform: [{translateY: dragY.value}],
};
});
return (
<Animated.View style={[styles.sheetContainer, containerStyle]}>
<View style={{flex: 1}} />
<Animated.View style={[styles.bottomContainer, mainContainer]}>
<View style={{height: 50, backgroundColor: 'pink'}}>
);
}
`
Beta Was this translation helpful? Give feedback.
All reactions