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

react-native-urbi-ui

v0.4.2

Published

Urbi's UI library

Downloads

188

Readme

react-native-urbi-ui

A set of React Native components that compose Urbi's Design System.

Warning

This is an alpha version of the release, use it at your own risk!

Installation

Install the library by running:

yarn add react-native-urbi-ui
# or npm install react-native-urbi-ui

Peer dependencies

Then, install all of its peer dependencies:

yarn add @react-native-community/slider date-fns formik react-native-dialogs react-native-formik react-native-gesture-handler react-native-linear-gradient react-native-modal-datetime-picker react-native-reanimated react-native-typography react-native-vector-icons react-native-svg
# or npm install the same things

Icon font

You need to add the icon font definition file to a folder named assets/json in your project's root folder. The file needs to be called urbi-font.json. This is used by the Icon component defined in the const.ts file, which is imported by many other components. You also need a file named urbi.ttf inside the native part of your project (see instructions below for Android and iOS). If you want to use our icon font, you can copy it from the Showcase App:

# from your project's root
mkdir -p assets/json
cp node_modules/react-native-urbi-ui/urbi-font.json assets/json
# then for Android
cp node_modules/react-native-urbi-ui/urbi.ttf android/app/src/main/assets/fonts

To add the font on iOS, copy our icon font file and add it as one of your project's resources. It's the same font that's used on Android, so you can find it inside:

node_modules/react-native-urbi-ui/urbi.ttf

Once copied to your project (e.g., inside the ios folder as a top-level file, like our showcase app does), update your XCode settings to include urbi.ttf in the Copy resources build phase.

Typescript

If you're using Typescript, you might want to add this to your tsconfig.json file:

{
    "compilerOptions": {
        /* the rest of your conf here */
        "paths": {
            /* your other mapped paths, if any */
            "react-native-urbi-ui/*": [
                "node_modules/react-native-urbi-ui/*",
                "node_modules/react-native-urbi-ui/*.android.d.ts",
                "node_modules/react-native-urbi-ui/*.ios.d.ts"
            ]
        }
    }
}

that way, tsc will look for platform-specific definition files, which it wouldn't otherwise.

Android fonts

The library relies on your app embedding Android's Roboto-Regular.ttf and Roboto-Medium.ttf (so that it looks the same regardless of what the device has set as system font).

If you don't have these 2 files in your project already, create an android/app/src/main/assets/fonts folder and save those files there. You can get the files from Google Fonts, or you can download them from our showcase app's own fonts folder.

Usage

Import components/molecules from their folders, e.g.:

import { ButtonCompact } from 'react-native-urbi-ui/molecules/buttons/ButtonCompact';

Every component is exported as either a React.PureComponent or as a memoized stateless component (using React.memo()). In some cases, unmemoized versions are available, and they're exported using the Unmemoized suffix, but you can generally use the component without the Unmemoized suffix.

Check out our showcase app for examples on how to use our molecules and components.

Development

Build

Run yarn install to install all dependencies, and yarn build to generate the dist folder which contains the module. If you want to generate a package with the same structure as the one published on https://www.npmjs.com, run yarn package, and find the react-native-urbi-ui-<version>.tgz package inside the dist folder.

Using the showcase app to preview changes to the library

Because the metro bundler doesn't support regular npm links (see this issue), we need to rely on wml (which in turn relies on watchman to actually copy all files from the library dist folder to showcase/node_modules/react-native-urbi-ui whenever they change.

The setup works as follows:

# from the repo top-level folder
watchman watch dist
cd showcase
yarn install
cd ..
yarn build
rm -rf showcase/node_modules/react-native-urbi-ui
wml add dist/ showcase/node_modules/react-native-urbi-ui
wml start

Then, launch the showcase app and (optionally) enable hot reload. Then, whenever you want to see your edits on the app, run yarn build from the top-level folder.

Running on VS Code

To run/debug in VS Code, create a configuration as usual, but also add a settings.json file inside the .vscode folder (which also contains your launch.json conf file).

Inside of it, add this:

{
  "react-native-tools": {
    "projectRoot": "/path/to/react-native-urbi-ui/showcase"
  }
}

Publish package

Done yarn package and next npm publish archive in dist folder