vcooley / nativescript-input-mask

Apache License 2.0
9 stars 5 forks source link

Error in ios "InputMaskDelegateImpl" #7

Open pgennoni opened 4 years ago

pgennoni commented 4 years ago

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital letter.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

when i enter into a "notificar pago component", i need to render a input-mask. this run perfect in android, but in ios this don't works.

Is there any code involved?

The code: <InputMask *ngIf="submitted" mask="[099999999]{,}[00]" (extractedValueChange)="onExtractedValueChange($event)" (completedChange)="onCompletedChange($event)" (loaded)="onLoaded($event)" [hint]="importe" keyboardType="phone">

the error is: CONSOLE WARN file:///app/tns_modules/nativescript-input-mask/input-mask.js:31:49: Class "InputMaskDelegateImpl" already implements the "UITextFieldDelegate" protocol.

Thanks!

pgennoni commented 4 years ago

add the code of the file input-mask.js:

"use strict"; Object.defineProperty(exports, "esModule", { value: true }); var text_field_common_1 = require("tns-core-modules/ui/text-field/text-field-common"); var input_mask_common_1 = require("./input-mask.common"); var ListenerImpl = (function (_super) { extends(ListenerImpl, _super); function ListenerImpl() { return _super !== null && _super.apply(this, arguments) || this; } ListenerImpl.initWithOwner = function (owner) { var listener = ListenerImpl.new(); listener._owner = owner; return listener; }; ListenerImpl.prototype.textFieldDidFillMandatoryCharactersDidExtractValue = function (textField, complete, value) { var owner = this._owner.get(); if (owner) { input_mask_common_1.completedProperty.nativeValueChange(owner, complete); input_mask_common_1.extractedValueProperty.nativeValueChange(owner, value); } }; ListenerImpl.ObjCProtocols = [MaskedTextFieldDelegateListener]; return ListenerImpl; }(NSObject)); var InputMaskDelegateImpl = (function (_super) { extends(InputMaskDelegateImpl, _super); function InputMaskDelegateImpl() { return _super !== null && _super.apply(this, arguments) || this; } InputMaskDelegateImpl.initWithOwnerAndDefault = function (owner, defaultImpl) { var delegate = InputMaskDelegateImpl.new(); delegate._defaultImpl = defaultImpl; delegate._owner = owner; return delegate; }; InputMaskDelegateImpl.prototype.textFieldShouldBeginEditing = function (textField) { return this._defaultImpl.textFieldShouldBeginEditing(textField); }; InputMaskDelegateImpl.prototype.textFieldDidEndEditing = function (textField) { return this._defaultImpl.textFieldDidEndEditing(textField); }; InputMaskDelegateImpl.prototype.textFieldShouldClear = function (textField) { return this._defaultImpl.textFieldShouldClear(textField); }; InputMaskDelegateImpl.prototype.textFieldShouldReturn = function (textField) { return this._defaultImpl.textFieldShouldReturn(textField); }; InputMaskDelegateImpl.prototype.textFieldShouldChangeCharactersInRangeReplacementString = function (textField, range, replacementString) { var owner = this._owner.get(); _super.prototype.textFieldShouldChangeCharactersInRangeReplacementString.call(this, textField, range, replacementString); if (owner) { text_field_common_1.textProperty.nativeValueChange(owner, textField.text); } return false; }; InputMaskDelegateImpl.ObjCProtocols = [UITextFieldDelegate]; return InputMaskDelegateImpl; }(MaskedTextFieldDelegate)); var InputMask = (function (_super) { extends(InputMask, _super); function InputMask() { return _super !== null && _super.apply(this, arguments) || this; } InputMask.prototype.initNativeView = function () { _super.prototype.initNativeView.call(this); var owner = new WeakRef(this); this._delegate = InputMaskDelegateImpl.initWithOwnerAndDefault(owner, this._delegate); this._listener = ListenerImpl.initWithOwner(owner); this._delegate.listener = this._listener; }; InputMask.prototype.disposeNativeView = function () { this._delegate = null; this._listener = null; _super.prototype.disposeNativeView.call(this); }; InputMask.prototype[input_mask_common_1.completedProperty.setNative] = function (completed) { }; InputMask.prototype[input_mask_common_1.extractedValueProperty.setNative] = function (value) { }; InputMask.prototype[input_mask_common_1.maskProperty.setNative] = function (mask) { this._delegate.maskFormat = mask; thistext_field_common_1.textProperty.setNative; }; InputMask.prototype[text_field_common_1.textProperty.setNative] = function (text) { this._delegate.putWithTextInto(text, this.ios); }; return InputMask; }(input_mask_common_1.InputMaskBase)); exports.InputMask = InputMask; //# sourceMappingURL=input-mask.js.map

lucasumberto commented 4 years ago

Im having this same error,

@pgennoni , what you did there? it not worked for me.

{ "nativescript": { "id": "org.nativescript.ceonapp", "tns-android": { "version": "6.4.1" }, "tns-ios": { "version": "6.4.2" } }, "description": "NativeScript Ceon Application", "license": "SEE LICENSE IN ", "repository": "", "dependencies": { "@nativescript/theme": "^2.3.0-2020-01-13-101337-01", "@nstudio/nativescript-checkbox": "^1.0.0", "axios": "^0.19.1", "moment": "^2.24.0", "nativescript-input-mask": "^1.0.5", "nativescript-mediafilepicker": "^3.0.1", "nativescript-secure-storage": "^2.6.0", "nativescript-statusbar": "^5.0.0", "nativescript-ui-calendar": "^6.0.0", "nativescript-ui-sidedrawer": "^8.0.0", "nativescript-vue": "~2.4.0", "tns-core-modules": "~6.4.0", "vuex": "^3.1.2" }, "devDependencies": { "@babel/core": "~7.1.0", "@babel/preset-env": "~7.1.0", "babel-loader": "~8.0.0", "nativescript-dev-webpack": "~1.5.0", "nativescript-vue-template-compiler": "~2.4.0", "node-sass": "^4.13.1", "vue-loader": "~15.4.0" }, "gitHead": "a6fec076a20f898feabb4466a2c411158c18a100", "readme": "NativeScript Application" }