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

Components that depend on useIsHeadphonesConnected on Android don't re-render when bluethooth headphones are connected/disconnected. #1633

Open
eedeebee opened this issue Apr 23, 2024 · 2 comments

Comments

@eedeebee
Copy link

eedeebee commented Apr 23, 2024

Summary

useIsHeadphonesConnected hook doesn't trigger re-renderings when BT headphones are connected/disconnected on Android.
This works fine on iOS.

Current behavior

If you have a react component that uses this hook, it will not re-render anything that depends on the value of this hook on Android, when you connect/disconnect BT headphones.

Expected behavior

I can provide an example if that is helpful.

@mikehardy
Copy link
Collaborator

Hi there! A PR would be helpful, this isn't a use case of mine so someone will have to determine the root cause and code up a fix

@paulwellnerbou
Copy link

I have a similar issue on Android, useIsHeadphonesConnected does not trigger any event at all. I use

const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo);
const listener = deviceInfoEmitter.addListener('RNDeviceInfo_headphoneConnectionDidChange', (headphone) => { ... })

instead.

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

No branches or pull requests

3 participants