nativescript-community / ui-drawer

NativeScript plugin that allows you to easily add a side drawer (side menu) to your projects.
https://nativescript-community.github.io/ui-drawer/
Apache License 2.0
24 stars 12 forks source link

Error: Unsupported PercentLength XX% #15

Closed luiguild closed 3 years ago

luiguild commented 3 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.

Install the plugin Create a component to handle it Declare on your template Declare a StackLayout with "~leftDrawer" attribute Create a computed that returns a percetage number, but as a String, e.g. "75%"

Is there any code involved?

<template lang="pug">
Drawer(
    ref="drawer"
  )
    StackLayout(
      ~leftDrawer,
      :width="drawerSize"
    )
</template>
<script>
export default {
  props: {
    size: {
      type: String,
      default: 'xl'
    }
  },
  computed: {
    drawerSize () {
      return [
        {
          xs: '15%',
          sm: '30%',
          md: '45%',
          lg: '60%',
          xl: '75%',
          hg: '100%'
        }[this.size]
      ]
    }
  }
}
</script>

The component is receiving the right result from the computed, but when you run the code you get

Calling js method onCreateView failedSystem.err: Error: Unsupported PercentLength 75%
System.err:
System.err: StackTrace:
System.err: View.<computed>(file: src\webpack:\nativescript-yoonit-components\node_modules\@nativescript\core\ui\core\view\index.android.js:1033:0)System.err:     at applyAllNativeSetters(file: src\webpack:\nativescript-yoonit-components\node_modules\@nativescript\core\ui\core\properties\index.js:1152:0)
...

I know that this can be a problem in 'StackLayout' instead of 'ui-drawer', but the most strange thing to me is that when you put the same value ("75%"), but directly as a simple string, it's works

luiguild commented 3 years ago

Forget it, my computed are return an array instead of string, fixed xD