[ 
https://issues.apache.org/jira/browse/CB-13124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16236761#comment-16236761
 ] 

ASF GitHub Bot commented on CB-13124:
-------------------------------------

jcesarmobile closed pull request #83: CB-13124: Add option for native 
scroll-to-top on WebView
URL: https://github.com/apache/cordova-plugin-statusbar/pull/83
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/README.md b/README.md
index 0fb481f..7c3f8c7 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,10 @@ Preferences
 
         <preference name="StatusBarStyle" value="lightcontent" />
 
+- __StatusBarDefaultScrollToTop__ (boolean, defaults to false). On iOS 7, 
allows the Cordova WebView to use default scroll-to-top behavior. Defaults to 
false so you can listen to the "statusTap" event (described below) and 
customize the behavior instead.
+
+        <preference name="StatusBarDefaultScrollToTop" value="false" />
+
 ### Android Quirks
 The Android 5+ guidelines specify using a different color for the statusbar 
than your main app color (unlike the uniform statusbar color of many iOS 7+ 
apps), so you may want to set the statusbar color at runtime instead via 
`StatusBar.backgroundColorByHexString` or `StatusBar.backgroundColorByName`. 
One way to do that would be:
 ```js
diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m
index cf86559..b425665 100644
--- a/src/ios/CDVStatusBar.m
+++ b/src/ios/CDVStatusBar.m
@@ -138,8 +138,14 @@ - (void)pluginInitialize
         [self setStatusBarStyle:[self settingForKey:setting]];
     }
 
+    setting  = @"StatusBarDefaultScrollToTop";
+    if ([self settingForKey:setting]) {
+        self.webView.scrollView.scrollsToTop = [(NSNumber*)[self 
settingForKey:setting] boolValue];
+    } else {
+        self.webView.scrollView.scrollsToTop = NO;
+    }
+ 
     // blank scroll view to intercept status bar taps
-    self.webView.scrollView.scrollsToTop = NO;
     UIScrollView *fakeScrollView = [[UIScrollView alloc] 
initWithFrame:UIScreen.mainScreen.bounds];
     fakeScrollView.delegate = self;
     fakeScrollView.scrollsToTop = YES;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> statusTap event is not triggered until momentum scrolling is complete
> ---------------------------------------------------------------------
>
>                 Key: CB-13124
>                 URL: https://issues.apache.org/jira/browse/CB-13124
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-statusbar
>    Affects Versions: cordova@7.0.0
>            Reporter: Lu Wang 
>            Priority: Minor
>
> The statusTap event isn't triggered until the momentum scrolling is complete. 
> To reproduce:
> 1. Create an app that has a natural scrolling body (*not* 100% height div 
> with overflow-x set to "auto" and -webkit-overflow-scrolling set to "touch"). 
> This means a standard WebView with body contents larger than one screen.
> 2. Flick the screen to scroll and notice that momentum/inertial scroll 
> triggers.
> 3. During momentum scrolling, tap the status bar
> 4. Note the statusTap event fired only after the scrolling has completely 
> stopped.
> There isn't a great way to fix this since the events are triggered in 
> cordova.js with a setTimeout. I have a PR available to fix this by adding a 
> config option to StatusBar that enables the native scroll-to-top behavior.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to