react-native-view-shot
react-native-view-shot copied to clipboard
captureScreen did not take modal opened
Im open a modal on my app, and when user click on button inside that modal, i trigger capturescreen function but it seems only capture my screen without the modal. is this a bug or anything I did wrong ?
captureScreen({ format: "jpg", quality: 0.8 }) .then( (uri) => { console.log("Image saved to", uri) }, error => console.error("Oops, snapshot failed", error) );
Can you give us an example?
This is the sample code @Taym95 Thanks!
https://es6console.com/jgpxn4cx/
sorry, could not paste the code directly here.. have trouble of highlighting it.
Same problem.
My project run with two jsbundle
file, the first was in base controller, which would present
a new view controller hold on the second.
In second jsbundle
file, calling captureScreen was just captured the first controller's view.
UIViewController *current = [self getCurrentViewController];
UIViewController *secondController = [[UIViewController alloc] init];
NSURL *mainLocation = [[NSBundle mainBundle] URLForResource:@"Demo" withExtension:@"jsbundle"];
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:mainLocation
moduleProvider:nil
launchOptions: nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge: bridge
moduleName:@"Demo"
initialProperties:properties];
secondController.view = rootView;
[current presentViewController:secondController animated:YES completion:nil];
same problem,this module capture my screen without the modal
Any update on this issue?
Any solution for this?
To capture your modal alone, use CaptureRef instead of CaptureScreen. Then in your code, create a ViewShot element that wraps round your modal. This tells the library where to capture. If anyone is still interested in this, I could modify @MrHazimAli 's snippet to reflect the changes
To capture your modal alone, use CaptureRef instead of CaptureScreen. Then in your code, create a ViewShot element that wraps round your modal. This tells the library where to capture. If anyone is still interested in this, I could modify @MrHazimAli 's snippet to reflect the changes
I am interested, Can you modify the snippet with a functional component? I did what you said and I get the error Argument appears to not be a ReactComponent. Keys: current
Maybe, the functionality I'm looking for is to capture the View of a modal that is hidden.