react-native-volume-controller icon indicating copy to clipboard operation
react-native-volume-controller copied to clipboard

Error getting volume on update

Open hendraneo opened this issue 8 years ago • 1 comments

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();
}`

hendraneo avatar Jun 15 '17 11:06 hendraneo

I updated the code, and now have a other way to get this value.

onValueChange={ (value)=>{ this.isDragging = true; ReactNativeVolumeController.change(value); setTimeout(()=>{ this.isDragging = false; }

What is the version are you using?

Tavernari avatar Aug 04 '17 03:08 Tavernari