Mobile Device Environment
- Device: iPad Mini (5th gen)
- OS: iPadOS 18.5
Application Environment
Provide information about your development environment:
- React Native version: 0.76.9
- RN Bluetooth Classic version: 1.73.0-rc.12
Describe the bug
- Calling
RNBluetoothClass.isBluetoothEnabled() always returns false on the first call, regardless of the actual bluetooth state. Calling the function twice in a row, via isBluetoothEnabled.finally(() => isBluetoothEnabled()) also always returns false on the first call. The only way i am able to actually get the proper bluetooth state, is by putting a short delay (~500ms) in between the function invocations, and only taking the last result.
To Reproduce
Steps to reproduce the behavior:
- Create a basic app with the following code:
export const App = () => {
useEffect(() => {
RNBluetoothClassic.isBluetoothEnabled()
.then((r) => console.log('bluetooth enabled: ', r))
.then(() => new Promise((res) => setTimeout(res, 1000)))
.then(() => RNBluetoothClassic.isBluetoothEnabled())
.then((r) => console.log('bluetooth enabled now?: ', r))
}, [])
return <Text>My App</Text>
}
- observe the following logs in the developer console:
bluetooth enabled: false
bluetooth enabled now?: true
Expected behavior
isBluetoothEnabled returns the proper response regardless of invocation timing.
Mobile Device Environment
Application Environment
Provide information about your development environment:
Describe the bug
RNBluetoothClass.isBluetoothEnabled()always returns false on the first call, regardless of the actual bluetooth state. Calling the function twice in a row, viaisBluetoothEnabled.finally(() => isBluetoothEnabled())also always returns false on the first call. The only way i am able to actually get the proper bluetooth state, is by putting a short delay (~500ms) in between the function invocations, and only taking the last result.To Reproduce
Steps to reproduce the behavior:
Expected behavior
isBluetoothEnabledreturns the proper response regardless of invocation timing.