npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sonarfit-react-native

v2.1.3

Published

React Native integration for SonarFit SDK - AI-powered workout rep counting

Readme

sonarfit-react-native

React Native integration for SonarFit SDK - AI-powered workout rep counting for iOS

Features

  • AI-powered rep counting for Squats, Bench Press, and Deadlifts
  • Real-time workout tracking
  • Support for Apple Watch and AirPods motion sensors
  • Native iOS integration with React Native bridge
  • TypeScript support

Installation

npm install sonarfit-react-native

iOS Setup

  1. Install CocoaPods dependencies:
cd ios && pod install
  1. The SonarFit SDK requires iOS 17.0 or higher. Make sure your Podfile has:
platform :ios, '17.0'
  1. Add required permissions to your Info.plist:
<key>NSMotionUsageDescription</key>
<string>This app uses motion sensors to track your workout reps and provide real-time feedback</string>
  1. Enable HealthKit capability:

    • Select your iOS app target in Xcode
    • Go to Signing & Capabilities
    • Click + Capability
    • Add HealthKit
    • Enable Background Delivery under HealthKit
  2. Add Background Modes to your Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>processing</string>
</array>

Usage

Initialize the SDK

import SonarFitSDK from 'sonarfit-react-native';

// Initialize with your API key when your app starts
useEffect(() => {
  const initSDK = async () => {
    try {
      await SonarFitSDK.initialize('your-api-key-here');
      console.log('SonarFit SDK initialized');
    } catch (error) {
      console.error('Failed to initialize SonarFit SDK:', error);
    }
  };

  initSDK();
}, []);

Start a Workout

import SonarFitSDK, { WorkoutConfig } from 'sonarfit-react-native';

const startWorkout = async () => {
  const config: WorkoutConfig = {
    workoutType: 'squat',      // 'squat' | 'deadlift' | 'benchpress'
    sets: 3,
    reps: 10,
    restTime: 60,              // seconds (default: 60)
    countdownDuration: 3,      // seconds (default: 3)
    autoReLift: true,          // default: true
    deviceType: 'airpods',     // 'watch' | 'airpods'
  };

  try {
    const result = await SonarFitSDK.presentWorkout(config);

    if (result.completed) {
      console.log(`Completed ${result.totalRepsCompleted}/${result.totalTargetReps} reps`);
      console.log(`Duration: ${result.totalDuration}s`);
      console.log(`Sets:`, result.sets);
    } else if (result.cancelled) {
      console.log('Workout cancelled');
    }
  } catch (error) {
    console.error('Workout error:', error);
  }
};

API Reference

SonarFitSDK.initialize(apiKey: string): Promise<void>

Initialize the SonarFit SDK with your API key.

Parameters:

  • apiKey: Your SonarFit API key

SonarFitSDK.presentWorkout(config: WorkoutConfig): Promise<WorkoutResult>

Present the SonarFit workout UI.

Parameters:

  • config: Workout configuration

Returns:

  • Promise<WorkoutResult>: Workout results when complete or cancelled

Types

interface WorkoutConfig {
  workoutType: 'squat' | 'deadlift' | 'benchpress';
  sets: number;
  reps: number;
  restTime?: number;           // default: 60
  countdownDuration?: number;  // default: 3
  autoReLift?: boolean;        // default: true
  deviceType: 'watch' | 'airpods';
}

interface WorkoutResult {
  completed: boolean;
  cancelled?: boolean;
  workoutType?: string;
  deviceType?: string;
  startTime?: number;
  endTime?: number;
  totalDuration?: number;
  completionPercentage?: number;
  targetSets?: number;
  targetRepsPerSet?: number;
  totalRepsCompleted?: number;
  totalTargetReps?: number;
  sets?: Array<{
    setNumber: number;
    repsCompleted: number;
  }>;
}

Debugging

SDK Logging

The underlying iOS SDK supports multiple log levels for debugging. To enable logging, add this to your native iOS code (in AppDelegate.swift or similar):

import SonarFitKit

// In application(_:didFinishLaunchingWithOptions:)
#if DEBUG
SonarFitSDK.logLevel = .debug  // See all logs during development
#else
SonarFitSDK.logLevel = .standard  // Only errors and warnings in production
#endif

Available log levels:

  • .none - No logging
  • .minimal - Only critical errors
  • .standard - Errors and warnings (default)
  • .verbose - Errors, warnings, and info messages
  • .debug - All logs including motion processing and connectivity details

Note: Logging is controlled at the native iOS SDK level and cannot be changed from React Native JavaScript code.

Requirements

  • React Native >= 0.60
  • iOS >= 17.0
  • Xcode >= 16.0
  • AirPods Pro/Max or Apple Watch (for motion tracking)

Example

See the example directory for a complete working example app.

License

MIT

Support

For issues and questions, please visit GitHub Issues