react-native-geofence-manager 0.1.0-beta.2 → 0.1.0-beta.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.
- package/lib/commonjs/NativeGeofenceManager.js +7 -1
- package/lib/commonjs/NativeGeofenceManager.js.map +1 -1
- package/lib/commonjs/index.js +12 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeGeofenceManager.js +7 -1
- package/lib/module/NativeGeofenceManager.js.map +1 -1
- package/lib/module/index.js +12 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeGeofenceManager.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +168 -168
- package/react-native.config.js +11 -0
- package/src/NativeGeofenceManager.ts +11 -1
- package/src/index.tsx +18 -2
|
@@ -5,5 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
-
|
|
8
|
+
const NativeModule = _reactNative.TurboModuleRegistry.get('GeofenceManager');
|
|
9
|
+
if (NativeModule) {
|
|
10
|
+
console.log('✅ react-native-geofence-manager: Native module linked successfully');
|
|
11
|
+
} else {
|
|
12
|
+
console.warn('❌ react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.');
|
|
13
|
+
}
|
|
14
|
+
var _default = exports.default = NativeModule;
|
|
9
15
|
//# sourceMappingURL=NativeGeofenceManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NativeModule","TurboModuleRegistry","get","console","log","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,IAAIF,YAAY,EAAE;EAChBG,OAAO,CAACC,GAAG,CAAC,oEAAoE,CAAC;AACnF,CAAC,MAAM;EACLD,OAAO,CAACE,IAAI,CACV,uHACF,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcR,YAAY","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -9,14 +9,24 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const emitter = new _reactNative.NativeEventEmitter(_NativeGeofenceManager.default);
|
|
11
11
|
const MAX_REGIONS = 100;
|
|
12
|
+
const notLinkedError = () => Promise.reject(new Error('❌ react-native-geofence-manager: Native module not linked. Rebuild your app.'));
|
|
12
13
|
const GeofenceManager = exports.GeofenceManager = {
|
|
13
14
|
start: (regions, options) => {
|
|
15
|
+
if (!_NativeGeofenceManager.default) return notLinkedError();
|
|
14
16
|
if (regions.length > MAX_REGIONS) {
|
|
15
17
|
return Promise.reject(new Error(`Limite máximo de ${MAX_REGIONS} regiões excedido. Recebido: ${regions.length}`));
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
console.log(`🚀 react-native-geofence-manager: Starting with ${regions.length} region(s)`);
|
|
20
|
+
return _NativeGeofenceManager.default.start(regions, options ?? {}).then(() => {
|
|
21
|
+
console.log('✅ react-native-geofence-manager: Geofencing started successfully');
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
stop: () => {
|
|
25
|
+
if (!_NativeGeofenceManager.default) return notLinkedError();
|
|
26
|
+
return _NativeGeofenceManager.default.stop().then(() => {
|
|
27
|
+
console.log('🛑 react-native-geofence-manager: Geofencing stopped');
|
|
28
|
+
});
|
|
18
29
|
},
|
|
19
|
-
stop: _NativeGeofenceManager.default.stop,
|
|
20
30
|
onEnter: cb => emitter.addListener('onEnter', cb),
|
|
21
31
|
onExit: cb => emitter.addListener('onExit', cb),
|
|
22
32
|
onDwell: cb => emitter.addListener('onDwell', cb),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeGeofenceManager","_interopRequireDefault","require","_reactNative","e","__esModule","default","emitter","NativeEventEmitter","NativeGeofence","MAX_REGIONS","GeofenceManager","exports","start","regions","options","length","
|
|
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","console","log","then","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,8EACF,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;IACAC,OAAO,CAACC,GAAG,CAAC,mDAAmDJ,OAAO,CAACE,MAAM,YAAY,CAAC;IAC1F,OAAOX,8BAAc,CAACQ,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC,CAACI,IAAI,CAAC,MAAM;MAC7DF,OAAO,CAACC,GAAG,CAAC,kEAAkE,CAAC;IACjF,CAAC,CAAC;EACJ,CAAC;EAEDE,IAAI,EAAEA,CAAA,KAAqB;IACzB,IAAI,CAACf,8BAAc,EAAE,OAAOE,cAAc,CAAC,CAAC;IAC5C,OAAOF,8BAAc,CAACe,IAAI,CAAC,CAAC,CAACD,IAAI,CAAC,MAAM;MACtCF,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE,CAAC,CAAC;EACJ,CAAC;EAEDG,OAAO,EAAGC,EAAyC,IACjDnB,OAAO,CAACoB,WAAW,CAAC,SAAS,EAAED,EAAS,CAAC;EAE3CE,MAAM,EAAGF,EAAyC,IAChDnB,OAAO,CAACoB,WAAW,CAAC,QAAQ,EAAED,EAAS,CAAC;EAE1CG,OAAO,EAAGH,EAAyC,IACjDnB,OAAO,CAACoB,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":[]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
-
|
|
4
|
+
const NativeModule = TurboModuleRegistry.get('GeofenceManager');
|
|
5
|
+
if (NativeModule) {
|
|
6
|
+
console.log('✅ react-native-geofence-manager: Native module linked successfully');
|
|
7
|
+
} else {
|
|
8
|
+
console.warn('❌ react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.');
|
|
9
|
+
}
|
|
10
|
+
export default NativeModule;
|
|
5
11
|
//# sourceMappingURL=NativeGeofenceManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","NativeModule","get","console","log","warn"],"sourceRoot":"..\\..\\src","sources":["NativeGeofenceManager.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAqBpE,MAAMC,YAAY,GAAGD,mBAAmB,CAACE,GAAG,CAAO,iBAAiB,CAAC;AAErE,IAAID,YAAY,EAAE;EAChBE,OAAO,CAACC,GAAG,CAAC,oEAAoE,CAAC;AACnF,CAAC,MAAM;EACLD,OAAO,CAACE,IAAI,CACV,uHACF,CAAC;AACH;AAEA,eAAeJ,YAAY","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -4,14 +4,24 @@ 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
|
+
console.log(`🚀 react-native-geofence-manager: Starting with ${regions.length} region(s)`);
|
|
15
|
+
return NativeGeofence.start(regions, options ?? {}).then(() => {
|
|
16
|
+
console.log('✅ react-native-geofence-manager: Geofencing started successfully');
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
stop: () => {
|
|
20
|
+
if (!NativeGeofence) return notLinkedError();
|
|
21
|
+
return NativeGeofence.stop().then(() => {
|
|
22
|
+
console.log('🛑 react-native-geofence-manager: Geofencing stopped');
|
|
23
|
+
});
|
|
13
24
|
},
|
|
14
|
-
stop: NativeGeofence.stop,
|
|
15
25
|
onEnter: cb => emitter.addListener('onEnter', cb),
|
|
16
26
|
onExit: cb => emitter.addListener('onExit', cb),
|
|
17
27
|
onDwell: cb => emitter.addListener('onDwell', cb),
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeGeofence","AppRegistry","NativeEventEmitter","Platform","emitter","MAX_REGIONS","GeofenceManager","start","regions","options","length","
|
|
1
|
+
{"version":3,"names":["NativeGeofence","AppRegistry","NativeEventEmitter","Platform","emitter","MAX_REGIONS","notLinkedError","Promise","reject","Error","GeofenceManager","start","regions","options","length","console","log","then","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,8EACF,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;IACAC,OAAO,CAACC,GAAG,CAAC,mDAAmDJ,OAAO,CAACE,MAAM,YAAY,CAAC;IAC1F,OAAOd,cAAc,CAACW,KAAK,CAACC,OAAO,EAAEC,OAAO,IAAI,CAAC,CAAC,CAAC,CAACI,IAAI,CAAC,MAAM;MAC7DF,OAAO,CAACC,GAAG,CAAC,kEAAkE,CAAC;IACjF,CAAC,CAAC;EACJ,CAAC;EAEDE,IAAI,EAAEA,CAAA,KAAqB;IACzB,IAAI,CAAClB,cAAc,EAAE,OAAOM,cAAc,CAAC,CAAC;IAC5C,OAAON,cAAc,CAACkB,IAAI,CAAC,CAAC,CAACD,IAAI,CAAC,MAAM;MACtCF,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE,CAAC,CAAC;EACJ,CAAC;EAEDG,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,IAAItB,QAAQ,CAACuB,EAAE,KAAK,SAAS,EAAE;MAC7B;IACF;IACAzB,WAAW,CAAC0B,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
|
|
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;wBAY8B,IAAI;AAAnC,wBAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAuB,EACrB,KAAK,MAAM,EACX,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAOjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,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,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAuB,EACrB,KAAK,MAAM,EACX,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAOjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,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,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAShF,eAAO,MAAM,eAAe;qBACT,MAAM,EAAE,YAAY,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC;gBAe1D,OAAO,CAAC,IAAI,CAAC;kBAOT,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI;iBAGtC,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI;kBAGpC,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI;yCAGd,yBAAyB,KAAG,IAAI;CAMtE,CAAC;AAEF,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native-geofence-manager",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-geofence-manager",
|
|
3
|
+
"version": "0.1.0-beta.4",
|
|
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
|
+
}
|
|
@@ -19,4 +19,14 @@ export interface Spec extends TurboModule {
|
|
|
19
19
|
stop(): Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const NativeModule = TurboModuleRegistry.get<Spec>('GeofenceManager');
|
|
23
|
+
|
|
24
|
+
if (NativeModule) {
|
|
25
|
+
console.log('✅ react-native-geofence-manager: Native module linked successfully');
|
|
26
|
+
} else {
|
|
27
|
+
console.warn(
|
|
28
|
+
'❌ react-native-geofence-manager: Native module not found. Make sure you rebuilt the app after installing the package.'
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
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(
|
|
@@ -34,10 +42,18 @@ export const GeofenceManager = {
|
|
|
34
42
|
)
|
|
35
43
|
);
|
|
36
44
|
}
|
|
37
|
-
|
|
45
|
+
console.log(`🚀 react-native-geofence-manager: Starting with ${regions.length} region(s)`);
|
|
46
|
+
return NativeGeofence.start(regions, options ?? {}).then(() => {
|
|
47
|
+
console.log('✅ react-native-geofence-manager: Geofencing started successfully');
|
|
48
|
+
});
|
|
38
49
|
},
|
|
39
50
|
|
|
40
|
-
stop:
|
|
51
|
+
stop: (): Promise<void> => {
|
|
52
|
+
if (!NativeGeofence) return notLinkedError();
|
|
53
|
+
return NativeGeofence.stop().then(() => {
|
|
54
|
+
console.log('🛑 react-native-geofence-manager: Geofencing stopped');
|
|
55
|
+
});
|
|
56
|
+
},
|
|
41
57
|
|
|
42
58
|
onEnter: (cb: (region: GeofenceEventRegion) => void) =>
|
|
43
59
|
emitter.addListener('onEnter', cb as any),
|