Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iOS): setting correct default DecelerationRate for iOS to normal #2815

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions apple/RNCWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ - (instancetype)initWithFrame:(CGRect)frame
_autoManageStatusBarEnabled = YES;
_contentInset = UIEdgeInsetsZero;
_savedKeyboardDisplayRequiresUserAction = YES;

#if !TARGET_OS_OSX
_decelerationRate = UIScrollViewDecelerationRateNormal;
#endif // !TARGET_OS_OSX

#if !TARGET_OS_OSX
_savedStatusBarStyle = RCTSharedApplication().statusBarStyle;
_savedStatusBarHidden = RCTSharedApplication().statusBarHidden;
Expand Down
4 changes: 2 additions & 2 deletions docs/Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ Example:

A floating-point number that determines how quickly the scroll view decelerates after the user lifts their finger. You may also use the string shortcuts `"normal"` and `"fast"` which match the underlying iOS settings for `UIScrollViewDecelerationRateNormal` and `UIScrollViewDecelerationRateFast` respectively:

- normal: 0.998
- fast: 0.99 (the default for iOS web view)
- normal: 0.998 (the default for iOS web view)
- fast: 0.99

| Type | Required | Platform |
| ------ | -------- | -------- |
Expand Down
4 changes: 2 additions & 2 deletions src/WebViewTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ export interface IOSWebViewProps extends WebViewSharedProps {
* settings for `UIScrollViewDecelerationRateNormal` and
* `UIScrollViewDecelerationRateFast` respectively:
*
* - normal: 0.998
* - fast: 0.99 (the default for iOS web view)
* - normal: 0.998 (the default for iOS web view)
* - fast: 0.99
* @platform ios
*/
decelerationRate?: DecelerationRateConstant | number;
Expand Down