mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge remote-tracking branch 'origin/main' into feat/ios26-glass-effects
This commit is contained in:
@@ -17,7 +17,7 @@ function addButtonsToAlertController(alertController: UIAlertController, options
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.cancelButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, false);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,16 +25,16 @@ function addButtonsToAlertController(alertController: UIAlertController, options
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.neutralButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, undefined);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (isString(options.okButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.okButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, true);
|
||||
})
|
||||
);
|
||||
const action = UIAlertAction.actionWithTitleStyleHandler(options.okButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, true);
|
||||
});
|
||||
alertController.addAction(action);
|
||||
alertController.preferredAction = action; // Allows using keyboard enter/return to confirm the dialog
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export function alert(arg: any): Promise<void> {
|
||||
title: DialogStrings.ALERT,
|
||||
okButtonText: DialogStrings.OK,
|
||||
message: arg + '',
|
||||
}
|
||||
}
|
||||
: arg;
|
||||
const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert);
|
||||
|
||||
@@ -115,7 +115,7 @@ export function confirm(arg: any): Promise<boolean> {
|
||||
okButtonText: DialogStrings.OK,
|
||||
cancelButtonText: DialogStrings.CANCEL,
|
||||
message: arg + '',
|
||||
}
|
||||
}
|
||||
: arg;
|
||||
const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert);
|
||||
|
||||
@@ -301,7 +301,7 @@ export function action(...args): Promise<string> {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(action, dialogType, (arg: UIAlertAction) => {
|
||||
resolve(arg.title);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ export function action(...args): Promise<string> {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.cancelButtonText, UIAlertActionStyle.Cancel, (arg: UIAlertAction) => {
|
||||
resolve(arg.title);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ export const placeholderColorProperty = new CssProperty<Style, Color>({
|
||||
});
|
||||
placeholderColorProperty.register(Style);
|
||||
|
||||
const keyboardTypeConverter = makeParser<CoreTypes.KeyboardInputType>(makeValidator<CoreTypes.KeyboardInputType>(CoreTypes.KeyboardType.datetime, CoreTypes.KeyboardType.phone, CoreTypes.KeyboardType.number, CoreTypes.KeyboardType.url, CoreTypes.KeyboardType.email, CoreTypes.KeyboardType.integer), true);
|
||||
const keyboardTypeConverter = makeParser<CoreTypes.KeyboardInputType>(makeValidator<CoreTypes.KeyboardInputType>(CoreTypes.KeyboardType.datetime, CoreTypes.KeyboardType.phone, CoreTypes.KeyboardType.number, CoreTypes.KeyboardType.decimal, CoreTypes.KeyboardType.url, CoreTypes.KeyboardType.email, CoreTypes.KeyboardType.integer), true);
|
||||
|
||||
export const autofillTypeProperty = new Property<EditableTextBase, CoreTypes.AutofillType>({ name: 'autofillType' });
|
||||
autofillTypeProperty.register(EditableTextBase);
|
||||
|
||||
@@ -204,7 +204,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
[keyboardTypeProperty.getDefault](): number {
|
||||
return this.nativeTextViewProtected.getInputType();
|
||||
}
|
||||
[keyboardTypeProperty.setNative](value: 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer' | number) {
|
||||
[keyboardTypeProperty.setNative](value: 'datetime' | 'phone' | 'number' | 'decimal' | 'url' | 'email' | 'integer' | number) {
|
||||
let newInputType;
|
||||
|
||||
switch (value) {
|
||||
@@ -220,6 +220,10 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
newInputType = android.text.InputType.TYPE_CLASS_NUMBER | android.text.InputType.TYPE_NUMBER_VARIATION_NORMAL | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL;
|
||||
break;
|
||||
|
||||
case 'decimal':
|
||||
newInputType = android.text.InputType.TYPE_CLASS_NUMBER | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED;
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
newInputType = android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_URI;
|
||||
break;
|
||||
|
||||
@@ -34,7 +34,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
return keyboardType.toString();
|
||||
}
|
||||
}
|
||||
[keyboardTypeProperty.setNative](value: 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer' | string) {
|
||||
[keyboardTypeProperty.setNative](value: 'datetime' | 'phone' | 'number' | 'decimal' | 'url' | 'email' | 'integer' | string) {
|
||||
let newKeyboardType: UIKeyboardType;
|
||||
switch (value) {
|
||||
case 'datetime':
|
||||
@@ -49,6 +49,10 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
newKeyboardType = UIKeyboardType.NumbersAndPunctuation;
|
||||
break;
|
||||
|
||||
case 'decimal':
|
||||
newKeyboardType = UIKeyboardType.DecimalPad;
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
newKeyboardType = UIKeyboardType.URL;
|
||||
break;
|
||||
|
||||
@@ -78,6 +78,9 @@ export class TextField extends TextFieldBase {
|
||||
case 'number':
|
||||
inputType = android.text.InputType.TYPE_CLASS_NUMBER | android.text.InputType.TYPE_NUMBER_VARIATION_NORMAL | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL;
|
||||
break;
|
||||
case 'decimal':
|
||||
inputType = android.text.InputType.TYPE_CLASS_NUMBER | android.text.InputType.TYPE_NUMBER_FLAG_DECIMAL | android.text.InputType.TYPE_NUMBER_FLAG_SIGNED;
|
||||
break;
|
||||
case 'url':
|
||||
inputType = android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_URI;
|
||||
break;
|
||||
|
||||
@@ -262,9 +262,22 @@ export class PageTransition extends Transition {
|
||||
newFragment.setSharedElementEnterTransition(transitionSet);
|
||||
newFragment.setSharedElementReturnTransition(transitionSet);
|
||||
|
||||
// Guard against duplicate shared element names being added to the same transaction
|
||||
const addedSharedElementNames = new Set();
|
||||
presenting.forEach((v) => {
|
||||
const name = v?.sharedTransitionTag;
|
||||
const nativeView = v?.nativeView;
|
||||
if (!name || !nativeView || addedSharedElementNames.has(name)) {
|
||||
// prevent duplicates or invalid items
|
||||
return;
|
||||
}
|
||||
setTransitionName(v);
|
||||
fragmentTransaction.addSharedElement(v.nativeView, v.sharedTransitionTag);
|
||||
try {
|
||||
fragmentTransaction.addSharedElement(nativeView, name);
|
||||
addedSharedElementNames.add(name);
|
||||
} catch (err) {
|
||||
// ignore duplicates or issues adding shared element to avoid crashing
|
||||
}
|
||||
});
|
||||
if (toPage.isLoaded) {
|
||||
onPageLoaded();
|
||||
|
||||
Reference in New Issue
Block a user