FingerprintAuth undefined in NativeModules - react-native

I am using react-native-touch-id. iOS works fine but got issues with the android.
TouchID.authenticate()
.then()
.catch(error => {
});
The above snippet gives
TypeError: Cannot read property 'authenticate' of undefined
When I dig into the node_modules, in file TouchId.android.js, there is FingerprintAuth undefined in NativeModules.
RN: 0.57.2
I have tried removing the node_modules and re-setup the library, but same problem occurs.
Thanks

Related

TypeError: Cannot read property 'createDrawerNavigator' of undefined

When I' using the react navigation version 6.1.1. I face this error.
TypeError: Cannot read property 'createDrawerNavigator' of undefined
I have import the createDrawerNavigator from #react-navigation/drawer. But When I start the app the I saw this error TypeError: Cannot read property 'createDrawerNavigator' of undefined. How can I solve this error?
Screenshot of the error
We have to import the gesture handler in the main index file. like this
import 'react-native-gesture-handler';
install "react-native-reanimated" and config your bable.config file
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
'react-native-reanimated/plugin'
],
};
and then
pod install
yarn start --reset-cache
Open your android folder in android studio, then run from there.

TypeError: Cannot read properties of undefined (reading 'call') on build but not dev

I am running a vite.js app with web3 installed.
When I run the app in dev mode, all works fine but when I run it in production mode (build) it fails with:
"TypeError: Cannot read properties of undefined (reading 'call')".
I can confirm that the error comes from the contract method generated from my ABI:
contract.methods.isOwner(sender).call({from: sender}, function (err, res)
If I comment this line out I wont get the error.
You can reproduce the error by using my test repo:
download my test repo:
https://github.com/nybroe/web3_vite_call_of_undefined/tree/main
follow the readme with repo steps:
setup:
download the repro
navigate to "app"
npm install
dev test (which works)
npm run dev
check the console - no errors
build test (which breaks)
npm run build
npm run preview
check the console - you will see the following errors: "TypeError: Cannot read properties of undefined (reading 'call')"
https://stackoverflow.com/a/69021714
I use the option 2
In your vite.config.js, add web3:
import { defineConfig } from 'vite'
export default defineConfig({
⋮
resolve: {
alias: {
web3: 'web3/dist/web3.min.js',
},
// or
alias: [
{
find: 'web3',
replacement: 'web3/dist/web3.min.js',
},
],
},
})

Expo SDK38 upgrade - fontFamily "FontAwesome" is not a system font and has not been loaded through Font.loadAsync

Since I have upgraded to Expo SDK 38, I am getting this error when I start my app. I need to upgrade to SDK38 because Android will not let me publish at any less version.
This was working fine on SDK37, the only thing that I have changed is that I have upgraded all packages using expo upgrade, also there was an error error: unknown option --assetExts so I had to remove this from the app.json, which may be the cause. I changed assetExts to sourceExts which made it compile but maybe this is stopping the fonts working..
"packagerOpts": {
"assetExts": ["otf", "ttf"]
},
I am following the example here of preloading the font in my App.js which is what all other answers that I can find are suggesting to do, but still getting the error.
I have also tried deleting my node_modules, package.json.lock and .expo folders, all which have not helped.
https://docs.expo.io/guides/preloading-and-caching-assets/#pre-loading-and-caching-assets
import { FontAwesome } from "#expo/vector-icons";
function cacheFonts(fonts) {
return fonts.map((font) => Font.loadAsync(font));
}
const fontAssets = cacheFonts([FontAwesome.font]);
await Promise.all([...fontAssets]);
Turns out this was a cache issue, the code was absolutely fine. I thought I had cleared everything but obviously not.
Deleted node_modules, package.json.lock again and npm installed and worked fine.

VueJS / Electron : How to get "child_process" working?

In my VueJS / Electron app, I need to call an exe file (working under windows environment).
In my project, I made this js file:
import exec from "child_process";
export default {
opt() {
exec("tool.exe", function(err, data) {
console.log(err);
console.log(data.toString());
});
}
};
However, when I launch the app with "npm run electron:serve" I got this error into the debug tool of Electron :
[Vue warn]: Error in created hook: "TypeError: child_process__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function"
I don't know where I'm wrong...
Any ideas ? Thanks ;)

Undefined is not an object (evaluating '_expo.Asset.loadAsync')

I'm creating a project with React-Native, and currently when I try to compile my code I get an error saying undefined is not an object (evaluating '_expo_.Asset.loadAsync')
I'm not entirely sure what had caused this, for I entered a lot of code prior to compiling the project. However, from what I gathered this may have something to do with the fonts I'm importing?
currently this is what my code looks like for importing the font.
async componentDidMount() {
await cacheFonts({
georgia: require('../assets/fonts/Georgia.ttf'),
regular: require('../assets/fonts/Montserrat-Regular.ttf'),
light: require('../assets/fonts/Montserrat-Light.ttf'),
});
this.setState({ fontLoaded: true });
}
This worked for me in similar code:
Install :
npm install expo-font
import * as Font from 'expo-font';
...
...
async componentDidMount() {
await Font.loadAsync({
'josefin-sans-regular': require('./assets/fonts/JosefinSans-Regular.ttf')
});
this.setState({ fontLoaded: true });
}
You didn't show the error-causing code. But you seem to have called in the entire module of Expo.
Maybe you used import * as Expo from "expo" and Expo.Asset.loadAsync
With SDK 33, we’re deprecating imports of most modules from the expo package. Each module must be installed and used.
You can run expo install expo-asset
import { Asset } from 'expo-asset';
...
Asset.loadAsync(modules)
If you want to use it as it is now, you can use this module. expo-codemod