Skip to content

Commit

Permalink
fix: add compatibility with hermes engine
Browse files Browse the repository at this point in the history
* Replace nativeApis map with an object

* Remove toLocaleLowercase to make it compatible with hermes engine

* Update rnsensors.js

* Update sensors.js

Co-authored-by: Rubina <rubina.shakkyan@gmail.com>
  • Loading branch information
rubina-shakhkyan and Rubina committed Feb 4, 2022
1 parent 1aa96c9 commit c7a299b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rnsensors.js
Expand Up @@ -25,7 +25,7 @@ const nativeApis = new Map([
const availableSensors = {};

export function start(type) {
const api = nativeApis.get(type.toLocaleLowerCase());
const api = nativeApis.get(type);
api.startUpdates();
}

Expand All @@ -34,24 +34,24 @@ export function isAvailable(type) {
return availableSensors[type];
}

const api = nativeApis.get(type.toLocaleLowerCase());
const api = nativeApis.get(type);
const promise = api.isAvailable();
availableSensors[type] = promise;

return promise;
}

export function stop(type) {
const api = nativeApis.get(type.toLocaleLowerCase());
const api = nativeApis.get(type);
api.stopUpdates();
}

export function setUpdateInterval(type, updateInterval) {
const api = nativeApis.get(type.toLocaleLowerCase());
const api = nativeApis.get(type);
api.setUpdateInterval(updateInterval);
}

export function setLogLevelForType(type, level) {
const api = nativeApis.get(type.toLocaleLowerCase());
const api = nativeApis.get(type);
api.setLogLevel(level);
}

0 comments on commit c7a299b

Please sign in to comment.