New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nativescript 7 TimePicker/DatePicker error (iOS) #8862
Comments
Having the same problem running tns-ios version 6.5.2. Happened after I updated to xcode 12 and ios 14. |
I believe this is a duplicate of #8843 |
As noted by @lochstar in NS Slack, the crash can be handled DatePicker.prototype[date_picker_common_1.colorProperty.getDefault] = function () {
// return this.nativeViewProtected.valueForKey("textColor");
}; and setting the
|
@timdoege Thanks for the tip on the preferredDatePickerStyle 👍, do you know if something similar can be done with the TimePicker? |
@gregersen79 Yes, it's the same line that causes the crash. As a temporary fix, I added these two steps in my build pipeline after $ sed -i.bak 's/return this.nativeViewProtected.valueForKey("textColor");/\/\/return this.nativeViewProtected.valueForKey("textColor");/' node_modules/@nativescript/core/ui/date-picker/date-picker.ios.js
$ sed -i.bak 's/return this.nativeViewProtected.valueForKey("textColor");/\/\/return this.nativeViewProtected.valueForKey("textColor");/' node_modules/@nativescript/core/ui/time-picker/time-picker.ios.js |
@timdoege Thank you. Do you if it is possible to set the TimePicker to the old wheel/inline style, like you do with the DatePicker? |
@gregersen79 The exact same workaround from @timdoege works for the timepicker aswell.
|
@Log3n Thank you, it works. I had not thought a property named preferredDatePickerStyle would also work for TimePicker, but thanks. |
The solution of commenting the ("textColor") line seems to be dodgy. I would prefer to wait until it is handled properly. Additionally, can't setup color properties for text, nor background color to white, it always stays light gray. |
and setting the DatePicker to the old wheel/inline style and a @loaded event on the DatePicker component
Can someone explain this further? how do i get this to fire in the component? |
@andiberes you set up the function to be called on the loaded event of the DatePicker in your html/xml. E.g.
I would change
to
since the old approach wont work with the newest 14.0.1 version. |
@Log3n absolute legend, didn't spot the version issue. thanks |
@Log3n and @andiberes, this is not the way to do it. You should update to lates NS 7, or if you are using NS 6 then update tns-core-modules to version 6.5.20. Then you can just use And the right way to check the version is |
@asharghi I was just clarifying on how to use the proposed workaround. But you are totally right that updating the core is the better/correct solution to the issue. |
I tried to move the NS7 and had nothing but issues :( but it does seem a much leaner solution. I will try the upgrade again tonight. fingers crossed it goes another this time. |
@andiberes You don't need to upgrade to 7 if you are having problems (could be you are using plugins that doesn't support NS7 yet). Only need to update tns-core-modules package to version 6.5.20. |
Ok, so I took the plunge and did the upgrade to NS7, and i seem to be getting this error. ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.6.0 but 3.9.7 was found instead. Guess I will be searching the forums this afternoon for a fix 👍 |
@asharghi I was able to use your solution |
If you're using RadDataForm you'll notice the same thing is happening, but it looks a lot worse and is in some cases almost un-usable. To fix this, just get the element in the editorUpdate event:
Of course you'll want to wrap this in a version check. I hope this is helpful to someone, as this wasted me a whole day! |
Having a DatePicker or Timepicker in UI makes app crash. Note this is only tested on iOS.
Below crash log is from DatePicker:
***** Fatal JavaScript exception - application has been terminated. ***** NativeScript encountered a fatal error: Uncaught Error: -[_UIDatePickerIOSCompactView _textColor]: unrecognized selector sent to instance 0x7fab415058b0 at [color:getDefault](file: node_modules/@nativescript/core/ui/date-picker/index.ios.js:61:0) at applyAllNativeSetters(file: node_modules/@nativescript/core/ui/core/properties/index.js:1091:0) at initNativeView(file: node_modules/@nativescript/core/ui/core/properties/index.js:1021:0) at onResumeNativeUpdates(file: node_modules/@nativescript/core/ui/core/view-base/index.js:695:22) at _resumeNativeUpdates(file: node_modules/@nativescript/core/ui/core/view-base/index.js:259:0) at onLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:214:0) at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:297:0) at callFunctionWithSuper(file: node_modules/@nativescript/core/ui/core/view-base/index.js:291:0) at callLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:297:0) at loadView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:437:0) at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:216:0) at eachChildView(file: node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0) at eachChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:700:0) at onLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:215:0) at (file: node_modules/@nativescript/core/ui/core/view-base/index.js:297:0) at callFunctionWithSuper(file: node_modules/@nativescript/core/ui/core/view-base/index.js:291:0) at callLoaded(file: node_modules/@nativescript/core/ui/core/view-base/index.js:297:0) at loadView(file:///app/vendor.<…>
To Reproduce
Create new project.
Add a DatePicker or TimePicker to UI, and navigate to page.
The text was updated successfully, but these errors were encountered: