dpyeates / react-native-barometer

Provides barometric and altitude information for React-native apps for both IOS and Android.
MIT License
6 stars 1 forks source link

Equal smoothing treatment #5

Open kleydon opened 1 year ago

kleydon commented 1 year ago

Currently, this library applies filtering/smoothing for values on Android devices, but does not (yet) apply filtering/smoothing for iOS devices. As a result, behavior seems inconsistent across platforms.

This PR normalizes smoothing/filtering, so that it is handled the same way across both platforms.

It provides two related methods:

setSmoothingFactor(smoothingFactor)  // where smoothingFactor is a number [0.0-1.0]
getSmoothingFactor()  // async

... and employs the pre-existing default filtering value/equation for Android, i.e: smoothed = 0.3new + (1.0 - 0.3)old

This PR includes the changes of PR #4, enabling this library to be used in typescript react-native projects.