After installing react native-firebase core app and mlkit. mlkit does not work and fails when I try to use the function textRecognizerProcessImage.
I followed: https://invertase.io/oss/react-native-firebase/v6/ml-vision/quick-start and additionally for ios I did an pod install and saw how mlkit was downloaded.
However, the error from above occurs on android and ios.
Does anybody have a clue?
EDIT: I am also having access to the firebase-project using google-services.jsonand googleservice-info.plist
the relevant part from my package.json. Am using newest versions for all.
(As you can see I am also using /auth and /database both of which work just fine!
"dependencies": {
"#react-native-firebase/app": "^6.0.0",
"#react-native-firebase/auth": "^6.0.0",
"#react-native-firebase/database": "^6.0.0",
"#react-native-firebase/ml-vision": "^6.0.0",
"react": "16.9.0",
"react-native": "0.61.1"
},
the firebase.json:
{
"react-native": {
"ml_vision_face_model": true,
"ml_vision_ocr_model": true,
"ml_vision_barcode_model": true,
"ml_vision_label_model": true,
"ml_vision_image_label_model": true
}
}
simple solution...
The documentation talks about
import vision from '#react-native-firebase/ml-vision';
to import the vision library. However,
vision.anyFunctionHere will not work, since it is no instance.
the solution is to use vision().anyFunctionHere (not the brackets of doom which cost me hours and a hell lot of frustration-.-)
Related
Like the question says, I was following a tutorial and it was working fine so I wanted to implement it into my own side project app.
After adding it exactly the same as the doc says the component in the <Stack.Screen/> won't load.
I have tried multiple things but nothing seems to work. No errors either so I'm stuck on how to debug.
As I don't know which part of my code is causing the problem I will post my github repo link here.
https://github.com/totablue/ToyBoxOfWords
Answering my own question.
The thing that was causing my app to get stuck on the splashscreen was the SplashScreen.preventAutoHideAsync()
that was called while the app was loading the font.
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
this part of the code was not running so the splash screen never went away.
Used this video to load custom fonts in a different way and it fixed everything.
https://youtu.be/viIkcDYSBrI
I have tried to run your code, and it worked well. The problem is that you have not added some dependencies!
This is the package.json file that I use with your code.
{
"dependencies": {
"expo-font": "~10.2.0",
"expo-constants": "~13.2.4",
"expo-status-bar": "~1.4.0",
"#expo/vector-icons": "^13.0.0",
"expo-splash-screen": "~0.16.2",
"react-native-paper": "4.9.2",
"react-native-screens": "~3.15.0",
"#react-navigation/native": "*",
"#react-navigation/native-stack": "*",
"react-native-safe-area-context": "4.3.1"
}
}
I'm using Nextjs and I'm trying to use stripe for a subscription. The button bellow is fetching a api but i get the error bellow. I tried using /api/spripe.js instead of /test/stripe.js but is even worse (i don't even hit the api. I get 404)
Dependencies:
"dependencies": {
"next": "12.1.6",
"react": "18.1.0",
"react-dom": "18.1.0",
"stripe": "^8.220.0"
},
Thanks in advance!
I am building an android wallet using react-native and trying to create an account using web3.eth.accounts.create() . This works with react-native remote debugger enabled. However, when I work the same code with the debugger off, it stops working.
this is my package.json
"cryptico": "^1.0.2",
"native-base": "2.8.0",
"node-libs-browser": "2.1.0",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-firebase": "^5.2.0",
"react-native-gesture-handler": "^1.0.12",
"react-native-scripts": "1.14.0",
"react-navigation": "^3.0.9",
"socket.io-client": "2.0.4",
"web3": "1.0.0-beta.34"
I fixed it by using ethers.js to create new ethereum wallet.
// this is specifically for react-native
import 'ethers/dist/shims';
import {ethers} from 'ethers';
// to create a ethereum wallet
let randomWallet = ethers.Wallet.createRandom();
Web3.js is really troublesome for react-native
read more here:
https://docs.ethers.io/ethers.js/html/cookbook-react.html#
this is a guide specifically designed for react-native
I've had problems using web3 inside React Native myself, so I switched to ethers.js .
It was working better inside RN and its gives you pretty much everything you will need.
Hoping this is a simple issue but I couldn't find anything on a Google search. Running on emulator (with any build type) works perfectly. Connecting a device however with any build type (debug or release) the following issue occurs at runtime (the app can build successfully):
My package.json has the following deps:
"dependencies": {
"#redux-offline/redux-offline": "2.4.0",
"babel-plugin-transform-remove-console": "6.9.4",
"buffer": "5.2.0",
"crypto-js": "3.1.9-1",
"lodash": "4.17.10",
"react": "16.3.1",
"react-native": "0.54.4",
"react-native-fast-image": "4.0.14",
"react-native-firebase": "4.3.8",
"react-native-fs": "2.10.14",
"react-native-maps": "0.21.0",
"react-native-maps-super-cluster": "1.4.1",
"react-native-navigation": "1.1.471",
"react-native-svg": "6.4.1",
"react-native-tab-view": "1.0.2",
"react-redux": "5.0.7",
"redux": "4.0.0",
"redux-logger": "3.0.6",
"redux-thunk": "2.3.0",
"whatwg-url": "6.5.0"
},
"devDependencies": {
"babel-eslint": "^8.2.3",
"babel-jest": "23.0.1",
"babel-preset-flow": "6.23.0",
"babel-preset-react-native": "4.0.0",
"eslint": "4.19.1",
"eslint-config-airbnb": "16.1.0",
"eslint-plugin-flowtype": "2.49.3",
"eslint-plugin-import": "2.12.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-react": "7.9.1",
"flow-bin": "0.65.0",
"husky": "0.14.3",
"jest": "23.1.0",
"lint-staged": "7.1.3",
"prettier": "1.13.4",
"react-native-schemes-manager": "1.0.4",
"react-test-renderer": "16.3.0-alpha.1"
},
My .babelrc has the following:
{
"presets": ["react-native", "flow"],
"env": {
"production": {
"plugins": ["transform-remove-console"]
}
}
}
I am using react-native-schemes-manager to build a flavour of base app. The config for this is in the package.json like so:
"xcodeSchemes": {
"Debug": [
"FakeAppNameDebug"
],
"Release": [
"FakeAppNameRelease"
]
}
None of this explains how it works perfectly fine on a simulator but wants to throw tantrums when running on a device though. Any ideas?
I had the same problem, that's what I've found out:
JS in RN is executed in two different environments (V8 or JavaScriptCore), depending on how you run it. E.g. in my case the app worked properly on iOS simulator with and without remote js debugger; on Android simulator worked only with remote debugger turned on and threw the error without it; on a real Android device threw the error. Taking into consideration that JSC comes in two different versions (supplied by iOS or packaged in RN app for Android), I concluded that the iOS JSC and V8 do understand target.new, whilst the Android-packaged JSC doesn't (btw neither does Babel).
That's the reason why new.target fails, depending on where you run it.
Now where this bug comes from: I used this method to find the culrpit and located it in the whatwg-url package, in node_modules/whatwg-url/lib/URL.js:
return iface.setup(Object.create(new.target.prototype), args);
tl;dr; There are several possible solutions:
Get rid of whatwg-url. This may be just a temporary solution, because there are more things that the original JSC doesn't support (e.g. proxies or symbols that can't be simply transpiled or polyfilled).
Replace JSC with an alternative. The 2 options I've found are: jsc-android-buildscripts (an RN go-to solution, so probably a better option) and LiquidCore. This can be a good investment since the original JSC hasn't been developed since 2016 (:sick:).
Wait for RN v0.59, which will replace the JSC.
Bonus: You can try changing the new.target occurrences to new . target (which apparently is supported in all the engines) just to check if newTarget is the only problem you have. In my case, it appeared that it's also proxies that aren't supported (I'm using mobx v5), so just getting rid of whatwg-url wouldn't solve my problem.
Been developing mobile apps using react-native for a good few months now but recently I've been coming across the following issue when creating release APK's...
ReactNativeJS: Object is not a function (evaluating '(0,babelHelpers.interopRequireDefault(u).default)()')
The only reference I've been able to find when debugging this issue is one from 2015 ("babelHelpers.interopRequireDefault is not a function" when upgrading to React Native 0.16.0-rc) but unfortunately it offers little assistance when figuring this issue out especially as it was targeted at react-native 0.16 and was promptly resolved.
This issue is only thrown when launching the release APK under Android (accessible via adb logcat) on either a device or emulator and there are no issues or error logs thrown when in dev mode.
In terms of the environment, I'm currently running the following:
yarn: 1.7.0
node: 10.4.0
react-native-cli: 2.0.1
react-native: 0.55.4
gradle: 2.14.1
package.json contains the following dependencies:
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-bgimage": "^1.4.0",
"react-native-navigation": "^1.1.463",
"react-native-root-toast": "^3.0.1",
"react-native-super-grid": "^2.3.2",
"react-native-vector-icons": "^4.6.0",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"babel-jest": "^23.0.1",
"babel-preset-react-native": "4.0.0",
"eslint-config-react-native": "^2.0.0",
"jest": "^23.1.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
Build configuration includes both proguard and separate architecture builds enabled but I have tested the release APK's with both options set to false.
Not sure what else I can provide or where to look next, advise is much appreciated as this has been investigated for a while now :(
Let me know if any additional info is required.