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-digits

v0.3.0

Published

Digits wrapper to use in React Native

Downloads

21

Readme

React Native Digits

npm version npm version

Getting Started

Installation

npm install react-native-digits --save

Setup iOS

See React Native documentation on Linking Libraries

  1. Open your project in XCode
  2. Right click on Libraries and click Add Files to "YOUR_PROJECT _NAME"
  3. Add libRNDigits.a to Build Phases -> Link Binary With Libraries

Setup Android

In settings.gradle

Add to bottom:

include ':react-native-digits'
project(':react-native-digits').projectDir = new File(settingsDir, '../node_modules/react-native-digits')

In android/build.gradle

allprojects {
  repositories {
    mavenLocal()
    jcenter()
    maven { url 'https://maven.fabric.io/public' }   <--- ADD THIS
  }
}

In android/app/build.gradle

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:23.0.0'
  compile 'com.facebook.react:react-native:0.14.+'
  compile project(':react-native-digits')           <--- ADD THIS
}

In MainActivity.java

import co.fixt.react.digits.*;                      <--- ADD THIS

public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  private ReactInstanceManager mReactInstanceManager;
  private ReactRootView mReactRootView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);
 
    mReactInstanceManager = ReactInstanceManager.builder()
                 .setApplication(getApplication())
                 .setBundleAssetName("index.android.bundle")
                 .setJSMainModuleName("index.android")
                 .addPackage(new MainReactPackage())
                 .addPackage(new RNDigitsModule())     <--- ADD THIS
                 .setUseDeveloperSupport(BuildConfig.DEBUG)
                 .setInitialLifecycleState(LifecycleState.RESUMED)
                 .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "DropBot", null);

    setContentView(mReactRootView);
  }

In AndroidManifest.xml

Add this inside the application tag.

<meta-data
  android:name="io.fabric.ApiKey"
  android:value="YOUR_API_KEY" />
<meta-data
  android:name="io.fabric.ApiSecret"
  android:value="YOUR_API_SECRET" />

Android Custom Theme

In android/app/src/main/res/values/styles.xml

<resources>

  ...

  <-- Customize this -->
  <style name="CustomDigitsTheme" parent="android:Theme.Holo.Light">
    <item name="android:textColorPrimary">@android:color/black</item>
    <item name="android:textColorSecondary">@android:color/darker_gray</item>
    <item name="android:windowBackground">@android:color/white</item>
    <item name="android:textColorLink">#000000</item>
    <item name="android:colorAccent">#000000</item>
    <item name="dgts__accentColor">#000000</item>
  </style>

</resources>

Documentation here

Usage

import React, { Component } from 'react-native'

import Button from ‘./button’
import Digits from 'react-native-digits'

export default class Login extends Component {
  handleDigitsError(err) {
    this.setState({showDigits: false})
    console.warn(‘Login failed’, err)
  }
  
  handleDigitsLogin(credentials) {
    this.setState({showDigits: false})
    console.log(‘Login successful’, credentials)
  }
  
  render() {
    return (
      <View>
        <Button
        	onPress={ () => this.setState({showDigits: true}) }
        >
          Login
        </Button>
        
        <Digits
          accentColor=“#16a085”
          backgroundColor=“#ffffff”
          onError={this.handleDigitsError.bind(this)}
          onLogin={this.handleDigitsLogin.bind(this)}
        />
      </View>
    )
  }
}

Properties

| Prop | Default | Type | Description | | :--------------: | :--------------------------: | :--------: | :---------------------------------------------------------------------: | | accentColor | | string | The main color of elements associated with user actions (e.g. buttons). | | backgroundColor | | string | The background color for all views in the Digits flow. | | onError | (err) => console.warn(err) | function | Callback on error. | | onLogin | | function | Callback on success. credentials are passed back. | | visible | false | bool | Show the Digits viewController |