PeterStaev / NativeScript-Drop-Down

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

Error #137

Closed DBhail closed 6 years ago

DBhail commented 6 years ago

Theres an issue with drop-down.js in ver 3.1.3. If you use the older version of the script it works !?

System.err: Frame: function:'DropDownAdapter._generateView', file:'file:///data/data/com.bhail.issues/files/app/tns_modules/nativescript-drop-down/drop-down.js', line: 251, column: 31 System.err: Frame: function:'DropDownAdapter.getDropDownView', file:'file:///data/data/com.bhail.issues/files/app/tns_modules/nativescript-drop-down/drop-down.js', line: 236, column: 21 System.err: Frame: function:'TNSSpinner.performClick', file:'file:///data/data/com.bhail.issues/files/app/tns_modules/nativescript-drop-down/drop-down.js', line: 187, column: 46 System.err: at com.tns.Runtime.callJSMethodNative(Native Method) System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1084) System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:966) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:953) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:937) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:929) System.err: at com.tns.gen.android.widget.BaseAdapter_frnal_ts_helpers_l58_c38DropDownAdapter.getDropDownView(BaseAdapter_frnal_ts_helpers_l58_c38__DropDownAdapter.java:50) System.err: at android.widget.Spinner$DropDownAdapter.getDropDownView(Spinner.java:853) System.err: at android.widget.Spinner$DropDownAdapter.getView(Spinner.java:849) System.err: at android.widget.Spinner.measureContentWidth(Spinner.java:734) System.err: at android.widget.Spinner$DropdownPopup.computeContentWidth(Spinner.java:1081) System.err: at android.widget.Spinner$DropdownPopup.show(Spinner.java:1107) System.err: at android.widget.Spinner.performClick(Spinner.java:658) System.err: at com.tns.Runtime.callJSMethodNative(Native Method) System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1084) System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:966) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:953) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:937) System.err: at com.tns.Runtime.callJSMethod(Runtime.java:929) System.err: at com.tns.gen.android.widget.Spinner_frnal_ts_helpers_l58_c38TNSSpinner.performClick(Spinner_frnal_ts_helpers_l58_c38__TNSSpinner.java:41) System.err: at android.view.View$PerformClick.run(View.java:18422) System.err: at android.os.Handler.handleCallback(Handler.java:733) System.err: at android.os.Handler.dispatchMessage(Handler.java:95) System.err: at android.os.Looper.loop(Looper.java:136) System.err: at android.app.ActivityThread.main(ActivityThread.java:5001) System.err: at java.lang.reflect.Method.invokeNative(Native Method) System.err: at java.lang.reflect.Method.invoke(Method.java:515) System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) System.err: at dalvik.system.NativeStart.main(Native Method) System.err: Caused by: java.lang.NullPointerException System.err: at android.widget.TextView.setTextColor(TextView.java:2641) System.err: ... 30 more ActivityManager: Process com.bhail.issues (pid 3076) has died.

PeterStaev commented 6 years ago

Hey @DBhail , this seems to similar to #136 . Can you try to add a color CSS property for the drop down (either via css/scss or inline via the style attribute)?

DBhail commented 6 years ago

Thank you. Yes!!. By simply adding the property Color it appears to work. But it has to be a property and not through CSS which in turn has no effect. Probably best to update demo to include this property as most people simply cut and paste.

<StackLayout class="input-field">
    <Label text="Type" class="label font-weight-bold m-b-5" textWrap="true"></Label>
    <DropDown [disabled]="!isEditMode()" #ddtype [class]="cssClass" [items]="typeSelectionItems" [(ngModel)]="typeSelectionIndex"
      [hint]="hint" (selectedIndexChanged)="onTypeSelectionChange($event)"
      backroundColor="white" color="black">
    </DropDown>
  </StackLayout>
PeterStaev commented 6 years ago

Great! Well I will be working on fixing that problem so there is some default value and no need to manually set ones 😄