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

react-native-dgis

v0.1.0

Published

2gis SDK integration for React Nativeor React Native

Readme

React Native 2GIS

A React Native library for integrating 2GIS Android/iOS SDK maps into your applications.

Installation

npm install react-native-dgis
# or
yarn add react-native-dgis

Setup

1. Obtain API Key

First, you need to obtain a dgissdk.key file from 2GIS Developer Portal.

2. Configure API Key

Android

Place the dgissdk.key file in your Android project's assets folder:

android/app/src/main/assets/dgissdk.key

iOS

Add the dgissdk.key file to your iOS project via Xcode

3. Configure build.gradle (Android)

In your app's android/app/build.gradle file, add the 2GIS Maven repository before the dependencies block:

repositories {
  google()
  mavenCentral()
  maven {
    url "https://artifactory.2gis.dev/sdk-maven-release"
  }
}

dependencies {
  // ... your dependencies
}

4. Initialize the SDK

Call DgisModule.init at the start of your app before using any map components:

import { DgisModule } from 'react-native-dgis';

// In your App component or entry point
useEffect(() => {
  const initSdk = async () => {
    try {
      await DgisModule.init();
      console.log('2GIS SDK initialized successfully');
    } catch (error) {
      console.error('Failed to initialize 2GIS SDK:', error);
    }
  };
  initSdk();
}, []);

For more details on setup and troubleshooting, refer to the official 2GIS SDK documentation.


Components

DgisMapView

The main map component that displays the 2GIS map.

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | style | StyleProp<ViewStyle> | No | Style object for the map container | | center | InitialRegion | No | Initial center position of the map | | onTap | (point: Point) => void | No | Callback fired when the map is tapped | | onLongTouch | (point: Point) => void | No | Callback fired when the map is long-pressed | | onMapLoaded | () => void | No | Callback fired when the map is fully loaded | | children | React.ReactNode | No | Child components (e.g., MarkerView) |

Types

interface InitialRegion {
  latitude: number;   // Latitude coordinate
  longitude: number;  // Longitude coordinate
  zoom?: number;      // Zoom level (optional)
}

interface Point {
  latitude: number;   // Latitude coordinate
  longitude: number;  // Longitude coordinate
}

Ref Commands

| Command | Parameters | Description | |---------|------------|-------------| | fitAllMarkers | options?: { duration?: number } | Adjusts the map viewport to fit all markers. duration is animation time in ms. | | setZoom | zoom: number, duration?: number | Sets the map zoom level. duration defaults to 500ms. | | zoomIn | - | Increases the zoom level by one step | | zoomOut | - | Decreases the zoom level by one step |


MarkerView

A marker component to display pins/icons on the map.

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | point | MarkerPoint | Yes | Geographic coordinates of the marker | | iconSource | ImageSourcePropType | No | Marker icon image | | anchor | MarkerAnchor | No | Anchor point of the icon (0-1 range for x and y) | | iconOpacity | number | No | Opacity of the marker icon (0-1) | | iconWidth | number | No | Width of the marker icon in pixels | | onPress | () => void | No | Callback fired when the marker is pressed |

Types

interface MarkerPoint {
  latitude: number;   // Latitude coordinate
  longitude: number;  // Longitude coordinate
}

interface MarkerAnchor {
  x: number;  // Horizontal anchor (0 = left, 0.5 = center, 1 = right)
  y: number;  // Vertical anchor (0 = top, 0.5 = center, 1 = bottom)
}

Ref Commands

| Command | Parameters | Description | |---------|------------|-------------| | animatedMoveTo | coords: MarkerPoint, duration?: number | Animates the marker to new coordinates. duration defaults to 500ms. |


Usage Examples

Basic Map

import React from 'react';
import { View, StyleSheet, Alert } from 'react-native';
import { DgisMapView, MarkerView, DgisModule } from 'react-native-dgis';

DgisModule.init();

const MARKER = { id: '1', title: 'Red Square', point: { latitude: 55.7539, longitude: 37.6208 } };

export function BasicMap() {
  return (
    <View style={styles.container}>
      <DgisMapView
        style={styles.map}
        center={{
          latitude: 55.7558,
          longitude: 37.6173,
          zoom: 12,
        }}
        onMapLoaded={() => console.log('Map loaded!')}
      >
          <MarkerView
            key={MARKER.id}
            point={MARKER.point}
            iconSource={require('./assets/marker.png')}
            anchor={{ x: 0.5, y: 1.0 }}
            iconOpacity={1}
            onPress={() => {
              Alert.alert(
                'Marker tap',
                `Marker: ${MARKER.title}`
              )
            }}
          />
      </DgisMapView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1 },
  map: { flex: 1 },
});

Contributing

License

MIT


Made with create-react-native-library