fix(button): ios let the gesture observer handles tap events

in some weird cases like i some UICollectionView layouts the UIControlEvents.TouchUpInside is failing
This commit is contained in:
Martin Guillon
2021-03-18 14:00:36 +01:00
parent 56a3f9bd3c
commit a2d06a9efe
19 changed files with 62 additions and 59 deletions

View File

@@ -28,7 +28,7 @@ export function createPage() {
//buttonTwoWay.automationText = "buttonTwoWay";
buttonSetText.text = 'SetText';
buttonSetText.on(buttonModule.Button.tapEvent, function () {
buttonSetText.on(buttonModule.tapEvent, function () {
targetOneWay.text = 'Test';
targetTwoWay.text = 'Test';
});
@@ -47,7 +47,7 @@ export function createPage() {
buttonOneWay.on(buttonModule.Button.loadedEvent, function () {
buttonOneWay.text = sourceOneWay.get('textSource');
});
buttonOneWay.on(buttonModule.Button.tapEvent, function () {
buttonOneWay.on(buttonModule.tapEvent, function () {
buttonOneWay.text = sourceOneWay.get('textSource');
});
@@ -67,7 +67,7 @@ export function createPage() {
buttonTwoWay.on(buttonModule.Button.loadedEvent, function () {
buttonTwoWay.text = sourceTwoWay.get('textSource');
});
buttonTwoWay.on(buttonModule.Button.tapEvent, function () {
buttonTwoWay.on(buttonModule.tapEvent, function () {
buttonTwoWay.text = sourceTwoWay.get('textSource');
});

View File

@@ -16,7 +16,7 @@ export function stack0Loaded(args: observable.EventData) {
target.bind(bindingOptions, source);
source.set('textSource', 'Text');
button.on(buttonModule.Button.tapEvent, function () {
button.on(buttonModule.tapEvent, function () {
button.text = source.get('textSource');
});
}

View File

@@ -7,7 +7,7 @@ export function createPage() {
var btn = new button.Button();
btn.text = 'Alert';
btn.on(button.Button.tapEvent, function () {
btn.on(button.tapEvent, function () {
alert('Alert is global');
});

View File

@@ -1,5 +1,5 @@
import { Observable } from '@nativescript/core/data/observable';
import { Button } from '@nativescript/core/ui/button';
import { Button, tapEvent } from '@nativescript/core/ui/button';
import { Color } from '@nativescript/core/color';
import { WrapLayout } from '@nativescript/core/ui/layouts/wrap-layout';
import { alert } from '@nativescript/core/ui/dialogs';
@@ -65,7 +65,7 @@ export class TestPageMainViewModel extends Observable {
btn.style.backgroundColor = new Color(this._colors[count++ % 3]);
btn.style.borderRadius = 5;
btn.on(
Button.tapEvent,
tapEvent,
function (eventData) {
let text = btn.text;
this.loadExample(text);