_reactNativeSensitiveInfo.default.getItem is not a function (it is undefined)
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.
same here on android 🤷
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)
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;
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 ?
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.
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.
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.