NativeScript / nativescript-datetimepicker

Plugin with date and time picking fields
Apache License 2.0
27 stars 26 forks source link

Android API 23 - DatePickerField does not appear #52

Closed ahmed-shahrour closed 4 years ago

ahmed-shahrour commented 4 years ago

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.

The DatePickerField does not appear on the screen...

Is there any code involved?

I'm using nativescript-vue

<template>
  <Page>
    <StackLayout>
      <DatePickerField
        hint="Select Date"
        dateFormat="EE, MMM dd YYYY"
        @dateChange="onDateTap"
      />
    </StackLayout>
  </Page>
</template>

<script>
export default {
    data() {
      return {
        dateValue: ""
      }
    },
    methods: {
      onDateTap(args) {
        this.dateValue = args.value;
      },
    }
}
</script>

this is the error on the phone when i press the backbutton:

An uncaught Exception occurred on "main" thread.
Calling js method run failed
Error: java.lang.NullPointerException: Attempt to write to field 'android.view.View org.nativescript.widgets.MeasureSpecs.child' on a null object reference
    org.nativescript.widgets.GridLayout.removeFromMap(GridLayout.java:229)
    org.nativescript.widgets.GridLayout.removeView(GridLayout.java:135)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
    com.tns.Runtime.callJSMethod(Runtime.java:1083)
    com.tns.Runtime.callJSMethod(Runtime.java:1063)
    com.tns.Runtime.callJSMethod(Runtime.java:1055)
    com.tns.gen.java.lang.Runnable.run(Runnable.java:17)
    android.os.Handler.handleCallback(Handler.java:739)
    android.os.Handler.dispatchMessage(Handler.java:95)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5417)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

StackTrace:
    CustomLayoutView._removeViewFromNativeVisualTree(file:///data/data/APPID/files/app/vendor.js:96324:18)
    at ViewBase._tearDownUI(file:///data/data/APPID/files/app/vendor.js:93607:19)
    at (file:///data/data/APPID/files/app/vendor.js:93601:13)
    at LayoutBaseCommon.eachChildView(file:///data/data/APPID/files/app/vendor.js:104731:20)
    at ViewCommon.eachChild(file:///data/data/APPID/files/app/vendor.js:95053:10)
    at ViewBase._tearDownUI(file:///data/data/APPID/files/app/vendor.js:93600:10)
    at (file:///data/data/APPID/files/app/vendor.js:93601:13)
    at LayoutBaseCommon.eachChildView(file:///data/data/APPID/files/app/vendor.js:104731:20)
    at ViewCommon.eachChild(file:///data/data/APPID/files/app/vendor.js:95053:10)
    at ViewBase._tearDownUI(file:///data/data/APPID/files/app/vendor.js:93600:10)
    at (file:///data/data/APPID/files/app/vendor.js:93601:13)
    at LayoutBaseCommon.eachChildView(file:///data/data/APPID/files/app/vendor.js:104731:20)
    at ViewCommon.eachChild(file:///data/data/APPID/files/app/vendor.js:95053:10)
    at ViewBase._tearDownUI(file:///data/data/APPID/files/app/vendor.js:93600:10)
    at (file:///data/data/APPID/files/app/vendor.js:93601:13)
    at ContentView.eachChildView(file:///data/data/APPIDn/files/app/vendor.js:90699:7)
    at ViewCommon.eachChild(file:///data/data/APPID/files/app/vendor.js:95053:10)
    at ViewBase._tearDownUI(file:///data/data/APPID/files/app/vendor.js:93600:10)
    at (file:///data/data/APPID/files/app/vendor.js:93601:13)
    at ContentView.eachChildView(file:///data/data/APPID/files/app/vendor.js:90699:7)
    at PageBase.eachChildView(file:///data/data/APPID/files/app/vendor.js:106198:36)
    at ViewCommon.eachChild(file:///data/data/APPID/files/app/vendor.js:95053:10)
    at ViewBase._tearDownUI(file:///data/data/APPID/files/app/vendor.js:93600:10)
    at ViewBase._removeViewCore(file:///data/data/APPID/files/app/vendor.js:93483:12)
    at ViewBase._removeView(file:///data/data/APPID/files/app/vendor.js:93472:10)
    at FrameBase._removeEntry(file:///data/data/APPID/files/app/vendor.js:99436:13)
    at Frame._removeEntry(file:///data/data/APPID/files/app/vendor.js:100532:35)
    at FrameBase._updateBackstack(file:///data/data/APPID/files/app/vendor.js:99524:12)
    at Frame.setCurrent(file:///data/data/APPID/files/app/vendor.js:100373:12)
    at (file:///data/data/APPID/files/app/vendor.js:99204:24)
    at invoke(file:///data/data/APPID/files/app/vendor.js:85768:21)
    at run(file:///data/data/APPID/files/app/vendor.js:85774:7)
    at com.tns.Runtime.callJSMethodNative(Native Method)
    at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
    at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
    at com.tns.Runtime.callJSMethod(Runtime.java:1083)
    at com.tns.Runtime.callJSMethod(Runtime.java:1063)
    at com.tns.Runtime.callJSMethod(Runtime.java:1055)
    at com.tns.gen.java.lang.Runnable.run(Runnable.java:17)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to write to field 'android.view.View org.nativescript.widgets.MeasureSpecs.child' on a null object reference
    at org.nativescript.widgets.GridLayout.removeFromMap(GridLayout.java:229)
    at org.nativescript.widgets.GridLayout.removeView(GridLayout.java:135)
    ... 14 more
elena-p commented 4 years ago

@ahmadshahrour951,

dateFormat="EE, MMM dd YYYY" is not correct format, it should be "EE, MMM dd yyyy". All plugin demos (including vue.js one) run properly on android api 23. I will mark this issue as question. If you isolate a bug in the plugin, please open another issue and share a sample app.

support[bot] commented 4 years ago

:wave: @ahmadshahrour951, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please, use Stackoverflow to get help.