PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Cannot read property 'nativeSize' of undefined #100

Closed noetius closed 7 years ago

noetius commented 7 years ago

Please, provide the details below:

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Yes

Tell us about the problem

In every xml page that declares a drop down list, here it is the exception:

An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException: 
Calling js method getView failed

TypeError: Cannot read property 'nativeSize' of undefined
File: "file:///data/data/org.nativescript.fleetbar/files/app/tns_modules/tns-core-modules/ui/text-base/text-base.js, line: 137, column: 90

StackTrace: 
    Frame: function:'TextBase.(anonymous function)', file:'file:///data/data/org.nativescript.fleetbar/files/app/tns_modules/tns-core-modules/ui/text-base/text-base.js', line: 137, column: 91
    Frame: function:'', file:'file:///data/data/org.nativescript.fleetbar/files/app/tns_modules/tns-core-modules/ui/core/properties/properties.js', line: 662, column: 42
    Frame: function:'DropDownAdapter._generateView', file:'file:///data/data/org.nativescript.fleetbar/files/app/tns_modules/nativescript-drop-down/drop-down.js', line: 223, column: 34
    Frame: function:'DropDownAdapter.getView', file:'file:///data/data/org.nativescript.fleetbar/files/app/tns_modules/nativescript-drop-down/drop-down.js', line: 201, column: 21

    at com.tns.Runtime.callJSMethodNative(Native Method)
    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1021)
    at com.tns.Runtime.callJSMethodImpl(Runtime.java:903)
    at com.tns.Runtime.callJSMethod(Runtime.java:890)
    at com.tns.Runtime.callJSMethod(Runtime.java:874)
    at com.tns.Runtime.callJSMethod(Runtime.java:866)
    at com.tns.gen.android.widget.BaseAdapter_frnal_ts_helpers_l58_c38__DropDownAdapter.getView(BaseAdapter_frnal_ts_helpers_l58_c38__DropDownAdapter.java:42)
    at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:194)
    at android.widget.Spinner.onMeasure(Spinner.java:596)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
    at org.nativescript.widgets.StackLayout.onMeasure(StackLayout.java:83)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
    at org.nativescript.widgets.VerticalScrollView.onMeasure(VerticalScrollView.java:118)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.FlexboxLayout.measureVertical(FlexboxLayout.java:760)
    at org.nativescript.widgets.FlexboxLayout.onMeasure(FlexboxLayout.java:375)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.FlexboxLayout.measureVertical(FlexboxLayout.java:760)
    at org.nativescript.widgets.FlexboxLayout.onMeasure(FlexboxLayout.java:375)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
    at org.nativescript.widgets.AbsoluteLayout.onMeasure(AbsoluteLayout.java:33)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
    at org.nativescript.widgets.MeasureHelper.measureChildFixedColumnsAndRows(GridLayout.java:1059)
    at org.nativescript.widgets.MeasureHelper.measure(GridLayout.java:869)
    at org.nativescript.widgets.GridLayout.onMeasure(GridLayout.java:279)
    at android.view.View.measure(View.java:19914)
    at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
    at org.nativescript.widgets.ContentLayout.onMeasure(ContentLayout.java:32)
    at android.view.View.measure(View.java:19914)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6139)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
    at android.view.View.measure(View.java:19914)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6139)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1485)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:775)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
    at android.view.View.measure(View.java:19914)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6139)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
    at com.android.internal.policy.DecorView.onMeasure(DecorView.java:729)
    at android.view.View.measure(View.java:19914)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2434)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1480)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1739)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1364)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6757)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:923)
    at android.view.Choreographer.doCallbacks(Choreographer.java:735)
    at android.view.Choreographer.doFrame(Choreographer.java:667)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:909)
    at android.os.Handler.handleCallback(Handler.java:755)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:156)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)

Which platform(s) does your issue occur on?

Android

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

PeterStaev commented 7 years ago

Hey @noetius , need more details on this, as this seems specific to your set up. Also seems there is a very similar issues and stack trace in the nativescript repo (https://github.com/NativeScript/NativeScript/issues/4234), so it might be a problem with the core widgets.

noetius commented 7 years ago

Hello @PeterStaev, what details do you need?

PeterStaev commented 7 years ago

It would be best if you can isolate the problem in a sample app and attach it here. Or to apply changes in styles/pages in the demo project in this repo and then explain the changes you made so I can simulate the problem.

noetius commented 7 years ago

Ok, here it is. Inside "app\views\partials\filters\community.xml" there are 2 drop downs, this page is displayed within a modal opened by the button "TAP HERE". Hope it helps. app.zip

PeterStaev commented 7 years ago

Hey @noetius , thanks for the sample app. The problem should be fixed now with the new version on npm.

noetius commented 7 years ago

Thanks @PeterStaev, now it's working. Just as technical insight, what was the cause?

PeterStaev commented 7 years ago

You can click on the commit link above that closed the issue to see the details. Basically the problem was that the style for the drop down did not have a font-size defined so the logic was trying to set null / undefined to the font-size property.