Type Definitions
Complete TypeScript type definitions for react-native-nitro-device-info.
Importing Types
Core Types
PowerState
Complete power and battery state information.
Usage:
Fields:
- batteryLevel: Number from 0.0 (0%) to 1.0 (100%)
- batteryState: Current charging state (see BatteryState below)
- lowPowerMode: iOS only - indicates if Low Power Mode is enabled
BatteryState
Battery charging status.
Values:
- unknown: Battery state cannot be determined
- unplugged: Battery is discharging (not plugged in)
- charging: Battery is currently charging
- full: Battery is fully charged (may still be plugged in)
Usage:
NavigationMode
Android navigation mode types.
Values:
- gesture: Full gesture navigation (swipe-based)
- buttons: Traditional 3-button navigation (Back, Home, Recent)
- twobuttons: 2-button navigation (Back, Home with swipe up)
- unknown: Cannot determine (always returns this on iOS)
Usage:
Platform Behavior:
- Android API 29+: Returns actual navigation mode
- Android API < 29: Returns
"buttons"(gesture nav didn't exist) - iOS: Always returns
"unknown"
DeviceType
Device category classification.
Values:
- Handset: Standard smartphone
- Tablet: Tablet device (iPad, Android tablets)
- Tv: Smart TV or set-top box
- Desktop: Desktop or laptop computer
- GamingConsole: Gaming console
- unknown: Device type cannot be determined
Usage:
Platform Behavior:
- iOS: Accurately detects iPhone, iPad, Apple TV
- Android: Uses screen size heuristics (>= 600dp smallest width = Tablet)
DeviceInfo Interface
The main module interface providing all device information methods.
Usage Examples
Type-Safe Power State
Type-Safe Device Type Handling
Custom Type Aliases
You can create your own type aliases for convenience:
TypeScript Configuration
Ensure your tsconfig.json is configured correctly:
Type Safety Benefits
IntelliSense Support
Full autocomplete for all methods and properties:
Compile-Time Error Checking
Type Guards
Next Steps
- View the Complete API Reference for all available methods
- Check out Usage Examples
- Read the Migration Guide for upgrading from other libraries
