Skip to content

Error getting volume on update #6

@hendraneo

Description

@hendraneo

In your slider, when updating volume in state, should be parse to float.

Line 16:
this.setState({volume_value:parseFloat(evt.volume)});

And isn't the listener should be remove when component unmount ?

`code

componentDidMount() {
  this.DeviceEventVolumeListener = DeviceEventEmitter.addListener(
    'VolumeControllerValueUpdatedEvent', (evt) => {
      console.log("update view volume "+evt.volume);
      this.setState({volume_value:parseFloat(evt.volume)});
    }
  );
  ReactNativeVolumeController.update();
}
componentWillUnmount() {
  this.DeviceEventVolumeListener.remove();
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions