{"id":4759,"url":"https://github.com/fixt/react-native-digits","last_synced_at":"2025-04-12T09:14:49.817Z","repository":{"id":57336548,"uuid":"45555537","full_name":"fixt/react-native-digits","owner":"fixt","description":null,"archived":false,"fork":false,"pushed_at":"2017-01-31T19:25:34.000Z","size":31,"stargazers_count":61,"open_issues_count":6,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T09:14:17.770Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fixt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-04T17:29:59.000Z","updated_at":"2023-12-26T17:26:09.000Z","dependencies_parsed_at":"2022-09-03T08:01:32.516Z","dependency_job_id":null,"html_url":"https://github.com/fixt/react-native-digits","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixt%2Freact-native-digits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixt%2Freact-native-digits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixt%2Freact-native-digits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixt%2Freact-native-digits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fixt","download_url":"https://codeload.github.com/fixt/react-native-digits/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543839,"owners_count":21121838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:22.433Z","updated_at":"2025-04-12T09:14:49.793Z","avatar_url":"https://github.com/fixt.png","language":"Java","readme":"# React Native Digits\n\n[![npm version](http://img.shields.io/npm/v/react-native-digits.svg?style=flat-square)](https://npmjs.org/package/react-native-digits \"View this project on npm\")\n[![npm version](http://img.shields.io/npm/dm/react-native-digits.svg?style=flat-square)](https://npmjs.org/package/react-native-digits \"View this project on npm\")\n\n## Getting Started\n- [Installation](#installation)\n- [Setup iOS](#setup-ios)\n- [Setup Android](#setup-android)\n- [Usage](#usage)\n- [Properties](#properties)\n\n## Installation\n\n`npm install react-native-digits --save`\n\n## Setup iOS\nSee React Native documentation on [Linking Libraries](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#content)\n\n1. Open your project in XCode\n2. Right click on `Libraries` and click `Add Files to \"YOUR_PROJECT _NAME\"`\n3. Add `libRNDigits.a` to `Build Phases -\u003e Link Binary With Libraries`\n\n## Setup Android\n\n#### In `settings.gradle`\n\nAdd to bottom:\n\n```java\ninclude ':react-native-digits'\nproject(':react-native-digits').projectDir = new File(settingsDir, '../node_modules/react-native-digits')\n```\n\n#### In `android/build.gradle`\n\n```java\nallprojects {\n  repositories {\n    mavenLocal()\n    jcenter()\n    maven { url 'https://maven.fabric.io/public' }   \u003c--- ADD THIS\n  }\n}\n```\n\n#### In `android/app/build.gradle`\n\n```java\ndependencies {\n  compile fileTree(dir: 'libs', include: ['*.jar'])\n  compile 'com.android.support:appcompat-v7:23.0.0'\n  compile 'com.facebook.react:react-native:0.14.+'\n  compile project(':react-native-digits')           \u003c--- ADD THIS\n}\n```\n\n#### In `MainActivity.java`\n\n```java\nimport co.fixt.react.digits.*;                      \u003c--- ADD THIS\n\npublic class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {\n  private ReactInstanceManager mReactInstanceManager;\n  private ReactRootView mReactRootView;\n  \n  @Override\n  protected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    mReactRootView = new ReactRootView(this);\n \n    mReactInstanceManager = ReactInstanceManager.builder()\n                 .setApplication(getApplication())\n                 .setBundleAssetName(\"index.android.bundle\")\n                 .setJSMainModuleName(\"index.android\")\n                 .addPackage(new MainReactPackage())\n                 .addPackage(new RNDigitsModule())     \u003c--- ADD THIS\n                 .setUseDeveloperSupport(BuildConfig.DEBUG)\n                 .setInitialLifecycleState(LifecycleState.RESUMED)\n                 .build();\n\n    mReactRootView.startReactApplication(mReactInstanceManager, \"DropBot\", null);\n\n    setContentView(mReactRootView);\n  }\n ```\n \n#### In `AndroidManifest.xml`\n\nAdd this inside the `application` tag.\n\n```xml\n\u003cmeta-data\n  android:name=\"io.fabric.ApiKey\"\n  android:value=\"YOUR_API_KEY\" /\u003e\n\u003cmeta-data\n  android:name=\"io.fabric.ApiSecret\"\n  android:value=\"YOUR_API_SECRET\" /\u003e\n```\n\n## Android Custom Theme\n\nIn `android/app/src/main/res/values/styles.xml`\n\n```xml\n\u003cresources\u003e\n\n  ...\n\n  \u003c-- Customize this --\u003e\n  \u003cstyle name=\"CustomDigitsTheme\" parent=\"android:Theme.Holo.Light\"\u003e\n    \u003citem name=\"android:textColorPrimary\"\u003e@android:color/black\u003c/item\u003e\n    \u003citem name=\"android:textColorSecondary\"\u003e@android:color/darker_gray\u003c/item\u003e\n    \u003citem name=\"android:windowBackground\"\u003e@android:color/white\u003c/item\u003e\n    \u003citem name=\"android:textColorLink\"\u003e#000000\u003c/item\u003e\n    \u003citem name=\"android:colorAccent\"\u003e#000000\u003c/item\u003e\n    \u003citem name=\"dgts__accentColor\"\u003e#000000\u003c/item\u003e\n  \u003c/style\u003e\n\n\u003c/resources\u003e\n```\n\n[Documentation here](https://docs.fabric.io/android/digits/theming.html#examples)\n\n## Usage\n\n```javascript\nimport React, { Component } from 'react-native'\n\nimport Button from ‘./button’\nimport Digits from 'react-native-digits'\n\nexport default class Login extends Component {\n  handleDigitsError(err) {\n    this.setState({showDigits: false})\n    console.warn(‘Login failed’, err)\n  }\n  \n  handleDigitsLogin(credentials) {\n    this.setState({showDigits: false})\n    console.log(‘Login successful’, credentials)\n  }\n  \n  render() {\n    return (\n      \u003cView\u003e\n        \u003cButton\n        \tonPress={ () =\u003e this.setState({showDigits: true}) }\n        \u003e\n          Login\n        \u003c/Button\u003e\n        \n        \u003cDigits\n          accentColor=“#16a085”\n          backgroundColor=“#ffffff”\n          onError={this.handleDigitsError.bind(this)}\n          onLogin={this.handleDigitsLogin.bind(this)}\n        /\u003e\n      \u003c/View\u003e\n    )\n  }\n}\n```\n\n## Properties\n\n| Prop             | Default                      | Type       | Description                                                             |\n| :--------------: | :--------------------------: | :--------: | :---------------------------------------------------------------------: |\n| accentColor      |                              | `string`   | The main color of elements associated with user actions (e.g. buttons). |\n| backgroundColor  |                              | `string`   | The background color for all views in the Digits flow.                  |\n| onError          | `(err) =\u003e console.warn(err)` | `function` | Callback on error.                                                      |\n| onLogin          |                              | `function` | Callback on success. `credentials` are passed back.                     |\n| visible          | `false`                      | `bool`     | Show the Digits viewController                                          |\n","funding_links":[],"categories":["Components"],"sub_categories":["Integrations"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixt%2Freact-native-digits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffixt%2Freact-native-digits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixt%2Freact-native-digits/lists"}