Use case, I have two views with maps that need to 1:1 match each other. There is a parent view that uses overflow to cut off the top view so that the view below can show that map content.
When taking the view shot the overflow hidden property is not respected. Also it appears any additional layer with elevation above the MapboxGL MapView are ignored and not captured.
The screenshot should show the content that is viewable due to the overflow: 'hidden' property
Actual behavior
Overflow content is not viewable unless you set the width to a point value. (IE do not use left, right) instead use const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('screen')
Steps to reproduce the behavior
Use this code
import React, { useRef } from 'react'
import { View, Text, TouchableOpacity, Dimensions } from 'react-native'
import { captureRef } from 'react-native-view-shot'
import Share from 'react-native-share'
import Animated, { Extrapolate } from 'react-native-reanimated'
import { PanGestureHandler } from 'react-native-gesture-handler'
const { sub, event, set, Value } = Animated
bug report
Use case, I have two views with maps that need to 1:1 match each other. There is a parent view that uses overflow to cut off the top view so that the view below can show that map content.
When taking the view shot the overflow hidden property is not respected. Also it appears any additional layer with elevation above the MapboxGL MapView are ignored and not captured.
Version & Platform
Platform: Android
Expected behavior
The screenshot should show the content that is viewable due to the
overflow: 'hidden'
propertyActual behavior
Overflow content is not viewable unless you set the width to a point value. (IE do not use
left, right
) instead useconst { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('screen')
Steps to reproduce the behavior
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('screen')
const Component = () => { const mapScreenshotRef = useRef(null) const handleShare = async () => { if (!mapScreenshotRef.current) return
}
const mapSizing = new Value(SCREEN_WIDTH * 1)
const onPanGestureEvent = event( [ { nativeEvent: { x: x => set(mapSizing, sub(mapSizing, x)), }, }, ], { useNativeDriver: true }, )
return ( <View style={{ flex: 1 }}> <View ref={mapScreenshotRef} collapsable={false} style={{ height: SCREEN_HEIGHT, width: SCREEN_WIDTH, }}
export default Component