Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getting volume on update #6

Open
hendraneo opened this issue Jun 15, 2017 · 1 comment
Open

Error getting volume on update #6

hendraneo opened this issue Jun 15, 2017 · 1 comment

Comments

@hendraneo
Copy link

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();
}`
@Tavernari
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants