react-native-alarms 0.0.2 → 0.0.4

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.
@@ -1,5 +1,5 @@
1
1
  import type { TurboModule } from 'react-native';
2
- import { TurboModuleRegistry } from 'react-native';
2
+ import { NativeModules, Platform, TurboModuleRegistry } from 'react-native';
3
3
 
4
4
  /**
5
5
  * Shared contract of the native `Alarm` module.
@@ -92,4 +92,22 @@ export interface Spec extends TurboModule {
92
92
  removeListeners(count: number): void;
93
93
  }
94
94
 
95
- export default TurboModuleRegistry.getEnforcing<Spec>('Alarm');
95
+ const LINKING_ERROR =
96
+ "react-native-alarms: the native 'Alarm' module is not linked. " +
97
+ Platform.select({
98
+ ios: "Run 'pod install' in the ios folder, then rebuild the app.",
99
+ default: 'Rebuild the app after installing the package.',
100
+ });
101
+
102
+ // Both platforms register a legacy module, reachable through either registry
103
+ // depending on the architecture. Throw on first use, not on import.
104
+ const Alarm: Spec =
105
+ TurboModuleRegistry.get<Spec>('Alarm') ??
106
+ NativeModules.Alarm ??
107
+ new Proxy({} as Spec, {
108
+ get() {
109
+ throw new Error(LINKING_ERROR);
110
+ },
111
+ });
112
+
113
+ export default Alarm;
package/app.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "name": "ReactNativeAlarm",
3
- "displayName": "ReactNativeAlarm"
4
- }
package/index.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * @format
3
- */
4
-
5
- import { AppRegistry } from 'react-native';
6
- import App from './App';
7
- import { name as appName } from './app.json';
8
- import { AlarmRingScreen } from './AlarmRingScreen';
9
-
10
- AppRegistry.registerComponent(appName, () => App);
11
-
12
- AppRegistry.registerComponent('AlarmRing', () => AlarmRingScreen);