Bridge Async vs JSI Sync Calls
A native call assumed to be synchronous exposes the core difference between the legacy bridge and JSI-powered New Architecture.
Codejavascript
import { NativeModules } from 'react-native';
const { DeviceInfo } = NativeModules;
// Legacy bridge-based native module
function isBatteryHealthy() {
const level = DeviceInfo.getBatteryLevel();
return level > 0.2;
}
if (isBatteryHealthy()) {
startBackgroundSync();
}This code always skips the background sync even on a fully charged device. What is the bug?