`addVolumeListener` is fired twice when press volume key
See original GitHub issueI just tested android device only.
There is a problem that the addVolumeListener
is called twice when the sound mode is “music”.
my code snipppet is here
componentDidMount = () => {
this.volumeListener = SystemSetting.addVolumeListener(this.setVolume);
};
componentWillUnmount = () => {
SystemSetting.removeVolumeListener(this.volumeListener);
};
setVolume = currentVolume => {
console.log("call setvolume");
this.setState({ currentVolume: currentVolume.value });
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
button onClick firing twice - javascript - Stack Overflow
is there a way to prevent this from being called twice or is because I have a input radio tag inside the button...
Read more >Volume occasionally goes all the way to max/min when I press ...
Sometimes when I press twice on the volume button to adjust the volume up or down it just continues to go all the...
Read more >Volume buttons changing my screen instead…
Volume buttons changing my screen instead of volume? I recently got a 2013 Macbook Air, but now I'm having a problem. When I...
Read more >22 Things Your iPhone's Volume Buttons Can Do Besides ...
You can also press and hold a volume button to start recording and let ... disabled for that particular alarm, so double-check its...
Read more >Next Track: Volume button skip - Apps on Google Play
Next Track lets you skip songs, mute or stop music using your volume buttons. Next Track works with all standard music players to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi. Did anyone solve this issue?
This solution does not work for my problem. I start the camera, thanks to a button, a self-timer starts, then after the recording starts. The problem with
shouldComponentUpdate
is that I don’t care about the rendering of the component. Thanks to theVolumeListener
, I want to be able to start recording with the volume button. With a multiple call from the listener, it prevents me from doing what I want and the shouldComponentUpdate() doesn’t work because it only concerns rendering.Sorry I’m French and I must have made some mistakes.
Edit : I have found a solution but it’s not a good solution