react-native-geofence-manager 0.1.0-beta.1 → 0.1.0-beta.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.
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ const NativeModule = _reactNative.TurboModuleRegistry.get('GeofenceManager');
9
+ if (!NativeModule) {
10
+ console.warn('react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.');
11
+ }
12
+ var _default = exports.default = NativeModule;
13
+ //# sourceMappingURL=NativeGeofenceManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","NativeModule","TurboModuleRegistry","get","console","warn","_default","exports","default"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAqBA,MAAMC,YAAY,GAAGC,gCAAmB,CAACC,GAAG,CAAO,iBAAiB,CAAC;AAErE,IAAI,CAACF,YAAY,EAAE;EACjBG,OAAO,CAACC,IAAI,CACV,qHACF,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,YAAY","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GeofenceManager = void 0;
7
+ var _NativeGeofenceManager = _interopRequireDefault(require("./NativeGeofenceManager"));
8
+ var _reactNative = require("react-native");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const emitter = new _reactNative.NativeEventEmitter(_NativeGeofenceManager.default);
11
+ const MAX_REGIONS = 100;
12
+ const notLinkedError = () => Promise.reject(new Error('react-native-geofence-manager: Native module not linked. Rebuild your app.'));
13
+ const GeofenceManager = exports.GeofenceManager = {
14
+ start: (regions, options) => {
15
+ if (!_NativeGeofenceManager.default) return notLinkedError();
16
+ if (regions.length > MAX_REGIONS) {
17
+ return Promise.reject(new Error(`Limite máximo de ${MAX_REGIONS} regiões excedido. Recebido: ${regions.length}`));
18
+ }
19
+ return _NativeGeofenceManager.default.start(regions, options ?? {});
20
+ },
21
+ stop: () => {
22
+ if (!_NativeGeofenceManager.default) return notLinkedError();
23
+ return _NativeGeofenceManager.default.stop();
24
+ },
25
+ onEnter: cb => emitter.addListener('onEnter', cb),
26
+ onExit: cb => emitter.addListener('onExit', cb),
27
+ onDwell: cb => emitter.addListener('onDwell', cb),
28
+ registerBackgroundHandler: handler => {
29
+ if (_reactNative.Platform.OS !== 'android') {
30
+ return;
31
+ }
32
+ _reactNative.AppRegistry.registerHeadlessTask('GeofenceHeadlessTask', () => handler);
33
+ }
34
+ };
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_NativeGeofenceManager","_interopRequireDefault","require","_reactNative","e","__esModule","default","emitter","NativeEventEmitter","NativeGeofence","MAX_REGIONS","notLinkedError","Promise","reject","Error","GeofenceManager","exports","start","regions","options","length","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","Platform","OS","AppRegistry","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AAAyE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEzE,MAAMG,OAAO,GAAG,IAAIC,+BAAkB,CAACC,8BAAqB,CAAC;AAE7D,MAAMC,WAAW,GAAG,GAAG;AAmBvB,MAAMC,cAAc,GAAGA,CAAA,KACrBC,OAAO,CAACC,MAAM,CACZ,IAAIC,KAAK,CACP,4EACF,CACF,CAAC;AAEI,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC7BE,KAAK,EAAEA,CAACC,OAAiB,EAAEC,OAAyB,KAAoB;IACtE,IAAI,CAACV,8BAAc,EAAE,OAAOE,cAAc,CAAC,CAAC;IAC5C,IAAIO,OAAO,CAACE,MAAM,GAAGV,WAAW,EAAE;MAChC,OAAOE,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,oBAAoBJ,WAAW,gCAAgCQ,OAAO,CAACE,MAAM,EAC/E,CACF,CAAC;IACH;IACA,OAAOX,8BAAc,CAACQ,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC;EACrD,CAAC;EAEDE,IAAI,EAAEA,CAAA,KAAqB;IACzB,IAAI,CAACZ,8BAAc,EAAE,OAAOE,cAAc,CAAC,CAAC;IAC5C,OAAOF,8BAAc,CAACY,IAAI,CAAC,CAAC;EAC9B,CAAC;EAEDC,OAAO,EAAGC,EAAyC,IACjDhB,OAAO,CAACiB,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDhB,OAAO,CAACiB,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDhB,OAAO,CAACiB,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CI,yBAAyB,EAAGC,OAAkC,IAAW;IACvE,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACAC,wBAAW,CAACC,oBAAoB,CAAC,sBAAsB,EAAE,MAAMJ,OAAO,CAAC;EACzE;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { TurboModuleRegistry } from 'react-native';
4
- export default TurboModuleRegistry.getEnforcing('GeofenceManager');
4
+ const NativeModule = TurboModuleRegistry.get('GeofenceManager');
5
+ if (!NativeModule) {
6
+ console.warn('react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.');
7
+ }
8
+ export default NativeModule;
5
9
  //# sourceMappingURL=NativeGeofenceManager.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAqBpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","NativeModule","get","console","warn"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAqBpE,MAAMC,YAAY,GAAGD,mBAAmB,CAACE,GAAG,CAAO,iBAAiB,CAAC;AAErE,IAAI,CAACD,YAAY,EAAE;EACjBE,OAAO,CAACC,IAAI,CACV,qHACF,CAAC;AACH;AAEA,eAAeH,YAAY","ignoreList":[]}
@@ -1,17 +1,22 @@
1
1
  "use strict";
2
2
 
3
- import NativeGeofence from "./NativeGeofenceManager.js";
3
+ import NativeGeofence from './NativeGeofenceManager';
4
4
  import { AppRegistry, NativeEventEmitter, Platform } from 'react-native';
5
5
  const emitter = new NativeEventEmitter(NativeGeofence);
6
6
  const MAX_REGIONS = 100;
7
+ const notLinkedError = () => Promise.reject(new Error('react-native-geofence-manager: Native module not linked. Rebuild your app.'));
7
8
  export const GeofenceManager = {
8
9
  start: (regions, options) => {
10
+ if (!NativeGeofence) return notLinkedError();
9
11
  if (regions.length > MAX_REGIONS) {
10
12
  return Promise.reject(new Error(`Limite máximo de ${MAX_REGIONS} regiões excedido. Recebido: ${regions.length}`));
11
13
  }
12
14
  return NativeGeofence.start(regions, options ?? {});
13
15
  },
14
- stop: NativeGeofence.stop,
16
+ stop: () => {
17
+ if (!NativeGeofence) return notLinkedError();
18
+ return NativeGeofence.stop();
19
+ },
15
20
  onEnter: cb => emitter.addListener('onEnter', cb),
16
21
  onExit: cb => emitter.addListener('onExit', cb),
17
22
  onDwell: cb => emitter.addListener('onDwell', cb),
@@ -1 +1 @@
1
- {"version":3,"names":["NativeGeofence","AppRegistry","NativeEventEmitter","Platform","emitter","MAX_REGIONS","GeofenceManager","start","regions","options","length","Promise","reject","Error","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","OS","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,cAAc,MAGd,4BAAyB;AAChC,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAExE,MAAMC,OAAO,GAAG,IAAIF,kBAAkB,CAACF,cAAqB,CAAC;AAE7D,MAAMK,WAAW,GAAG,GAAG;AAmBvB,OAAO,MAAMC,eAAe,GAAG;EAC7BC,KAAK,EAAEA,CAACC,OAAiB,EAAEC,OAAyB,KAAoB;IACtE,IAAID,OAAO,CAACE,MAAM,GAAGL,WAAW,EAAE;MAChC,OAAOM,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,oBAAoBR,WAAW,gCAAgCG,OAAO,CAACE,MAAM,EAC/E,CACF,CAAC;IACH;IACA,OAAOV,cAAc,CAACO,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC;EACrD,CAAC;EAEDK,IAAI,EAAEd,cAAc,CAACc,IAAI;EAEzBC,OAAO,EAAGC,EAAyC,IACjDZ,OAAO,CAACa,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDZ,OAAO,CAACa,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDZ,OAAO,CAACa,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CI,yBAAyB,EAAGC,OAAkC,IAAW;IACvE,IAAIlB,QAAQ,CAACmB,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACArB,WAAW,CAACsB,oBAAoB,CAAC,sBAAsB,EAAE,MAAMF,OAAO,CAAC;EACzE;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeGeofence","AppRegistry","NativeEventEmitter","Platform","emitter","MAX_REGIONS","notLinkedError","Promise","reject","Error","GeofenceManager","start","regions","options","length","stop","onEnter","cb","addListener","onExit","onDwell","registerBackgroundHandler","handler","OS","registerHeadlessTask"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,cAAc,MAGd,yBAAyB;AAChC,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAExE,MAAMC,OAAO,GAAG,IAAIF,kBAAkB,CAACF,cAAqB,CAAC;AAE7D,MAAMK,WAAW,GAAG,GAAG;AAmBvB,MAAMC,cAAc,GAAGA,CAAA,KACrBC,OAAO,CAACC,MAAM,CACZ,IAAIC,KAAK,CACP,4EACF,CACF,CAAC;AAEH,OAAO,MAAMC,eAAe,GAAG;EAC7BC,KAAK,EAAEA,CAACC,OAAiB,EAAEC,OAAyB,KAAoB;IACtE,IAAI,CAACb,cAAc,EAAE,OAAOM,cAAc,CAAC,CAAC;IAC5C,IAAIM,OAAO,CAACE,MAAM,GAAGT,WAAW,EAAE;MAChC,OAAOE,OAAO,CAACC,MAAM,CACnB,IAAIC,KAAK,CACP,oBAAoBJ,WAAW,gCAAgCO,OAAO,CAACE,MAAM,EAC/E,CACF,CAAC;IACH;IACA,OAAOd,cAAc,CAACW,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC;EACrD,CAAC;EAEDE,IAAI,EAAEA,CAAA,KAAqB;IACzB,IAAI,CAACf,cAAc,EAAE,OAAOM,cAAc,CAAC,CAAC;IAC5C,OAAON,cAAc,CAACe,IAAI,CAAC,CAAC;EAC9B,CAAC;EAEDC,OAAO,EAAGC,EAAyC,IACjDb,OAAO,CAACc,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDb,OAAO,CAACc,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDb,OAAO,CAACc,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CI,yBAAyB,EAAGC,OAAkC,IAAW;IACvE,IAAInB,QAAQ,CAACoB,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACAtB,WAAW,CAACuB,oBAAoB,CAAC,sBAAsB,EAAE,MAAMF,OAAO,CAAC;EACzE;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeGeofenceManager.d.ts","sourceRoot":"","sources":["../../../src/NativeGeofenceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;;AAED,wBAAyE"}
1
+ {"version":3,"file":"NativeGeofenceManager.d.ts","sourceRoot":"","sources":["../../../src/NativeGeofenceManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,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AMtE,CAAC;AAEF,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,169 +1,168 @@
1
- {
2
- "name": "react-native-geofence-manager",
3
- "version": "0.1.0-beta.1",
4
- "description": "Robust manager for your geofencing areas.",
5
- "main": "./lib/module/index.js",
6
- "types": "./lib/typescript/src/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "source": "./src/index.tsx",
10
- "types": "./lib/typescript/src/index.d.ts",
11
- "default": "./lib/module/index.js"
12
- },
13
- "./package.json": "./package.json"
14
- },
15
- "files": [
16
- "src",
17
- "lib",
18
- "android",
19
- "ios",
20
- "cpp",
21
- "*.podspec",
22
- "react-native.config.js",
23
- "!ios/build",
24
- "!android/build",
25
- "!android/gradle",
26
- "!android/gradlew",
27
- "!android/gradlew.bat",
28
- "!android/local.properties",
29
- "!**/__tests__",
30
- "!**/__fixtures__",
31
- "!**/__mocks__",
32
- "!**/.*"
33
- ],
34
- "scripts": {
35
- "example": "yarn workspace react-native-geofence-manager-example",
36
- "prepare": "bob build",
37
- "typecheck": "tsc",
38
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
- "test": "jest",
40
- "release": "release-it --only-version",
41
- "clean": "rm -rf node_modules example/node_modules lib android/build example/android/build example/android/app/build example/android/.gradle .yarn/cache && yarn cache clean && yarn install && yarn prepare"
42
- },
43
- "keywords": [
44
- "react-native",
45
- "ios",
46
- "android"
47
- ],
48
- "repository": {
49
- "type": "git",
50
- "url": "git+https://github.com/izidiodev/react-native-geofence-manager.git"
51
- },
52
- "author": "Izidio <izidio.dev.work@gmail.com> (https://github.com/izidiodev)",
53
- "license": "MIT",
54
- "bugs": {
55
- "url": "https://github.com/izidiodev/react-native-geofence-manager/issues"
56
- },
57
- "homepage": "https://github.com/izidiodev/react-native-geofence-manager#readme",
58
- "publishConfig": {
59
- "registry": "https://registry.npmjs.org/"
60
- },
61
- "devDependencies": {
62
- "@commitlint/config-conventional": "^19.8.1",
63
- "@eslint/compat": "^1.3.2",
64
- "@eslint/eslintrc": "^3.3.1",
65
- "@eslint/js": "^9.35.0",
66
- "@react-native/babel-preset": "0.83.0",
67
- "@react-native/eslint-config": "0.83.0",
68
- "@release-it/conventional-changelog": "^10.0.1",
69
- "@types/jest": "^29.5.14",
70
- "@types/react": "^19.2.0",
71
- "commitlint": "^19.8.1",
72
- "del-cli": "^6.0.0",
73
- "eslint": "^9.35.0",
74
- "eslint-config-prettier": "^10.1.8",
75
- "eslint-plugin-prettier": "^5.5.4",
76
- "jest": "^29.7.0",
77
- "lefthook": "^2.0.3",
78
- "prettier": "^2.8.8",
79
- "react": "19.2.0",
80
- "react-native": "0.83.0",
81
- "react-native-builder-bob": "^0.40.17",
82
- "release-it": "^19.0.4",
83
- "turbo": "^2.5.6",
84
- "typescript": "^5.9.2"
85
- },
86
- "peerDependencies": {
87
- "react": "*",
88
- "react-native": "*"
89
- },
90
- "workspaces": [
91
- "example"
92
- ],
93
- "packageManager": "yarn@4.11.0",
94
- "react-native-builder-bob": {
95
- "source": "src",
96
- "output": "lib",
97
- "targets": [
98
- [
99
- "module",
100
- {
101
- "esm": true
102
- }
103
- ],
104
- [
105
- "typescript",
106
- {
107
- "project": "tsconfig.build.json"
108
- }
109
- ]
110
- ]
111
- },
112
- "codegenConfig": {
113
- "name": "GeofenceManagerSpec",
114
- "type": "modules",
115
- "jsSrcsDir": "src",
116
- "android": {
117
- "javaPackageName": "com.geofencemanager"
118
- }
119
- },
120
- "commitlint": {
121
- "extends": [
122
- "@commitlint/config-conventional"
123
- ]
124
- },
125
- "prettier": {
126
- "quoteProps": "consistent",
127
- "singleQuote": true,
128
- "tabWidth": 2,
129
- "trailingComma": "es5",
130
- "useTabs": false
131
- },
132
- "jest": {
133
- "preset": "react-native",
134
- "modulePathIgnorePatterns": [
135
- "<rootDir>/example/node_modules",
136
- "<rootDir>/lib/"
137
- ]
138
- },
139
- "release-it": {
140
- "git": {
141
- "commitMessage": "chore: release ${version}",
142
- "tagName": "v${version}"
143
- },
144
- "npm": {
145
- "publish": true
146
- },
147
- "github": {
148
- "release": true
149
- },
150
- "plugins": {
151
- "@release-it/conventional-changelog": {
152
- "preset": {
153
- "name": "angular"
154
- }
155
- }
156
- }
157
- },
158
- "create-react-native-library": {
159
- "type": "turbo-module",
160
- "languages": "kotlin-objc",
161
- "tools": [
162
- "lefthook",
163
- "eslint",
164
- "jest",
165
- "release-it"
166
- ],
167
- "version": "0.57.0"
168
- }
169
- }
1
+ {
2
+ "name": "react-native-geofence-manager",
3
+ "version": "0.1.0-beta.3",
4
+ "description": "Robust manager for your geofencing areas.",
5
+ "main": "./lib/commonjs/index.js",
6
+ "module": "./lib/module/index.js",
7
+ "types": "./lib/typescript/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "source": "./src/index.tsx",
11
+ "types": "./lib/typescript/src/index.d.ts",
12
+ "import": "./lib/module/index.js",
13
+ "require": "./lib/commonjs/index.js",
14
+ "default": "./lib/commonjs/index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "src",
20
+ "lib",
21
+ "android",
22
+ "ios",
23
+ "cpp",
24
+ "*.podspec",
25
+ "react-native.config.js",
26
+ "!ios/build",
27
+ "!android/build",
28
+ "!android/gradle",
29
+ "!android/gradlew",
30
+ "!android/gradlew.bat",
31
+ "!android/local.properties",
32
+ "!**/__tests__",
33
+ "!**/__fixtures__",
34
+ "!**/__mocks__",
35
+ "!**/.*"
36
+ ],
37
+ "scripts": {
38
+ "example": "yarn workspace react-native-geofence-manager-example",
39
+ "prepare": "bob build",
40
+ "typecheck": "tsc",
41
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
42
+ "test": "jest",
43
+ "release": "release-it --only-version",
44
+ "clean": "rm -rf node_modules example/node_modules lib android/build example/android/build example/android/app/build example/android/.gradle .yarn/cache && yarn cache clean && yarn install && yarn prepare"
45
+ },
46
+ "keywords": [
47
+ "react-native",
48
+ "ios",
49
+ "android"
50
+ ],
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/izidiodev/react-native-geofence-manager.git"
54
+ },
55
+ "author": "Izidio <izidio.dev.work@gmail.com> (https://github.com/izidiodev)",
56
+ "license": "MIT",
57
+ "bugs": {
58
+ "url": "https://github.com/izidiodev/react-native-geofence-manager/issues"
59
+ },
60
+ "homepage": "https://github.com/izidiodev/react-native-geofence-manager#readme",
61
+ "publishConfig": {
62
+ "registry": "https://registry.npmjs.org/"
63
+ },
64
+ "devDependencies": {
65
+ "@commitlint/config-conventional": "^19.8.1",
66
+ "@eslint/compat": "^1.3.2",
67
+ "@eslint/eslintrc": "^3.3.1",
68
+ "@eslint/js": "^9.35.0",
69
+ "@react-native/babel-preset": "0.83.0",
70
+ "@react-native/eslint-config": "0.83.0",
71
+ "@release-it/conventional-changelog": "^10.0.1",
72
+ "@types/jest": "^29.5.14",
73
+ "@types/react": "^19.2.0",
74
+ "commitlint": "^19.8.1",
75
+ "del-cli": "^6.0.0",
76
+ "eslint": "^9.35.0",
77
+ "eslint-config-prettier": "^10.1.8",
78
+ "eslint-plugin-prettier": "^5.5.4",
79
+ "jest": "^29.7.0",
80
+ "lefthook": "^2.0.3",
81
+ "prettier": "^2.8.8",
82
+ "react": "19.2.0",
83
+ "react-native": "0.83.0",
84
+ "react-native-builder-bob": "^0.40.17",
85
+ "release-it": "^19.0.4",
86
+ "turbo": "^2.5.6",
87
+ "typescript": "^5.9.2"
88
+ },
89
+ "peerDependencies": {
90
+ "react": "*",
91
+ "react-native": "*"
92
+ },
93
+ "workspaces": [
94
+ "example"
95
+ ],
96
+ "packageManager": "yarn@4.11.0",
97
+ "react-native-builder-bob": {
98
+ "source": "src",
99
+ "output": "lib",
100
+ "targets": [
101
+ "commonjs",
102
+ "module",
103
+ [
104
+ "typescript",
105
+ {
106
+ "project": "tsconfig.build.json"
107
+ }
108
+ ]
109
+ ]
110
+ },
111
+ "codegenConfig": {
112
+ "name": "GeofenceManagerSpec",
113
+ "type": "modules",
114
+ "jsSrcsDir": "src",
115
+ "android": {
116
+ "javaPackageName": "com.geofencemanager"
117
+ }
118
+ },
119
+ "commitlint": {
120
+ "extends": [
121
+ "@commitlint/config-conventional"
122
+ ]
123
+ },
124
+ "prettier": {
125
+ "quoteProps": "consistent",
126
+ "singleQuote": true,
127
+ "tabWidth": 2,
128
+ "trailingComma": "es5",
129
+ "useTabs": false
130
+ },
131
+ "jest": {
132
+ "preset": "react-native",
133
+ "modulePathIgnorePatterns": [
134
+ "<rootDir>/example/node_modules",
135
+ "<rootDir>/lib/"
136
+ ]
137
+ },
138
+ "release-it": {
139
+ "git": {
140
+ "commitMessage": "chore: release ${version}",
141
+ "tagName": "v${version}"
142
+ },
143
+ "npm": {
144
+ "publish": true
145
+ },
146
+ "github": {
147
+ "release": true
148
+ },
149
+ "plugins": {
150
+ "@release-it/conventional-changelog": {
151
+ "preset": {
152
+ "name": "angular"
153
+ }
154
+ }
155
+ }
156
+ },
157
+ "create-react-native-library": {
158
+ "type": "turbo-module",
159
+ "languages": "kotlin-objc",
160
+ "tools": [
161
+ "lefthook",
162
+ "eslint",
163
+ "jest",
164
+ "release-it"
165
+ ],
166
+ "version": "0.57.0"
167
+ }
168
+ }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ componentDescriptors: [],
6
+ cmakeListsPath: undefined,
7
+ },
8
+ ios: {},
9
+ },
10
+ },
11
+ };
@@ -19,4 +19,12 @@ export interface Spec extends TurboModule {
19
19
  stop(): Promise<void>;
20
20
  }
21
21
 
22
- export default TurboModuleRegistry.getEnforcing<Spec>('GeofenceManager');
22
+ const NativeModule = TurboModuleRegistry.get<Spec>('GeofenceManager');
23
+
24
+ if (!NativeModule) {
25
+ console.warn(
26
+ 'react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.'
27
+ );
28
+ }
29
+
30
+ export default NativeModule as Spec;
package/src/index.tsx CHANGED
@@ -25,8 +25,16 @@ export type GeofenceEvent = {
25
25
 
26
26
  export type GeofenceBackgroundHandler = (event: GeofenceEvent) => Promise<void>;
27
27
 
28
+ const notLinkedError = () =>
29
+ Promise.reject(
30
+ new Error(
31
+ 'react-native-geofence-manager: Native module not linked. Rebuild your app.'
32
+ )
33
+ );
34
+
28
35
  export const GeofenceManager = {
29
36
  start: (regions: Region[], options?: GeofenceOptions): Promise<void> => {
37
+ if (!NativeGeofence) return notLinkedError();
30
38
  if (regions.length > MAX_REGIONS) {
31
39
  return Promise.reject(
32
40
  new Error(
@@ -37,7 +45,10 @@ export const GeofenceManager = {
37
45
  return NativeGeofence.start(regions, options ?? {});
38
46
  },
39
47
 
40
- stop: NativeGeofence.stop,
48
+ stop: (): Promise<void> => {
49
+ if (!NativeGeofence) return notLinkedError();
50
+ return NativeGeofence.stop();
51
+ },
41
52
 
42
53
  onEnter: (cb: (region: GeofenceEventRegion) => void) =>
43
54
  emitter.addListener('onEnter', cb as any),
@@ -1 +0,0 @@
1
- {"type":"module"}
@@ -1 +0,0 @@
1
- {"type":"module"}