diff --git a/package/src/lib/components/tour-overlay/TourOverlay.component.tsx b/package/src/lib/components/tour-overlay/TourOverlay.component.tsx index 127c1d6..0468357 100644 --- a/package/src/lib/components/tour-overlay/TourOverlay.component.tsx +++ b/package/src/lib/components/tour-overlay/TourOverlay.component.tsx @@ -23,9 +23,11 @@ import { import { Animated, type ColorValue, + Dimensions, type LayoutRectangle, Modal, Platform, + StatusBar, View, } from "react-native"; import { Defs, Mask, Rect, Svg } from "react-native-svg"; @@ -83,6 +85,32 @@ export const TourOverlay = forwardRef((props, const arrowRef = useRef(null); + // Get actual screen dimensions for edge-to-edge support + const screenDimensions = useMemo(() => { + const { width, height } = Dimensions.get('screen'); + const statusBarHeight = Platform.OS === 'android' ? StatusBar.currentHeight || 0 : 0; + + // For Android edge-to-edge, use full screen dimensions + return { + width, + height: Platform.OS === 'android' ? height : height, + viewBoxWidth: width, + viewBoxHeight: Platform.OS === 'android' ? height : height, + statusBarHeight, + }; + }, []); + + // Adjust spot position for status bar offset when using statusBarTranslucent + const adjustedSpot = useMemo(() => { + if (Platform.OS === 'android' && screenDimensions.statusBarHeight > 0) { + return { + ...spot, + y: spot.y + screenDimensions.statusBarHeight, + }; + } + return spot; + }, [spot, screenDimensions.statusBarHeight]); + const floating = useMemo((): TooltipProps => ({ arrow: tourStep.arrow ?? tooltipProps.arrow, flip: tourStep.flip ?? tooltipProps.flip, @@ -150,7 +178,7 @@ export const TourOverlay = forwardRef((props, }, [tourStep, onBackdropPress, current, goTo, next, previous, start, stop, pause, resume]); useEffect(() => { - const { height, width } = spot; + const { height, width } = adjustedSpot; if ([height, width].every(value => value > 0)) { Animated.timing(tooltipOpacity.current, { @@ -161,7 +189,7 @@ export const TourOverlay = forwardRef((props, }) .start(); } - }, [spot, useNativeDriver]); + }, [adjustedSpot, useNativeDriver]); useImperativeHandle(ref, () => ({ hideTooltip: () => { @@ -187,22 +215,31 @@ export const TourOverlay = forwardRef((props, supportedOrientations={["portrait", "landscape", "landscape-left", "landscape-right", "portrait-upside-down"]} transparent={true} visible={current !== undefined} + statusBarTranslucent > - - - + ((props, = { export const Css = StyleSheet.create({ overlayView: { - height: vh(100), - width: vw(100), + position: "absolute", + top: 0, + left: 0, + height: Dimensions.get("screen").height, + width: Dimensions.get("screen").width, }, tooltipArrow: { backgroundColor: "transparent",