gre / react-native-view-shot

Snapshot a React Native view and save it to an image
https://github.com/gre/react-native-view-shot-example
MIT License
2.64k stars 344 forks source link

Run time crash due to use of depricated UI Image apis #514

Open vibhor-d11 opened 5 months ago

vibhor-d11 commented 5 months ago

bug report

Version & Platform

"react-native": "0.72.5" "react-native-view-shot": "3.5.0"

Platform: iOS

Issue Overview:

Building with Xcode 15 for iOS 17 lead to the run-time crash when using a deprecated UIGraphicsBeginImageContextWithOptions code on the UIImage instances with .zero size.

Following UI Image apis are depricated from ios 17 when build with Xcode 15:

  1. https://developer.apple.com/documentation/uikit/1623912-uigraphicsbeginimagecontextwitho
  2. https://developer.apple.com/documentation/uikit/1623924-uigraphicsgetimagefromcurrentima

Instead need to use UIGraphicsImageRenderer and UIGraphicsImageRendererContext.

Steps to reproduce the behavior

Building with Xcode 15 for iOS 17 lead to the run-time crash when using a deprecated UIGraphicsBeginImageContextWithOptions code on the UIImage instances with .zero size.

Pr to address this fix : https://github.com/gre/react-native-view-shot/pull/515