2017-10-26 8 views

답변

0

내가 같은 질문을 가지고 있기 때문에 여기 온이 링크를 따라하지만 코드 나보고 나는

NPM react-native-touch-id

import React, { Component } from 'react'; 
import { 
    Platform, 
    StyleSheet, 
    Text, 
    View, 
    TouchableHighlight 
} from 'react-native'; 

var LocalAuth = require('react-native-touch-id') 

var YourComponent = React.createClass({ 
    _pressHandler() { 
    LocalAuth.authenticate({ 
     reason: 'this is a secure area, please authenticate yourself', 
     falbackToPasscode: true, // fallback to passcode on cancel 
     suppressEnterPassword: true // disallow Enter Password fallback 
     }) 
     .then(success => { 
     AlertIOS.alert('Authenticated Successfully') 
     }) 
     .catch(error => { 
     AlertIOS.alert('Authentication Failed', error.message) 
     }) 
    }, 

    render() { 
    return (
     <View> 
     ... 
     <TouchableHighlight onPress={this._pressHandler}> 
      <Text> 
      Authenticate with Touch ID/Passcode 
      </Text> 
     </TouchableHighlight> 
     </View> 
    ) 
    } 
}) 

을 사용하지만 아무것도 말하지 않는다 libs를 섞어서 길을 잃었다 고 가정하십시오.

라인에서 상대 : 당신은 내가 react-native-touch-id 위에 구축 react-native-local-auth 라이브러리의 한 부분이라고 생각 LocalAuth을 가져 오는

var LocalAuth = require('react-native-touch-id') 

react-native-touch-id-android 3-RD 라이브러리에 대한 튜토리얼을 따라 가면서.

의 repo에서의 예에 따르면, 가져 오기는 다음과 같아야합니다

import Finger from 'react-native-touch-id-android' 

아웃 노력을 befor 과정에서 어딘가에 react-native-local-auth을 설치했기 때문에 당신에 충돌 아니에요 이유에 대한 내 생각이다 react-native-touch-id-android.

package.json으로 이동하고 위에서 언급 한 라이브러리를 제거한 다음 npm install을 실행 한 다음 게시 한 레포의 단계별 가이드를 따르세요.

나중에 다시 돌아와 제대로 작동하는지 여부를 알려 주시면 기쁘게 생각합니다. 행운을 빕니다.