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

solomo

v2.1.0

Published

SoLoMo - Grab location instantly!

Readme

SoLoMo 📍

Social Local Mobile - The easiest way to get user location in Expo/React Native apps.

Expo's built-in Location.getCurrentPositionAsync can be slow, unpredictable, and requires repetitive permission handling. SoLoMo provides a simple React context that handles permissions, caching, and real-time updates automatically, giving you the most up-to-date location whenever you need it - with type safety!

npm version license

📦 Installation

npm install solomo expo-location

🚀 Quick Start

1. Wrap your app with LocationProvider

import { LocationProvider } from 'solomo';

export default function App() {
  return (
    <LocationProvider>
      <YourApp />
    </LocationProvider>
  );
}

2. Use location in any component

import { useLocation } from 'solomo';

function MyComponent() {
  const { location, hasPermission, requestPermission } = useLocation();

  if (!hasPermission) {
    return <Button onPress={requestPermission} title="Enable Location" />;
  }

  return (
    <Text>
      You are at: {location?.coords.latitude}, {location?.coords.longitude}
    </Text>
  );
}

🎯 Usage Examples

Get current location once

import { useCurrentLocation } from 'solomo';

function GetLocationButton() {
  const { fetchLocation } = useCurrentLocation();

  const handlePress = async () => {
    const result = await fetchLocation();
    if (result.granted && result.location) {
      console.log('Current location:', result.location.coords);
    }
  };

  return <Button onPress={handlePress} title="Get My Location" />;
}

Watch location changes

import { useLocationWatcher } from 'solomo';

function LocationTracker() {
  const { location, isWatching } = useLocationWatcher(true); // Auto-start watching

  return (
    <View>
      <Text>Watching: {isWatching ? 'Yes' : 'No'}</Text>
      {location && (
        <Text>
          Lat: {location.coords.latitude.toFixed(6)}
          Lng: {location.coords.longitude.toFixed(6)}
        </Text>
      )}
    </View>
  );
}

Custom configuration

import { LocationProvider } from 'solomo';
import * as Location from 'expo-location';

function App() {
  return (
    <LocationProvider
      config={{
        autoWatch: false,                    // Don't continuously track location
        fetchInitial: true,                  // Get location once on mount
        accuracy: Location.Accuracy.Highest, // Use highest accuracy
        maxCacheAge: 2 * 60 * 60 * 1000,     // Cache for 2 hours
      }}
    >
      <YourApp />
    </LocationProvider>
  );
}

🎯 Features

  • Zero configuration - Works out of the box
  • Smart caching - Avoid unnecessary GPS calls
  • Flexible tracking modes - On-demand or real-time location updates
  • Battery efficient - Configure tracking behavior to minimize battery drain
  • Type Safety - Full TypeScript support
  • Background/Foreground handling - Automatically manages app state changes

🛠 API Reference

LocationProvider Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | config.autoWatch | boolean | false | Automatically start watching location on mount. When false, location is only fetched on-demand. | | config.fetchInitial | boolean | true | Fetch location once on mount (if permission granted). Useful for caching an initial position. | | config.accuracy | Location.Accuracy | Balanced | GPS accuracy level. | | config.maxCacheAge | number | 300000 | Cache duration in milliseconds (default: 5 minutes). |

useLocation Hook

const {
  location,          // Current location object
  error,             // Location error if any
  hasPermission,     // Permission status
  isWatching,        // Whether actively watching location
  requestPermission, // Function to request permission
  getCurrentLocation,// Function to get location once
  startWatching,     // Function to start watching
  stopWatching,      // Function to stop watching
} = useLocation();

useCurrentLocation Hook

const {
  fetchLocation, // Function to fetch current location
  error          // Any error from last fetch
} = useCurrentLocation(options?);

useLocationWatcher Hook

const {
  location,      // Current location
  isWatching,    // Whether currently watching
  error,         // Any location error
  startWatching, // Manually start watching
  stopWatching   // Manually stop watching
} = useLocationWatcher(
    autoStart?,  // Whether to automatically start watching when component mounts
    options?     // Override provider config for this watcher
);

🔒 Permissions

SoLoMo handles location permissions automatically. The library will:

  1. Check for existing permissions on mount
  2. Request permissions when needed (e.g., when calling getCurrentLocation())
  3. Provide permission status through the hasPermission property

You can also manually request permissions using requestPermission().

Background Behavior

When your app goes to the background:

  • If watching was automatically started (via autoWatch: true), it will resume when app returns to foreground
  • If watching was manually started (via startWatching()), it will also resume when app returns to foreground
  • If watching was manually stopped (via stopWatching()), it will NOT resume

📝 License

MIT © Gabriele Scotto di Vettimo

🤝 Contributing

Issues and pull requests are welcome! Check out the GitHub repository.