Giter Club home page Giter Club logo

Comments (11)

klivin avatar klivin commented on August 16, 2024 8

For me it was importing using:

import TouchID from "react-native-touch-id";

did the trick. Needed to be using the es2015 syntax...smh

from react-native-touch-id.

GentryRiggen avatar GentryRiggen commented on August 16, 2024 4

Run the following.

react-native link
https://github.com/naoufal/react-native-touch-id#linking-the-library

from react-native-touch-id.

ShortyFR avatar ShortyFR commented on August 16, 2024 1

Using version 4.0.0, I still get the same error after linking and using the import syntax.

import React from "react"
import TouchID from 'react-native-touch-id'
import { View, TouchableHighlight, Text, Alert } from 'react-native'

type Props = {
  };

const optionalConfigObject = {
  title: "Authentication Required",
  color: "#e00606"
}

export default class TouchIdTest extends React.Component<Props> {

  componentDidMount() {
    TouchID.isSupported()
        .then(supported => {
            console.log('it is supported');
        })
        .catch(err => {
            console.log(err.message);
        })
  }

  _pressHandler() {
    TouchID.authenticate('to demo this react-native component', optionalConfigObject)
      .then(success => {
        Alert.alert('Info', 'Authenticated Successfully');
      })
      .catch(error => {
        Alert.alert('Error', 'Authentication Failed '+error);
      });
  }

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

I get the error "Cannot read property 'isSupported' of indefined.
And it I press the button, I get "Authentication Failed TypeError: Cannot read property 'authenticate' of undefined".

from react-native-touch-id.

luciodale avatar luciodale commented on August 16, 2024 1

@ShortyFR @brandons

OS: Linux
Device: Android Emulator

I could solve this problem by inspecting the TouchID object and realizing that to call the functions isSupported() or authenticate("foo") a further key must be accessed:

TouchID.default.isSupported().then(...) and TouchID.default.authenticate("foo").then(...)

from react-native-touch-id.

gigeos avatar gigeos commented on August 16, 2024

Open Xcode and check if Header Search Paths and make sure it contains $(SRCROOT)/../../../react-native/React as recursive in Build Phase. Solve the problem for me (RN 0.44)

from react-native-touch-id.

klivin avatar klivin commented on August 16, 2024

I tried running react-native link, linked fine, via @GentryRiggen
I also tried adding the header search paths like @gigeos suggested (this should not be necessary if only using in js code right?)...

Still getting this error:

TouchID.isSupported is not a function. (In 'TouchID.isSupported()', 'TouchID.isSupported' is undefined)

Any other ideas?

TouchID.isSupported is not a function. (In 'TouchID.isSupported()', 'TouchID.isSupported' is undefined)

nextStep
    signUp.js:39:8
onPress
    signUp.js:103:61
touchableHandlePress
    TouchableOpacity.js:126:45
_performSideEffectsForTransition
    Touchable.js:746:34
_receiveSignal
    Touchable.js:664:44
touchableHandleResponderRelease
    Touchable.js:433:24
invokeGuardedCallback
    ReactErrorUtils.js:22:15
invokeGuardedCallbackAndCatchFirstError
    ReactErrorUtils.js:133:62
executeDispatch
    EventPluginUtils.js:90:4
executeDispatchesInOrder
    EventPluginUtils.js:121:20
executeDispatchesAndRelease
    EventPluginHub.js:37:46
forEachAccumulated
    forEachAccumulated.js:30:16
processEventQueue
    EventPluginHub.js:233:8
runEventQueueInBatch
    ReactEventEmitterMixin.js:18:35
handleTopLevel
    ReactEventEmitterMixin.js:38:25
<unknown>
    ReactNativeEventEmitter.js:107:8
perform
    Transaction.js:150:24
batchedUpdatesWithControlledComponents
    ReactGenericBatching.js:51:26
_receiveRootNodeIDEvent
    ReactNativeEventEmitter.js:105:40
receiveTouches
    ReactNativeEventEmitter.js:193:8
__callFunction
    MessageQueue.js:250:47
<unknown>
    MessageQueue.js:101:26
__guard
    MessageQueue.js:218:6
callFunctionReturnFlushedQueue
    MessageQueue.js:100:17


from react-native-touch-id.

zibs avatar zibs commented on August 16, 2024

I'm closing this since it seems like @klivin 's issue is solved, and the original author of this issue has never responded.

from react-native-touch-id.

react-native-engineer avatar react-native-engineer commented on August 16, 2024

No body solved this problem?

from react-native-touch-id.

jtich avatar jtich commented on August 16, 2024

Anyone know of a fix for this issue??

from react-native-touch-id.

klabusta avatar klabusta commented on August 16, 2024

import TouchID from "react-native-touch-id";
works fine, although with typescript and tsconfig set to

"compilerOptions": { "allowSyntheticDefaultImports": false }

I'm getting this error:

Error:(16, 8) TS1192: Module ''react-native-touch-id'' has no default export.

from react-native-touch-id.

brandons avatar brandons commented on August 16, 2024

I'm still receiving this error on Android using version 4.0.4 and everything appears to be linked correctly.

    at TouchID.android.js:8
    at tryCallTwo (core.js:45)
    at doResolve (core.js:200)
    at new Promise (core.js:66)
    at Object.isSupported (TouchID.android.js:7)
    at SecuritySettingsScreen.syncPreferences (SecuritySettingsScreen.js:137)
    at new SecuritySettingsScreen (SecuritySettingsScreen.js:106)
    at constructClassInstance (ReactNativeRenderer-dev.js:6729)
    at updateClassComponent (ReactNativeRenderer-dev.js:8810)
    at beginWork (ReactNativeRenderer-dev.js:9646)
    at performUnitOfWork (ReactNativeRenderer-dev.js:12361)
    at workLoop (ReactNativeRenderer-dev.js:12384)
    at renderRoot (ReactNativeRenderer-dev.js:12427)
    at performWorkOnRoot (ReactNativeRenderer-dev.js:13034)
    at performWork (ReactNativeRenderer-dev.js:12951)
    at performSyncWork (ReactNativeRenderer-dev.js:12913)
    at requestWork (ReactNativeRenderer-dev.js:12799)
    at scheduleWorkImpl (ReactNativeRenderer-dev.js:12666)
    at scheduleWork (ReactNativeRenderer-dev.js:12622)
    at scheduleRootUpdate (ReactNativeRenderer-dev.js:13324)
    at _updateContainerAtExpirationTime (ReactNativeRenderer-dev.js:13359)
    at Object.updateContainer (ReactNativeRenderer-dev.js:13384)
    at Object.render (ReactNativeRenderer-dev.js:14119)
    at renderApplication (renderApplication.js:58)
    at Object.run (AppRegistry.js:103)
    at Object.runApplication (AppRegistry.js:196)
    at MessageQueue.__callFunction (MessageQueue.js:353)
    at MessageQueue.js:118
    at MessageQueue.__guardSafe (MessageQueue.js:316)
    at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:117)
    at debuggerWorker.js:72

from react-native-touch-id.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.