Skip to content

Default value returns NaN for numeric, single-property component schemas in 0.7.* and 0.8.0 #3442

@dsinni

Description

@dsinni

Default value returns NaN for numeric, single-property component schemas in A-Frame 0.7.* and 0.8.0.

I noticed that single-property components may be deprecated in future releases according to #2536, however they don't currently function as documented: https://aframe.io/docs/0.8.0/core/component.html#single-property-schema

  • A-Frame Version: 0.7.* and 0.8.0
  • Platform / Device: Bug reproduced on all devices tested: Firefox, Chrome, Edge, Samsung Internet on Windows and Android.
  • Reproducible Code Snippet or URL:
AFRAME.registerComponent( 'test-component', {

  // Bug exists for types 'number' and 'int', possibly others.
  schema: { type: 'number', default: 10 },

  init: function() {
    // Returns NaN
    console.log( this.data ); 
  }

});

Demo: https://codepen.io/dansinni/pen/vRYJQy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions