Skip to content
Merged
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
1 change: 1 addition & 0 deletions apple/RNCWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
REMAP_WEBVIEW_PROP(directionalLockEnabled)
REMAP_WEBVIEW_PROP(showsHorizontalScrollIndicator)
REMAP_WEBVIEW_PROP(showsVerticalScrollIndicator)
REMAP_WEBVIEW_PROP(forceLightScrollIndicators)
REMAP_WEBVIEW_PROP(keyboardDisplayRequiresUserAction)

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
Expand Down
1 change: 1 addition & 0 deletions apple/RNCWebViewImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
@property (nonatomic, assign) BOOL allowsLinkPreview;
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
@property (nonatomic, assign) BOOL forceLightScrollIndicators;
@property (nonatomic, assign) BOOL directionalLockEnabled;
@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
Expand Down
20 changes: 20 additions & 0 deletions apple/RNCWebViewImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ - (instancetype)initWithFrame:(CGRect)frame
_scrollEnabled = YES;
_showsHorizontalScrollIndicator = YES;
_showsVerticalScrollIndicator = YES;
_forceLightScrollIndicators = NO;
_directionalLockEnabled = YES;
_automaticallyAdjustContentInsets = YES;
_autoManageStatusBarEnabled = YES;
Expand Down Expand Up @@ -497,6 +498,12 @@ - (void)didMoveToWindow
_webView.scrollView.bounces = _pullToRefreshEnabled || _bounces;
_webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator;
_webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator;
if(_forceLightScrollIndicators){
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
}
else{
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleDefault;
}
_webView.scrollView.directionalLockEnabled = _directionalLockEnabled;
#endif // !TARGET_OS_OSX
_webView.allowsLinkPreview = _allowsLinkPreview;
Expand Down Expand Up @@ -1023,6 +1030,19 @@ - (void)setShowsVerticalScrollIndicator:(BOOL)showsVerticalScrollIndicator
_showsVerticalScrollIndicator = showsVerticalScrollIndicator;
_webView.scrollView.showsVerticalScrollIndicator = showsVerticalScrollIndicator;
}


- (void)setForceLightScrollIndicators:(BOOL)forceLightScrollIndicators
{
_forceLightScrollIndicators = forceLightScrollIndicators;

if(_forceLightScrollIndicators){
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
}
else{
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleDefault;
}
}
#endif // !TARGET_OS_OSX

- (void)postMessage:(NSString *)message
Expand Down
4 changes: 4 additions & 0 deletions apple/RNCWebViewManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ - (RNCView *)view
view.showsVerticalScrollIndicator = json == nil ? true : [RCTConvert BOOL: json];
}

RCT_CUSTOM_VIEW_PROPERTY(forceLightScrollIndicators, BOOL, RNCWebViewImpl) {
view.forceLightScrollIndicators = json == nil ? true : [RCTConvert BOOL: json];
}

RCT_CUSTOM_VIEW_PROPERTY(keyboardDisplayRequiresUserAction, BOOL, RNCWebViewImpl) {
view.keyboardDisplayRequiresUserAction = json == nil ? true : [RCTConvert BOOL: json];
}
Expand Down
1 change: 1 addition & 0 deletions src/RNCWebViewNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export interface NativeProps extends ViewProps {
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
showsHorizontalScrollIndicator?: boolean;
showsVerticalScrollIndicator?: boolean;
forceLightScrollIndicators?: boolean;
newSource: Readonly<{
uri?: string
method?: string;
Expand Down
8 changes: 8 additions & 0 deletions src/WebViewTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
showsHorizontalScrollIndicator?: boolean;
showsVerticalScrollIndicator?: boolean;
forceLightScrollIndicators?: boolean;
// TODO: find a better way to type this.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
source: any;
Expand Down Expand Up @@ -1261,6 +1262,13 @@ export interface WebViewSharedProps extends ViewProps {
*/
showsVerticalScrollIndicator?: boolean;

/**
* Boolean value that determines whether a light scrollbar is
* shown in the `WebView`. The default value is `false`.
* @platform ios
*/
forceLightScrollIndicators?: boolean;

/**
* Boolean that determines whether HTML5 audio and video requires the user
* to tap them before they start playing. The default value is `true`.
Expand Down
Loading