Skip to content

Commit 1741fe9

Browse files
RSNarafacebook-github-bot
authored andcommittedAug 16, 2018
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
1 parent e5f95ab commit 1741fe9

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
 

‎React/Views/RCTWKWebView.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
@property (nonatomic, copy) NSDictionary *source;
2121
@property (nonatomic, assign) BOOL messagingEnabled;
2222
@property (nonatomic, copy) NSString *injectedJavaScript;
23+
@property (nonatomic, assign) BOOL scrollEnabled;
2324

2425
- (void)postMessage:(NSString *)message;
2526

‎React/Views/RCTWKWebView.m

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ - (void)setSource:(NSDictionary *)source
8585
}
8686
}
8787

88+
- (void)setScrollEnabled:(BOOL)scrollEnabled
89+
{
90+
_webView.scrollView.scrollEnabled = scrollEnabled;
91+
}
92+
8893
- (void)postMessage:(NSString *)message
8994
{
9095
NSDictionary *eventInitDict = @{@"data": message};

‎React/Views/RCTWKWebViewManager.m

+3
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ - (UIView *)view
3737
}
3838

3939
RCT_REMAP_VIEW_PROPERTY(bounces, _webView.scrollView.bounces, BOOL)
40+
RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, RCTWKWebView) {
41+
view.scrollEnabled = json == nil ? true : [RCTConvert BOOL: json];
42+
}
4043

4144
@end

0 commit comments

Comments
 (0)
Please sign in to comment.