react-native-sensitive-info icon indicating copy to clipboard operation
react-native-sensitive-info copied to clipboard

_reactNativeSensitiveInfo.default.getItem is not a function (it is undefined)

Open alimoli opened this issue 1 year ago • 6 comments

Dependencies

"react": "18.2.0",
"react-native": "0.76.1",
"react-native-sensitive-info": "^5.5.8",

Error on iOS (18.1) (via Metro and simulator)

 _reactNativeSensitiveInfo.default.getItem is not a function (it is undefined)

All the methods related to items are not available on iOS. Working on Android.

alimoli avatar Nov 18 '24 14:11 alimoli

same here on android 🤷 image

AtesDANIS avatar Nov 20 '24 11:11 AtesDANIS

This module use old Android/iOS Native Modules. This is deprecated in favor of Turbo Native Module and Fabric Native Components https://reactnative.dev/docs/legacy/native-modules-android

This module should be refactored/refreshed... Anyway other up-to-date projects should propose the same features (example https://github.com/oblador/react-native-keychain)

jsreynaud avatar Nov 26 '24 13:11 jsreynaud

You can also modify yourself the file RNSensitiveInfo.js to fix for new architecture (backport of this commit: https://github.com/exPivot/react-native-sensitive-info/commit/d304a13109065f24c4ba816428b618b939e9cd9f)

I do that on my side and use https://github.com/ds300/patch-package to maintain in my app...

import { NativeModules } from 'react-native';

const RNSensitiveInfo = NativeModules.RNSensitiveInfo;

RNSensitiveInfo.setInvalidatedByBiometricEnrollment = (
  invalidatedByBiometricEnrollment,
) => {
  if (RNSensitiveInfo.setInvalidatedByBiometricEnrollment == null) {
    return undefined;
  }

  return RNSensitiveInfo.setInvalidatedByBiometricEnrollment(
    invalidatedByBiometricEnrollment,
  );
};
RNSensitiveInfo.cancelFingerprintAuth = () => {
  if (RNSensitiveInfo.cancelFingerprintAuth == null) {
    return undefined;
  }

  return RNSensitiveInfo.cancelFingerprintAuth();
};
export default RNSensitiveInfo;

jsreynaud avatar Dec 02 '24 10:12 jsreynaud

You can also modify yourself the file RNSensitiveInfo.js to fix for new architecture (backport of this commit: exPivot@d304a13)

I do that on my side and use https://github.com/ds300/patch-package to maintain in my app...

import { NativeModules } from 'react-native';

const RNSensitiveInfo = NativeModules.RNSensitiveInfo;

RNSensitiveInfo.setInvalidatedByBiometricEnrollment = ( invalidatedByBiometricEnrollment, ) => { if (RNSensitiveInfo.setInvalidatedByBiometricEnrollment == null) { return undefined; }

return RNSensitiveInfo.setInvalidatedByBiometricEnrollment( invalidatedByBiometricEnrollment, ); }; RNSensitiveInfo.cancelFingerprintAuth = () => { if (RNSensitiveInfo.cancelFingerprintAuth == null) { return undefined; }

return RNSensitiveInfo.cancelFingerprintAuth(); }; export default RNSensitiveInfo;

@jsreynaud

How did you fix it? Did you fork this repo, fixed it with your posted code and built the library yourself? Can you please explain how you did it with patch-package ?

FelixBaum avatar Feb 08 '25 14:02 FelixBaum

@jsreynaud

How did you fix it? Did you fork this repo, fixed it with your posted code and built the library yourself? Can you please explain how you did it with patch-package ?

I just modify the file in node_modules/react-native-sensitive-info/RNSensitiveInfo.js in my project, then using patch-package to make it permanent event on reinstall the module.

jsreynaud avatar Feb 24 '25 14:02 jsreynaud

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 02:04 stale[bot]

Hello guys, sorry taking to long to respond this.

There are 2 newer versions:

5.6.0 and 6.0.0-rc.2 both are working on newer react-native versions.

mCodex avatar Oct 24 '25 18:10 mCodex