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 am trying to create a screen overlay that is displayed when the user puts the app in the background. The overlay should be a blurred screenshot of the current app screen layout. While everything works fine on iOS, I am encountering a problem on Android. The issue arises when the screen contains a ScrollView and I use makeImageFromView to capture a screenshot. On Android, it always captures the top of the ScrollView, even if it is scrolled.
Expected Behavior
makeImageFromView function should capture the currently visible part of the ScrollView on Android, similar to how it works on iOS.
Current Behavior
On Android, the captured screenshot always shows the top of the ScrollView, even if it is scrolled.
Version
0.1.236
Steps to reproduce
Create an app with a ScrollView that contains a long content.
Scroll down.
Take screenshot with makeImageFromView.
Check that the captured screenshot does not represent currently visible part of the screen.
Code example:
import{ScrollView,StyleSheet,View,Button}from'react-native';import{Canvas,makeImageFromView,SkImage,Image}from'@shopify/react-native-skia';exportdefaultfunctionApp(){// Create a ref for the view you'd like to take a snapshot ofconstref=useRef<View>(null);// Create a state variable to store the snapshotconst[image,setImage]=useState<SkImage|null>(null);// Create a function to take the snapshotconstonPress=async()=>{// Take the snapshot of the viewconstsnapshot=awaitmakeImageFromView(ref);setImage(snapshot);};return(<><ScrollViewstyle={{flex: 1}}ref={ref}><View><Viewstyle={{backgroundColor: 'cyan',flex: 1,minHeight: 200,borderWidth: 5,}}/><Viewstyle={{backgroundColor: 'red',flex: 1,minHeight: 500,borderWidth: 5,}}/><Viewstyle={{backgroundColor: 'green',flex: 1,minHeight: 1000,borderWidth: 5,}}/></View></ScrollView><Buttontitle="Take screenshot"onPress={onPress}/>{image&&(<Canvasstyle={StyleSheet.absoluteFill}><Imageimage={image}x={0}y={0}width={image.width()/2/pd}height={image.height()/2/pd}/></Canvas>)}</>);}
Demo
Screen.Recording.2024-01-25.at.11.40.23.mov
The text was updated successfully, but these errors were encountered:
Description
I am trying to create a screen overlay that is displayed when the user puts the app in the background. The overlay should be a blurred screenshot of the current app screen layout. While everything works fine on iOS, I am encountering a problem on Android. The issue arises when the screen contains a ScrollView and I use makeImageFromView to capture a screenshot. On Android, it always captures the top of the ScrollView, even if it is scrolled.
Expected Behavior
makeImageFromView function should capture the currently visible part of the ScrollView on Android, similar to how it works on iOS.
Current Behavior
On Android, the captured screenshot always shows the top of the ScrollView, even if it is scrolled.
Version
0.1.236
Steps to reproduce
Code example:
Demo
Screen.Recording.2024-01-25.at.11.40.23.mov
The text was updated successfully, but these errors were encountered: