Skip to content

Latest commit

 

History

History
121 lines (86 loc) · 5.28 KB

Changelog.md

File metadata and controls

121 lines (86 loc) · 5.28 KB
id title
Changelog
Changelog

Version 5

5.2.0

We added Typescript typings.

5.1.0

We added experimental support for the Barometer, it can be used like this:

import { barometer } from "react-native-sensors";

const subscription = barometer.subscribe(({ pressure }) => console.log({ pressure }));

Please help us improve the quality by using this sensor and giving feedback!

5.0.0

In this release we defined a whole new API that does not rely on promises anymore. To migrate please also update RxJS to a version greater than 6.

RxJS

- import { Accelerometer, Gyroscope } from "react-native-sensors";
+ import {
+   accelerometer, // direct access to the observables
+   gyroscope,
+   setUpdateIntervalForType, // set update interval globally
+   SensorTypes
+ } from "react-native-sensors";

+ // update to RxJS >= 6
+ import { map, filter } from "rxjs/operators";
- let accelerationObservable = null;
- new Accelerometer({
-  updateInterval: 400 // defaults to 100ms
- })
-  .then(observable => {
-    accelerationObservable = observable;

    // Normal RxJS functions
-    accelerationObservable
-      .map(({ x, y, z }) => x + y + z)
-      .filter(speed => speed > 20)
+   const subscription = accelerometer.pipe(
+         map(({ x, y, z }) => x + y + z)
+         filter(speed => speed > 20)
+       )
-      .subscribe(speed => console.log(`You moved your phone with ${speed}`));
+      .subscribe(speed => console.log(`You moved your phone with ${speed}`), error => {
+        console.log("The sensor is not available");
+      });
-  })
-  .catch(error => {
-    console.log("The sensor is not available");
-  });

setTimeout(() => {
-   accelerationObservable.stop();
+   subscription.unsubscribe();
}, 1000);

Decorator

We dropped support for the decorator syntax as it added a lot of testing surface. Please use libraries like recompose with componentFromStream to fill the gap. If you need help with this feel free to open an issue and we will provide more context and guidance.

Version 4

Version 3

3.1.0

  • Add Semantic Release

3.0.0

  • Magnetometer support
  • Add linking failure message: If you forget to link the native dependencies you now get "Native modules for sensors not available. Did react-native link run successfully?" as an error
  • Fix sensor availability checks
  • Fix startup API
  • BREAKING: removed windows support We had to remove the windows support as there was no one maintaining it. If you have interest in using this library on a windows phone, please leave an issue. We would be very happy to revert this commit and get windows up to speed again.
  • BREAKING: Check if sensor is supported You can now check if a sensor is available on the device. This changed the API, therefore it's a breaking change. Special thanks to @dabit1 for introducing this much needed functionality.

3.0.0-2

3.0.0-1

3.0.0-0

  • BREAKING: removed windows support We had to remove the windows support as there was no one maintaining it. If you have interest in using this library on a windows phone, please leave an issue. We would be very happy to revert this commit and get windows up to speed again.
  • BREAKING: Check if sensor is supported You can now check if a sensor is available on the device. This changed the API, therefore it's a breaking change. Special thanks to @dabit1 for introducing this much needed functionality.

Version 2

2.4.1

2.4.0