Bridging for accesing the Touch Sensor on both iOS and Android using TouchID and Android Fingerprint
npm install react-native-touch-sensorBridging for accesing the Touch Sensor on both iOS and Android using TouchID and Android Fingerprint
npm install -s react-native-touch-sensorreact-native link react-native-touch-sensor
Be sure to add the Fingerprint permission to your AndroidManaifest.xml file
Currently react-native-touch-sensor requires Android sdk 23 to work. Update this in your app.gradle file
import React, { Component } from 'react'
import { View, Text, Button } from 'react-native'import Touch from 'react-native-touch-sensor'
export default class TouchExample extends Component {
_isSupported() {
Touch.isSupported()
.then( () => alert('Android fingerprint supported'))
.catch( (error) => alert(
unsupported: ${error}))
}
_authenticatePressed() {
Touch.authenticate("To test out the app")
.then( () => alert('authenticated') )
.catch( (error) => alert(Failed: ${error}) )
} render() {
return (
Check to see if all conditions are met to use Fingerprint
title="IsSupported()"
onPress={() => this._isSupported()}
/>
Begins Authentication process
title="Authenticate()"
onPress={() => this._authenticatePressed()}
/>
);
}
}
``