0.1.1 • Published 2 years ago

@bliplabs/blipui-react-native v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

The Blip UI component library for React Native

This library consists of a pre-built UI component for rendering a list of bills from the Blip API.

The library currently includes a BillList component which can optionally be styled for seamless integration into a React Native project.

Table of contents

Installation

First, install the npm package using yarn or npm:

npm i @bliplabs/blipui-react-native

# - OR -

yarn add @bliplabs/blipui-react-native

Usage

Import Blip's BillList component in your project:

import { Bill, BillList } from "@bliplabs/blipui-react-native";

The component requires data from the Blip API in order to render actual information. To do this, simply pass an object that contains an array of bills straight from Blip's API - we recommend using the Blip Quickstart to replicate the below data:

const bills: Bill[] = [
  {
    name: "Netflix",
    merchant_id: "c352a66b-c667-4e0a-8a3d-eac3a0f1871b",
    amount_mean: 10,
    transactions_count: 5,
    categories: ["subscriptions"],
    frequency: 30,
    expected_due_date: "2020-01-23",
    enduser_oid: "35f83baa-77d3-4cae-80c1-45d1984a185d",
    amount_median: 10,
    amount_std: 0,
    amount_total: 50,
    amount_min: 10,
    amount_max: 10,
    first_transaction_date: "2019-08-24",
    last_transaction_date: "2019-12-24",
    is_manual: false,
    merchant: {
      name: "Netflix",
      logo_url:
        "https://cdn.tryblip.com/logos/billers/blr_kIblcVj74PladXcpVvZGO.jpg",
      login_url:
        "http://api.bliplabs.com/v2/links/bill/c3480ecc-fdac-48da-bd82-0c32f9137344/merchant/login_url",
      billpay_url: null,
      phone: null,
      email: null,
    },
    id: "c3480ecc-fdac-48da-bd82-0c32f9137344",
    is_bill: true,
  },
];

Now, plug it in!

<BillList bills={bills} />

Configure styles

The component is built with a default design which can then be customized by passing in a configuration object with variables to override the defaults and style the BillList to fit the look and feel of your application.

const config: Partial<BillListConfig> = {
  billBackgroundColor: "white",
  billBorderRadius: 12,
  billPadding: 20,
  logoBorderRadius: 6,
  iconColorCalendar: "orange",
  iconColorFrequency: "orange",
  iconColorBillpay: "lightgreen",
  colorMerchantName: "black",
  colorAmount: "black",
  colorFrequency: "orange",
  colorDueDate: "gray",
  colorDueDate: "#7292F4",
};

Passing the configuration object into the component will style the list accordingly.

<BillList bills={bills} config={config} />

Complete example

This is a fairly simplified example. Depending on your setup, you may need to take some extra steps. For example, with Expo, you may need to correct for internationalization, and on iOS, you may need to ensure that react-native-svg is installed in your package's dependencies.

import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";

import billsList from "./bills.json";

import { BillList } from "@bliplabs/blipui-react-native";

export default function App() {
  const bills = billsList;
  const config = {
    billBackgroundColor: "white",
    billBorderRadius: 12,
    billPadding: 20,
    logoBorderRadius: 6,
    iconColorCalendar: "orange",
    iconColorFrequency: "orange",
    iconColorBillpay: "lightgreen",
    colorMerchantName: "black",
    colorAmount: "black",
    colorFrequency: "orange",
    colorDueDate: "gray",
    colorDueDate: "#7292F4",
  };
  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <BillList bills={bills} config={config} />
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});

Developer notes

Pushing to the NPM registry is as easy as the following steps:

# ensure you've logged in:
npm login

# update the package.json version if needed, and run this to update
# package-lock.json:
npm install

# setting NODE_ENV to production is very important below, otherwise
# local directories may appear in the compiled source code
NODE_ENV=production npm run build

# push the package - note below that this will include the contents
# of the src/ directory, so be careful not to upload anything that
# doesn't belong
yarn publish build/dist/ --access public

Note: Make sure not to use yarn publish on its own, because by default it will upload the current working directory, as opposed to dist directory.

Additional note: The src/ directory is included as part of the NPM package for transparency, as the compiled package is minified with Babel.

0.0.52

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago

1.0.33

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago