hirbod / react-native-volume-manager

React Native module which adds the ability to change the system volume on iOS and Android, listen to volume changes and supress the native volume UI to build your own volume slider or UX. It can listen to iOS mute switch and ringer mode changes on Android (and let you set the ringer mode)
MIT License
216 stars 14 forks source link

iOS: VolumeManager.addVolumeListener not responding to volume changing #37

Closed hendraustin closed 2 weeks ago

hendraustin commented 2 weeks ago

Hi there,

I'm enjoying this library a lot, it works flawlessly on Android. However, as the title mentions, it doesn't seem to work as intended on an iOS device (iPhone 15 Pro simulator).

I haven't had the chance to test this on a physical device, but I assume it wouldn't change the outcome. This is my current code:

useEffect(() => {
  const volumeListener = VolumeManager.addVolumeListener(() => {
    console.log("Volume changed!");
    // doSomething();
  });
  return () => {
    volumeListener.remove();
  };
}, []);

I'm getting into the useEffect just fine, but I'm not seeing the Volume changed! at any point when pressing the volume buttons on the iOS device.

Thanks in advance for any recommendations!

hendraustin commented 2 weeks ago

Closing this for now as I missed the mention of it not working on iOS simulators. Apologies!