Open suiyunpiaoliu opened 2 weeks ago
What does the frame change to when it’s presented?
On iPhone 15 Pro, before displaying UIDocumentPickerViewController, useSafeAreaFrame returns {width: 375, height: 812, x: 0, y: 0}, and when UIDocumentPickerViewController is displayed, it returns {y: 44, width: 343, height: 742.7093333333333, x: 16}, But when UIDocumentPickerViewController is hidden, the result is not restored
Gotta be honest I’m not sure why the frame changes 😅 are the insets correct?
insets didn't change when the UIDocumentPickerViewController trigger
This is sort of what I'd expect. Trying to get the frame in real time is quite difficult since iOS doesn't give you a way to do this. I don't particularly like the useSafeAreaFrame API because we can't handle every single case. What are you trying to achieve here? I might be able to give you some alternatives
Thanks, i modified the code of react-native-safe-area-context locally.
Add the following code to the init of RNCSafeAreaProvider. m
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(invalidateSafeAreaInsets) name:@"UIWindowFrameDidChange" object:nil];
And sent this notification when UIDocumentPickerViewController is hidden
We already check for a few of these cases - like keyboards. If you want to submit a PR, I'm pretty sure we'd be able to merge it
In iOS systems, when UIDocumentPickerViewController is displayed, useSafeAreaFrame returns the correct result, but when UIDocumentPickerViewController is hidden, the result returned by useSafeAreaFrame is not restored