Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
react-native-digits
Advanced tools
npm install react-native-digits --save
See React Native documentation on Linking Libraries
Libraries
and click Add Files to "YOUR_PROJECT _NAME"
libRNDigits.a
to Build Phases -> Link Binary With Libraries
settings.gradle
Add to bottom:
include ':react-native-digits'
project(':react-native-digits').projectDir = new File(settingsDir, '../node_modules/react-native-digits')
android/build.gradle
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' } <--- ADD THIS
}
}
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
}
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);
}
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" />
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>
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>
)
}
}
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 |
FAQs
Digits wrapper to use in React Native
The npm package react-native-digits receives a total of 4 weekly downloads. As such, react-native-digits popularity was classified as not popular.
We found that react-native-digits demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.