react-native-pincode: null is not an object (evaluating 'RNKeychainManager.SECURITY_LEVEL_ANY')

null is not an object (evaluating 'RNKeychainManager.SECURITY_LEVEL_ANY')

dependencies: @haskkor/react-native-pincode#1.13.0 react-native-keychain#3.1.1

Image

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 26 (10 by maintainers)

Most upvoted comments

On a fresh install I have this same issue. For my use case I do not want to use any of the other features. I just need a clean way of accepting a pin from a user.

The flow I am trying to accomplish is like this,

The first time a user uses the application -

  • User enters a pin.
  • User verifies the pin a second time.
  • I never store the pin on the phone and instead I encrypt some data in the mobile app with the pin.

The next time the user uses the mobile app I request their pin to decrypt their saved data -

  • Once the user’s data is decrypted, they have access to use the mobile application as a logged in user.

On a fresh install, I see the error mentioned above,

Cannot read property ‘SECURITY_LEVEL_ANY’ of undefined

Example of usage,

npm install --save @haskkor/react-native-pincode

import PINCode from '@haskkor/react-native-pincode';

class Auth extends Component {
  render() {
    return (
      <Container style={styles.container}>
        <PINCode
          status="choose"
          finishProcess={async () => {
            this.props.navigation.navigate('someNewPage');
          }}
          maxAttempts={5}
          pinCodeVisible={true}
          storePin={pin => this._HandleStoredPin(pin)}
        />
      </Container>
    );
  }
}

Have you guys tried running the following commands?

yarn add react-native-keychain
cd ios
pod install

I at last experienced this issue when upgrading keychain to 5.0.1. However following this: https://github.com/oblador/react-native-keychain/issues/221 And then the instructions on keychain:

Run yarn add react-native-keychain

1 a. Only for React Native <= 0.59: $ react-native link react-native-keychain and check MainApplication.java to verify the package was added. See manual installation below if you have issues with react-native link.

it fixed itself. I don’t know what else can cause this.

@Haskkor this is because this package is requiring react-native-keychain@^3.0.0-rc.3, I created PR #72 locking the version to the last stable version.