[英]React Native - secureTextEntry Disable IOS 13+ Strong Password behavior
[英]UIDocumentInteractionController menu does not dismiss (React Native 0.61.5) iOS 13+
我對用於打開 PDF 文檔的 UIDocumentInteractionController 有問題。
此時的問題是,當用戶與我點擊 Open in {app_name} 操作的菜單交互時,當用戶返回應用程序時,菜單本身無法在用戶交互后關閉菜單。
此時關閉菜單需要用戶在 X 上點擊兩次才能關閉菜單。
我還嘗試在應用程序返回到活動狀態時通過在 UIDocumentInteractionController 實例上運行dismissMenuAnimated來動態關閉菜單,但在這種情況下它不起作用,但是如果沒有對其進行交互並且調用該方法,它會關閉對話框。
需要注意的是,此問題僅在從未出現過的 iOS 13+ 版本上出現。 在較舊的操作系統上,菜單在交互后按預期關閉。
我們嘗試使用此代碼而不是我們嘗試過的所有 react-native 代碼:
@property (nonatomic, strong) UIDocumentInteractionController *documentInteractionController;
@property (atomic) CGRect rect;
RCT_EXPORT_METHOD(openDocumentInteractionControllerWithFileURL:(NSURL *)fileURL){
if (!fileURL) {
// Return NO because there was no valid fileURL.
return;
}
UIViewController *rootCtrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
// Open "Open in"-menu
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
self.documentInteractionController.delegate = self;
BOOL sucess; // Sucess is true if it was possible to open the controller and there are apps available
sucess = [self.documentInteractionController presentOpenInMenuFromRect:self.rect inView:rootCtrl.view animated:YES];
if(!sucess){
// Inform app that the activity has finished
// Return NO because the service was canceled and did not finish because of an error.
// http://developer.apple.com/library/ios/#documentation/uikit/reference/UIActivity_Class/Reference/Reference.html
}
}
RCT_EXPORT_METHOD(dismissDocumentInteractionController){
// Hide menu
[self.documentInteractionController dismissMenuAnimated:YES];
}
但沒有成功。
用戶在此菜單中進行選擇后,您需要關閉交互controller
菜單。
你可以在UIDocumentInteractionControllerDelegate
這樣做:
- (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(NSString *)application {
[self.documentInteractionController dismissMenuAnimated:YES];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.