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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mapwize-ui-react-native

v0.0.1-alpha.5

Published

Fully featured and ready to use UI to add Mapwize Indoor Maps and Navigation in your React Native app.

Downloads

239

Readme

Mapwize UI for React Native

This library provides developers with a fully featured and ready to use UI to add Mapwize Indoor Maps and Navigation in their React Native mobile application.

Integration

MapwizeUI has the following PeerDependencies, you have to include them in order to get MapwizeUI working

    "mapwize-sdk-react-native": "^1.1.2",
    "react-native-webview": "^11.2.4",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-localize": "^2.0.2",
    "react-native-canvas": "^0.1.37",

You can install everything by running the following command

yarn add mapwize-sdk-react-native mapwize-ui-react-native react-native-webview react-native-safe-area-context react-native-localize react-native-canvas

iOS

The minimum supported iOS version is 10.0. The minimum supported MapwizeSDK version is 3.4.5.

  • MapwizeSDK requires that you add use_frameworks! in your Podfile.

  • Run pod install in your ios directory

  • Add the MGLMapboxMetricsEnabledSettingShownInApp key in your info.plist and set it to YES

Android

The minimum supported Android sdk version is 21. The minimum supported mapwize-sdk-android version is 3.6.4.

in your Project build.gradle file, you have to add :

allprojects {
    repositories {
        ...
        maven { url 'https://www.jitpack.io' }
        maven { url 'https://maven.mapwize.io'}
    }
}

Description

The Mapwize UI for React Native comes with the following components:

  • Mapwize React Native SDK
  • Floor controller
  • Follow user button
  • Search module
  • Direction module
  • Place selection
  • Universes button
  • Languages button

The UI API

The map UI implements a UIOptions interface, this interface provides the same props as the SDK MapwizeMap, adds the DevCallbackInterceptor and implements the following properties:

interface UIOptions extends MapwizeViewProps, DevCallbackInterceptor {
  /**
   * The mainColor allows you to change the default Mapwize color in the entire UI
   * Default is '#C51586'
   */
  mainColor?: string
  /**
   * The preferredLanguage is used to display the UserInterface.
   * It is also use as default language when entering in a Venue if this language is available
   * Default is the mobile current language
   */
  preferredLanguage?: string
  /**
   * The unit used to display distance
   * Default is the phone current metric system
   */
  unit?: string
  /**
   * Display the hour in a 24 format or not
   * Default is the mobile current hour format
   */
  uses24?: boolean
  /**
   *
   * Whether to show the Menu Button or not
   */
  menuButtonHidden?: boolean
  /**
   *
   * Whether to show the Follow User Button or not
   */
  followUserButtonHidden?: boolean
  /**
   *
   * Whether to show the Floor Controller or not
   */
  floorControllerHidden?: boolean
}

If you need more customization, you can use the properties provided by the DevCallbackInterceptor.

interface DevCallbackInterceptor {
  /**
   * Called after the map and the ui are ready
   */
  onUiReady?: (mapwizeViewRef: MapwizeViewRef) => void
  /**
   * Called before querying the API. You can return a Direction object that will be displayed on the map
   */
  onDirectionWillStart?: (
    venue: Venue,
    universe: Universe,
    from: DirectionPoint,
    to: DirectionPoint,
    mode: DirectionMode,
    isNavigation: boolean
  ) => Promise<Direction | undefined>
  /**
   * Called before setting navigation on the map. You can return a NavigationProp object that will be displayed on the map
   */
  onNavigationRequested?: (
    venue: Venue,
    universe: Universe,
    navigationProp: NavigationProp
  ) => NavigationProp | undefined
  /**
   * Called before selecting a place or a placelist. You can decide if you want to show the information button in the selected content view
   */
  shouldDisplayInformationButton?: (
    placeDetails: FormattedPlaceDetails
  ) => boolean
  /**
   * Called when the user clicks on the information button.
   */
  onInformationButtonClick?: (mapwizeObject: MapwizeObject) => void
  /**
   * Called when the user clicks on the menu button
   */
  onMenuButtonClick?: () => void
  /**
   * Called when the user clicks on the Location Control without having a Location
   */
  onFollowUserButtonClickWithoutLocation?: () => void
  /**
   * Called before displaying the details view. You can use this method to change the content of the details view on the fly.
   */
  onPlaceSelected?: (
    placeDetails: FormattedPlaceDetails,
    rowsContents: RowsContent[],
    buttonsContents: ButtonContent[]
  ) => void
}

Mapwize API Key

You'll need a Mapwize API key to load the Map and allow API requests.

To get your own Mapwize API key, sign up for a free account at mapwize.io. Then within the Mapwize Studio, navigate to "API Keys" on the side menu.

Using the UI

You can find a ready to use example in the example folder in this repository.

The MapwizeUI component requires at least a MapwizeConfiguration props. The MapwizeConfiguration contains your Mapwize Api key that will be used to display data on the map.

const mapConfig = new MapwizeConfiguration('YOUR_API_KEY');
render() {
    return <MapwizeUI
        style={{flex: 1}}
        mapwizeConfiguration={mapConfig}/>
}

All instantiated maps are independent. You can add multiple maps with different MapwizeConfiguration in your application.

Using the map methods

You can use the MapwizeViewRef returned by the onUiReady property to run any map related method.

const mapConfig = new MapwizeConfiguration('YOUR_API_KEY');
render() {
    return <MapwizeUI
        style={{flex: 1}}
        mapwizeConfiguration={mapConfig}
        onUiReady={(mapwizeMap: MapwizeViewRef) => mapwizeMap.setFloor(3)}
      />
}

Documentation

Please refer to the Mapwize SDK React Native documentation on docs.mapwize.io

Contributing

While this project is mainly maintained by the Mapwize team, all contributions are welcome. Do not hesitate to open an issue or create a pull request on this project.

Evolution and support

For any question or request, please contact us at [email protected].

License

MIT