feat:Input add beforeTextChange API

This commit is contained in:
pengfei.zhou
2021-06-11 17:47:06 +08:00
committed by osborn
parent e528630f71
commit 9fed9e431c
11 changed files with 95 additions and 2 deletions

View File

@@ -2860,6 +2860,10 @@ var Input = /** @class */ (function (_super) {
Property,
__metadata$3("design:type", Function)
], Input.prototype, "onSubmitEditing", void 0);
__decorate$3([
Property,
__metadata$3("design:type", Function)
], Input.prototype, "beforeTextChange", void 0);
return Input;
}(View));
exports.InputType = void 0;

View File

@@ -2224,6 +2224,10 @@ __decorate$3([
Property,
__metadata$3("design:type", Function)
], Input.prototype, "onSubmitEditing", void 0);
__decorate$3([
Property,
__metadata$3("design:type", Function)
], Input.prototype, "beforeTextChange", void 0);
exports.InputType = void 0;
(function (InputType) {
InputType[InputType["Default"] = 0] = "Default";

View File

@@ -3745,6 +3745,10 @@ __decorate$3([
Property,
__metadata$3("design:type", Function)
], Input.prototype, "onSubmitEditing", void 0);
__decorate$3([
Property,
__metadata$3("design:type", Function)
], Input.prototype, "beforeTextChange", void 0);
exports.InputType = void 0;
(function (InputType) {
InputType[InputType["Default"] = 0] = "Default";

6
doric-js/index.d.ts vendored
View File

@@ -784,6 +784,12 @@ declare module 'doric/lib/src/widget/input' {
editable?: boolean;
returnKeyType?: ReturnKeyType;
onSubmitEditing?: (text: string) => void;
beforeTextChange?: (change: {
editing: string;
start: number;
length: number;
replacement: string;
}) => boolean;
getText(context: BridgeContext): Promise<string>;
setSelection(context: BridgeContext, start: number, end?: number): Promise<any>;
getSelection(context: BridgeContext): Promise<{

View File

@@ -26,6 +26,12 @@ export declare class Input extends View {
editable?: boolean;
returnKeyType?: ReturnKeyType;
onSubmitEditing?: (text: string) => void;
beforeTextChange?: (change: {
editing: string;
start: number;
length: number;
replacement: string;
}) => boolean;
getText(context: BridgeContext): Promise<string>;
setSelection(context: BridgeContext, start: number, end?: number): Promise<any>;
getSelection(context: BridgeContext): Promise<{

View File

@@ -115,6 +115,10 @@ __decorate([
Property,
__metadata("design:type", Function)
], Input.prototype, "onSubmitEditing", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Input.prototype, "beforeTextChange", void 0);
export var InputType;
(function (InputType) {
InputType[InputType["Default"] = 0] = "Default";

View File

@@ -75,6 +75,14 @@ export class Input extends View {
@Property
onSubmitEditing?: (text: string) => void
@Property
beforeTextChange?: (change: {
editing: string,
start: number,
length: number,
replacement: string,
}) => boolean
getText(context: BridgeContext) {
return this.nativeChannel(context, 'getText')() as Promise<string>
}