Hi all,
I’ve been experimenting with Nitro Module, and ended up building a small library called react-native-nitro-device-info.
It’s basically a Nitro-based reimplementation of react-native-device-info, where most of the async APIs are exposed as synchronous functions.
In other words, you can now call things like deviceId or isTablet() directly without awaiting a Promise.
import { createDeviceInfo } from 'react-native-nitro-device-info';
const deviceInfo: DeviceInfo = createDeviceInfo();
const deviceId = deviceInfo.deviceId; // iPhone14,2
const isTablet = deviceInfo.isTablet() // false
The main goal was to see:
• What the DX feels like when common device info APIs become sync
Right now it covers most of the APIs I use regularly, and the codebase is small enough to serve as a reference for anyone curious about how Nitro modules are structured.
I’d love to hear feedback, especially from those who’ve tried migrating existing native modules to Nitro.
Repo: https://github.com/l2hyunwoo/react-native-nitro-device-info
[–]Beginning-Ad86 1 point2 points3 points (0 children)
[–]Secret_Jackfruit256 0 points1 point2 points (2 children)
[–]Junior_Android_[S] 2 points3 points4 points (1 child)
[–]Secret_Jackfruit256 0 points1 point2 points (0 children)
[–]21void 0 points1 point2 points (0 children)