Skip to content

Commit d223a35

Browse files
committed
docs: changelog
1 parent 98b6952 commit d223a35

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

CHANGELOG.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,52 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.4.0] - 2025-12-01
9+
10+
### Added
11+
12+
- **React Hooks for Device State Monitoring** ([#38](https://github.com/l2hyunwoo/react-native-nitro-device-info/pull/38)): 7 new React hooks for reactive device state monitoring
13+
14+
**Battery & Power** (3 hooks):
15+
- `useBatteryLevel()`: Real-time battery level monitoring (0.0-1.0), polls every 5s
16+
- `useBatteryLevelIsLow()`: Low battery detection with platform-specific thresholds (iOS: 20%, Android: 15%)
17+
- `usePowerState()`: Comprehensive power state object with level, charging state, and low power mode
18+
19+
**Audio Output** (3 hooks):
20+
- `useIsHeadphonesConnected()`: Any headphone connection monitoring, polls every 1s
21+
- `useIsWiredHeadphonesConnected()`: Wired headphone detection, polls every 1s
22+
- `useIsBluetoothHeadphonesConnected()`: Bluetooth audio device detection, polls every 1s
23+
24+
**Display** (1 hook):
25+
- `useBrightness()`: Screen brightness monitoring (iOS only, returns -1 on Android), polls every 500ms
26+
27+
- **Example App Enhancements**:
28+
- Showcase app: Added HooksDemo screen with tab navigation for interactive hook demonstrations
29+
- Benchmark app: Added React hooks performance benchmarks (registration time, cleanup validation, callback latency)
30+
31+
- **Documentation**:
32+
- New hooks API reference (`docs/api/hooks.md`) with complete signatures and platform support tables
33+
- New React hooks usage guide (`docs/guide/react-hooks.md`) with 5+ examples
34+
- Updated migration guide with hooks comparison table
35+
36+
**Usage Example**:
37+
38+
```typescript
39+
import { useBatteryLevel, useIsHeadphonesConnected } from 'react-native-nitro-device-info';
40+
41+
function BatteryStatus() {
42+
const batteryLevel = useBatteryLevel();
43+
const isHeadphonesConnected = useIsHeadphonesConnected();
44+
45+
return (
46+
<View>
47+
<Text>Battery: {(batteryLevel * 100).toFixed(0)}%</Text>
48+
<Text>Headphones: {isHeadphonesConnected ? 'Connected' : 'Disconnected'}</Text>
49+
</View>
50+
);
51+
}
52+
```
53+
854
## [1.3.1] - 2025-12-01
955

1056
### Fixed
@@ -304,5 +350,8 @@ The following methods remain Promise-based as they perform I/O operations:
304350
- iOS and Android native implementations
305351
- Example apps (showcase and benchmark)
306352

307-
[1.0.0]: https://github.com/your-org/react-native-nitro-device-info/compare/v0.1.0...v1.0.0
308-
[0.1.0]: https://github.com/your-org/react-native-nitro-device-info/releases/tag/v0.1.0
353+
[1.4.0]: https://github.com/l2hyunwoo/react-native-nitro-device-info/compare/v1.3.1...v1.4.0
354+
[1.3.1]: https://github.com/l2hyunwoo/react-native-nitro-device-info/compare/v1.3.0...v1.3.1
355+
[1.3.0]: https://github.com/l2hyunwoo/react-native-nitro-device-info/compare/v1.0.0...v1.3.0
356+
[1.0.0]: https://github.com/l2hyunwoo/react-native-nitro-device-info/compare/v0.1.0...v1.0.0
357+
[0.1.0]: https://github.com/l2hyunwoo/react-native-nitro-device-info/releases/tag/v0.1.0

0 commit comments

Comments
 (0)