Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ class WebView extends React.Component {
* must be a string.
*/
onMessage: PropTypes.func,
/**
* On Scroll event
*/
onScroll: PropTypes.func,
/**
* Boolean value that forces the `WebView` to show the loading view
* on the first load.
Expand Down Expand Up @@ -485,6 +489,7 @@ class WebView extends React.Component {
onLoadingError={this._onLoadingError}
messagingEnabled={messagingEnabled}
onMessage={this._onMessage}
onScroll={this._onScroll}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
scalesPageToFit={this.props.scalesPageToFit}
allowsInlineMediaPlayback={this.props.allowsInlineMediaPlayback}
Expand Down Expand Up @@ -628,6 +633,11 @@ class WebView extends React.Component {
var {onMessage} = this.props;
onMessage && onMessage(event);
}

_onScroll = (event: Event) => {
var {onScroll} = this.props;
onScroll && onScroll(event);
}
}

var RCTWebView = requireNativeComponent('RCTWebView', WebView, WebView.extraNativeComponentConfig);
Expand Down
4 changes: 4 additions & 0 deletions React/Base/RCTConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#if !TARGET_OS_TV
#import <WebKit/WebKit.h>
#endif

#import <React/RCTAnimationType.h>
#import <React/RCTBorderStyle.h>
Expand Down Expand Up @@ -70,6 +73,7 @@ typedef NSURL RCTFileURL;
+ (UIReturnKeyType)UIReturnKeyType:(id)json;
#if !TARGET_OS_TV
+ (UIDataDetectorTypes)UIDataDetectorTypes:(id)json;
+ (WKDataDetectorTypes)WKDataDetectorTypes:(id)json;
#endif

+ (UIViewContentMode)UIViewContentMode:(id)json;
Expand Down
13 changes: 13 additions & 0 deletions React/Base/RCTConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,19 @@ + (NSLocale *)NSLocale:(id)json
@"none": @(UIDataDetectorTypeNone),
@"all": @(UIDataDetectorTypeAll),
}), UIDataDetectorTypePhoneNumber, unsignedLongLongValue)

RCT_MULTI_ENUM_CONVERTER(WKDataDetectorTypes, (@{
@"phoneNumber": @(WKDataDetectorTypePhoneNumber),
@"link": @(WKDataDetectorTypeLink),
@"address": @(WKDataDetectorTypeAddress),
@"calendarEvent": @(WKDataDetectorTypeCalendarEvent),
@"trackingNumber": @(WKDataDetectorTypeTrackingNumber),
@"flightNumber": @(WKDataDetectorTypeFlightNumber),
@"lookupSuggestion": @(WKDataDetectorTypeLookupSuggestion),
@"none": @(WKDataDetectorTypeNone),
@"all": @(WKDataDetectorTypeAll),
}), WKDataDetectorTypePhoneNumber, unsignedLongLongValue)

#endif

RCT_ENUM_CONVERTER(UIKeyboardAppearance, (@{
Expand Down
5 changes: 5 additions & 0 deletions React/Views/RCTWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import <WebKit/WebKit.h>

#import <React/RCTView.h>

@class RCTWebView;
Expand Down Expand Up @@ -37,6 +39,9 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
@property (nonatomic, assign) BOOL messagingEnabled;
@property (nonatomic, copy) NSString *injectedJavaScript;
@property (nonatomic, assign) BOOL scalesPageToFit;
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
@property (nonatomic, assign) WKDataDetectorTypes dataDetectorTypes;

- (void)goForward;
- (void)goBack;
Expand Down
Loading