react-native-alarms 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -1
- package/index.d.ts +3 -7
- package/index.ts +0 -2
- package/ios/.xcode.env.local +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -246,7 +246,9 @@ Rings at regular intervals. Note: intervals reset if the app is killed.
|
|
|
246
246
|
}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
##
|
|
249
|
+
## Building Your Own Alarm UI
|
|
250
|
+
|
|
251
|
+
The library provides the core alarm management logic. You build your own UI components. Here's a complete example:
|
|
250
252
|
|
|
251
253
|
```typescript
|
|
252
254
|
import React, { useEffect, useState } from 'react';
|
|
@@ -384,3 +386,44 @@ For issues and questions, please visit:
|
|
|
384
386
|
- Cross-platform alarm scheduling
|
|
385
387
|
- Event-driven architecture
|
|
386
388
|
- Permission management
|
|
389
|
+
|
|
390
|
+
## Custom Alarm UI & Custom Data
|
|
391
|
+
|
|
392
|
+
The library supports completely custom alarm UI screens with custom data payloads.
|
|
393
|
+
|
|
394
|
+
### Basic Custom Screen Example
|
|
395
|
+
|
|
396
|
+
```typescript
|
|
397
|
+
import { NativeModules } from 'react-native';
|
|
398
|
+
import { AlarmService } from 'react-native-alarms/service';
|
|
399
|
+
|
|
400
|
+
export function MyCustomAlarmScreen({ alarmId, title, data }) {
|
|
401
|
+
const customData = JSON.parse(data || '{}');
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<View style={{ backgroundColor: customData.color }}>
|
|
405
|
+
<Text>{title}</Text>
|
|
406
|
+
<TouchableOpacity onPress={() => AlarmService.stopAlarm(alarmId)}>
|
|
407
|
+
<Text>Stop</Text>
|
|
408
|
+
</TouchableOpacity>
|
|
409
|
+
</View>
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Passing Custom Data
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
await AlarmService.scheduleAlarm({
|
|
418
|
+
timestamp: Date.now() + 5 * 60 * 1000,
|
|
419
|
+
title: 'Important!',
|
|
420
|
+
data: JSON.stringify({
|
|
421
|
+
backgroundColor: '#FF5252',
|
|
422
|
+
priority: 'high',
|
|
423
|
+
customMessage: 'This is urgent!',
|
|
424
|
+
}),
|
|
425
|
+
});
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**Full Guide:** See [CUSTOM_UI_GUIDE.md](./CUSTOM_UI_GUIDE.md) for complete examples and best practices.
|
|
429
|
+
|
package/index.d.ts
CHANGED
|
@@ -9,12 +9,8 @@ export type {
|
|
|
9
9
|
Alarm,
|
|
10
10
|
AlarmPermission,
|
|
11
11
|
AlarmEvent,
|
|
12
|
+
Spec as AlarmModuleSpec,
|
|
12
13
|
} from './specs/NativeAlarm';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export { AlarmDemo } from './AlarmDemo';
|
|
17
|
-
|
|
18
|
-
// Default export for backward compatibility
|
|
19
|
-
import type NativeAlarm from './specs/NativeAlarm';
|
|
20
|
-
export default NativeAlarm;
|
|
15
|
+
// Default export for type compatibility
|
|
16
|
+
export type { Spec as default } from './specs/NativeAlarm';
|
package/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export NODE_BINARY=/opt/homebrew/Cellar/node/26.10.0_1/bin/node
|