Skip to content

Enhance react-native-barometer for v2.1 - #9

Closed
dpyeates wants to merge 2 commits into
masterfrom
cursor/enhance-barometer-plugin-3082
Closed

dpyeates wants to merge 2 commits into
masterfrom
cursor/enhance-barometer-plugin-3082

Conversation

@dpyeates

@dpyeates dpyeates commented Sep 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implements the review recommendations as v2.1.0: safer Turbo Module loading, richer API, TypeScript packaging, restored example app, CI, and docs.

P0 / correctness

  • Soft-fail when the native module is missing (isSupported() → false, watch() → -1) instead of crashing AppRegistry
  • Surface sensor failures via onBarometerError / optional watch error callback
  • Replace broken empty example submodule with an in-repo RN 0.86 New Architecture example

API / DX

  • useBarometer() hook with automatic cleanup
  • setSmoothing(alpha), setAltitudeReference(metres), resetRelativeAltitude()
  • Export getAltitude / pressureFromAltitude
  • Payload accuracy field (Android; -1 on iOS)
  • Monotonic watch IDs
  • TypeScript source → lib/ with package exports

Tooling / docs

  • Peer dependency widened to react-native >= 0.84
  • GitHub Actions CI (typecheck, unit tests, example install)
  • README, CHANGELOG.md, MIGRATION.md (including Expo Dev Client notes)
  • CI test script uses explicit file paths so Node 20 and 22 both pass

Test plan

  • npm test (validation + watchManager)
  • npm run typecheck
  • Example npm ci succeeds
  • CI green on Node 20 + 22 (after glob fix)
  • Manual: run example on a device/simulator with a barometer and verify hook + calibration controls
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 3, 2026 08:41
Soft-fail missing Turbo Modules, surface sensor errors, add useBarometer
hook, smoothing/altitude calibration helpers, TypeScript lib exports,
in-repo RN 0.86 example, CI, and refreshed docs/migration guide.

Co-authored-by: Darren Yeates <darren@sensorworks.co.uk>
Node 20 does not expand ** globs for node --test, which broke CI.

Co-authored-by: Darren Yeates <darren@sensorworks.co.uk>
@dpyeates dpyeates closed this Sep 3, 2026
@dpyeates
dpyeates deleted the cursor/enhance-barometer-plugin-3082 branch September 3, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants