Open PhamMinhKha opened 5 months ago
I got the same issue, it does not work on android and not showing any error logs
const MapPage = () => {
const captureMap = async () => {
try {
// Capture map as image
const uri = await mapRef.current.capture();
console.log('uri', uri);
} catch (error) {
console.error('Error:', error);
Alert.alert('Error', 'Failed to save PDF.');
}
};
return (
<View style={styles.container}>
<ViewShot ref={mapRef} style={{flex: 1}}>
<MapView
ref={mapRef}
style={{flex: 1}}
scrollEnabled={false}
provider={PROVIDER_GOOGLE}
initialRegion={{
latitude: 55.8622166,
longitude: 12.388021,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
onTouchStart={handleTouchStart}
onPanDrag={handlePanDrag}
onTouchEnd={handleTouchEnd}>
{lines.map((line, index) => (
<Polyline
key={index}
coordinates={line}
strokeColor="#FF0000"
strokeWidth={3}
/>
))}
</MapView>
</ViewShot>
<Button label="Capture screenshot" onPress={captureMap} />
</View>
}
It's not working and not showing any errors on Android, but it works fine on iOS.
Version & Platform
Platform: Android
We will notify an error to fix.
Actual behavior: Nothing appears.
Steps to reproduce the behavior