Nativescript swipe gesture not working on Android with ScrollView - nativescript

I am using a swipe gesture to turn pages. It works great on ios. However, the Android version isn't working where there is a scrollview in play.
I am using Nativescript Pro UI to have a side-drawer. I want to put the gesture on the
Inside of the tkMainContent there is a scrollview.
Swipe doesn't even log a console.log event when I swipe inside the scrollview area. Is there a way to get it to work for Android?
Here is my typescript code:
let cbView = this.contentbody.nativeElement;
cbView.on('swipe', (args: SwipeGestureEventData) =>{
console.log("Swipe Direction: " + args.direction);
let topNextView = cbView.getViewById('topNext');
let topBackView = cbView.getViewById('topBack');
this.playerService.setIsBusyLoading(false);
if(args.direction === 1) {
topBackView.notify({eventName: 'tap', object: topBackView});
}
if(args.direction === 2) {
topNextView.notify({eventName: 'tap', object: topNextView});
}
});
}
As I said I"m not getting Swipe Direction 2 when swiping on Android. If I swipe above where I have the scrollview start, such as in the heading of my document, then it picks up the swipe.

Related

Xamarin ios map circle overlay click

I'm following the maps example https://developer.xamarin.com/samples/xamarin-forms/customrenderers/map/circle/ to create custom renderer to overlay circles. It seems to be working fine for all 3 platforms except I am unable to find any click event for iOS.
I am building a xamarin forms app and able to find out the click event on both Android and UWP but iOS seems to be far fetched.
Is there any way to do it?
iOS doesn't provide the API which detects the click event.
As a alternative workaround, we can add UITapGestureRecognizer on the mapview and judge if the tap point locates inside the circle.
Solution
//xxx
nativeMap.AddOverlay(circleOverlay);
nativeMap.AddGestureRecognizer(new UITapGestureRecognizer(TapHandle));
void TapHandle(UITapGestureRecognizer tap)
{
MKMapView mapView = tap.View as MKMapView;
CGPoint tapPoint = tap.LocationInView(mapView);
CLLocationCoordinate2D tapCoordinate = mapView.ConvertPoint(tapPoint, tap.View);
MKMapPoint point = MKMapPoint.FromCoordinate(tapCoordinate);
foreach(IMKOverlay overlay in mapView.Overlays)
{
MKCircleRenderer render = GetOverlayRenderer(mapView, overlay) as MKCircleRenderer;
CGPoint datPoint = render.PointForMapPoint(point);
render.InvalidatePath();
if (render.Path.ContainsPoint(datPoint,false))
{
break;
}
}
}

NativeScript How to hide tab buttons from TabView

I've got a TabView in my NativeScript page. The tabs content is programmatically populated.
How to hide / collapse the tabs buttons (because the tabs are switched programmatically)?
see Image above of TabView buttons bar - which needs to be collapsed
You can try
For ios:
var myTabView = page.getViewById("myTabView")
myTabView.ios.tabBar.hidden = true;
For android
myTabView.android.removeViewAt(1);
A better solution for android (I hope i translated it correctly from my working nativescript angular code)
const tabLayout = myTabView.android.tabLayout;
// use native android methods to hide the tabLayout containing the tab buttons
if(isFullscreen) {
tabLayout.setVisibility(android.view.View.GONE);
} else {
tabLayout.setVisibility(android.view.View.VISIBLE);
}

Disable ScrollView bounce NativeScript

Looking for a way to disable the ScrollView bounce or overflow that happens when scrolling reaches the top or bottom of the scroll view.
here how to set the settings in android.
Android scrollview remove blue light
Here is a code snippet that might do the trick for you:
if (this.content.ios instanceof UIScrollView) {
this.content.ios.alwaysBounceVertical = false;
}
Of course you need to get an instance of the <ScrollView> component from NativeScript and then the native iOS instance.
I have a small utility library that has this function and some other handy functions baked into it.
https://github.com/TheOriginalJosh/nativescript-swiss-army-knife
import {SwissArmyKnife} from 'nativescript-swiss-army-knife/nativescript-swiss-army-knife';
...
let scrollView = page.getViewById('myScrollView');
SwissArmyKnife.disableScrollBounce(scrollView);
Here is how to do it on iOS and Android.
let scrollView = page.getViewById('myScrollView');
if (app.android) {
scrollView.android.setOverScrollMode(2);
}
else if (app.ios) {
scrollView.ios.bounces = false;
}

QLPreviewController issue in Xamarin iOS 8

I am having an issue with QLPreviewcontroller presentation in iOS 8. When it is pushed, the UINavigationBar gets transparent and the UI of the app gets disturbed (though it is working fine on iOS 7), I am developing in Xamarin.
if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0))
{
DocPreviewViewController docPreivewVC = new DocPreviewViewController (this.Title, downloadedTime, fullFilePath); //DocPreviewViewController is subclass of UIViewController
this.NavigationController.PushViewController (docPreivewVC, true);
}
Here is the Output in iOS 8:
And if I try to Present it by wrapping into a UINavigationContorller , the document gets hide under the QLPreviewControllers toolbar and user has to tap the screen to hide the navigation bar and see the upper portion of document. Is there a way to hide this tool and show only my own UINavigationBar? Is this a known behaviour that the QLPreviewController’s navigation bar always overlaps the document and user has to tap it to reveal the full document?
Here is the code that I have tried:
if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0))
{
DocPreviewViewController docPreivewVC = new DocPreviewViewController (this.Title, downloadedTime, fullFilePath);
UINavigationController nav = new UINavigationController (docPreivewVC);
nav.HidesBarsOnTap = false;
nav.HidesBarsOnSwipe = false;
this.PresentViewController (nav, true, null);
}
iOS 8: Screen shot when used
Kindly give me suggestion how can I achieve the appearance of document as of iOS 7 i.e: Hiding the top toolbar of QLPreviewController and showing only NavigationController's navigation bar like this:
Thanks

Swipe Gesture Not Working in StageWebview

I am developing reader application in flex 4.6 and i displaying my content in StageWebView. I implemented swipe gesture in that view but its not working.
when I 'swipe' below the StageWebView, it works fine, when I 'swipe' on the StageWebView it does not recognize it.
My Code:
private function handleSwipe(event:TransformGestureEvent):void
{
trace('handleSwirpe()');
// Swipe was to the right
if (event.offsetX == 1 )
{ // or -1 for the left
webView.viewPort = null;
navigator.popView();
}
}
How can i do this....
if you want to capture swipe gesture in StageWebView you should use a javascript method to detect gesture.
And this has to be coded in the page your are loading in the StageWebView space.
Hope it helps :)

Resources