Ingen beskrivning

RNCWebView.h 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <React/RCTView.h>
  8. #import <React/RCTDefines.h>
  9. #import <WebKit/WebKit.h>
  10. @class RNCWebView;
  11. @protocol RNCWebViewDelegate <NSObject>
  12. - (BOOL)webView:(RNCWebView *_Nonnull)webView
  13. shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *_Nonnull)request
  14. withCallback:(RCTDirectEventBlock _Nonnull)callback;
  15. @end
  16. @interface RNCWeakScriptMessageDelegate : NSObject<WKScriptMessageHandler>
  17. @property (nonatomic, weak) id<WKScriptMessageHandler> scriptDelegate;
  18. - (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)scriptDelegate;
  19. @end
  20. @interface RNCWebView : RCTView
  21. @property (nonatomic, weak) id<RNCWebViewDelegate> _Nullable delegate;
  22. @property (nonatomic, copy) NSDictionary * _Nullable source;
  23. @property (nonatomic, assign) BOOL messagingEnabled;
  24. @property (nonatomic, copy) NSString * _Nullable injectedJavaScript;
  25. @property (nonatomic, copy) NSString * _Nullable injectedJavaScriptBeforeContentLoaded;
  26. @property (nonatomic, assign) BOOL injectedJavaScriptForMainFrameOnly;
  27. @property (nonatomic, assign) BOOL injectedJavaScriptBeforeContentLoadedForMainFrameOnly;
  28. @property (nonatomic, assign) BOOL scrollEnabled;
  29. @property (nonatomic, assign) BOOL sharedCookiesEnabled;
  30. @property (nonatomic, assign) BOOL autoManageStatusBarEnabled;
  31. @property (nonatomic, assign) BOOL pagingEnabled;
  32. @property (nonatomic, assign) CGFloat decelerationRate;
  33. @property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
  34. @property (nonatomic, assign) BOOL bounces;
  35. @property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
  36. #if WEBKIT_IOS_10_APIS_AVAILABLE
  37. @property (nonatomic, assign) WKDataDetectorTypes dataDetectorTypes;
  38. #endif
  39. @property (nonatomic, assign) UIEdgeInsets contentInset;
  40. @property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
  41. @property (nonatomic, assign) BOOL keyboardDisplayRequiresUserAction;
  42. @property (nonatomic, assign) BOOL hideKeyboardAccessoryView;
  43. @property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
  44. @property (nonatomic, assign) BOOL incognito;
  45. @property (nonatomic, assign) BOOL useSharedProcessPool;
  46. @property (nonatomic, copy) NSString * _Nullable userAgent;
  47. @property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent;
  48. @property (nonatomic, assign) BOOL cacheEnabled;
  49. @property (nonatomic, assign) BOOL javaScriptEnabled;
  50. @property (nonatomic, assign) BOOL javaScriptCanOpenWindowsAutomatically;
  51. @property (nonatomic, assign) BOOL allowFileAccessFromFileURLs;
  52. @property (nonatomic, assign) BOOL allowsLinkPreview;
  53. @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
  54. @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
  55. @property (nonatomic, assign) BOOL directionalLockEnabled;
  56. @property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
  57. @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
  58. @property (nonatomic, assign) BOOL pullToRefreshEnabled;
  59. #if !TARGET_OS_OSX
  60. @property (nonatomic, weak) UIRefreshControl * refreshControl;
  61. #endif
  62. #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
  63. @property (nonatomic, assign) WKContentMode contentMode;
  64. #endif
  65. + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
  66. + (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
  67. - (void)postMessage:(NSString *_Nullable)message;
  68. - (void)injectJavaScript:(NSString *_Nullable)script;
  69. - (void)goForward;
  70. - (void)goBack;
  71. - (void)reload;
  72. - (void)stopLoading;
  73. #if !TARGET_OS_OSX
  74. - (void)addPullToRefreshControl;
  75. - (void)pullToRefresh:(UIRefreshControl *)refreshControl;
  76. #endif
  77. @end