mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Implement 'scrollEnabled' prop
Summary: @public The content of `WKWebView` renders within a scrollview. In this diff, I'm introducing the prop `scrollEnabled` to allow developers to control whether scrolling is enabled within the scroll view, or not. Reviewed By: mmmulani Differential Revision: D6307001 fbshipit-source-id: 5a199c6c3b8535e45a5a3cb6041e822bb7af2362
This commit is contained in:
committed by
Lorenzo Sciandra
parent
06cce04c2e
commit
1c3af598b1
@@ -20,6 +20,7 @@
|
||||
@property (nonatomic, copy) NSDictionary *source;
|
||||
@property (nonatomic, assign) BOOL messagingEnabled;
|
||||
@property (nonatomic, copy) NSString *injectedJavaScript;
|
||||
@property (nonatomic, assign) BOOL scrollEnabled;
|
||||
|
||||
- (void)postMessage:(NSString *)message;
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ static NSString *const MessageHanderName = @"ReactNative";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setScrollEnabled:(BOOL)scrollEnabled
|
||||
{
|
||||
_webView.scrollView.scrollEnabled = scrollEnabled;
|
||||
}
|
||||
|
||||
- (void)postMessage:(NSString *)message
|
||||
{
|
||||
NSDictionary *eventInitDict = @{@"data": message};
|
||||
|
||||
@@ -37,5 +37,8 @@ RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)m
|
||||
}
|
||||
|
||||
RCT_REMAP_VIEW_PROPERTY(bounces, _webView.scrollView.bounces, BOOL)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, RCTWKWebView) {
|
||||
view.scrollEnabled = json == nil ? true : [RCTConvert BOOL: json];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user