I am using panResponder to do the live dragging animation but currently unable to restrict the icon to remain in the screen.
const panResponder = useRef( PanResponder.create({ onMoveShouldSetPanRe onPanResponderMove: Animated.event([null, {dx: pan.x, dy: pan.y}]), onPanResponderRelease: () => { pan.extractOffset(); }, }), ).current;
Here's a refined solution incorporating the best aspects of previous responses and addressing potential shortcomings: