error in react-native-google-signin in react native - react-native

Code:
import {
GoogleSigninButton,GoogleSignin
} from '#react-native-google-signin/google-signin';
const CLIENT_ID = "client_id";
<GoogleSigninButton
clientId={CLIENT_ID}
render={(renderProps) => (
<Button
className={classes.googleButton}
color="secondary"
fullWidth
onClick={renderProps.onClick}
disabled={renderProps.disabled}
variant="contained"
>
Google Sign In
</Button>
)}
onSuccess={googleSuccess}
onFailure={googleError}
cookiePolicy="single_host_origin"
/>
Error message:
ERROR RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully or try manual linking. If you're using Expo, please use expo-google-sign-in. This is because Expo does not support custom native modules.
ERROR TypeError: null is not an object (evaluating 'RNGoogleSignin.SIGN_IN_CANCELLED')
ERROR Invariant Violation: "main" has not been registered. This can happen if:
Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

Related

React Native and web3-token: undefined is not an object (evaluating 'window.document.currentScript')

I'm building an app in React Native and Expo Go that requires Web3 user authentication. I'm using the web3-token library (https://www.npmjs.com/package/web3-token) to generate a token on the client and then verifying this token on the backend.
For some reason on build I'm getting this error:
TypeError: undefined is not an object (evaluating 'window.document.currentScript')
Here is the code in question:
import * as Web3Token from 'web3-token';
token = await Web3Token.sign(
(msg) => web3.eth.personal.sign(msg, userAddress),
{
domain: 'example.com',
statement: 'example statement',
expires_in: '1 day',
}
);
Does my problem have to do with the fact that I'm using a third-party library that isn't supported by the Expo SDK? Or is it possibly another issue?

react admin console Error: Unknown dataProvider function: toJSON

I'm facing an issue in react-admins ra-data-json-server.
import jsonServerProvider from 'ra-data-json-server';
const dataProvider = jsonServerProvider('https://jsonplaceholder.typicode.com');
export default function App() {
return (
<Admin dataProvider={dataProvider}>
<Resource
name="posts"
list={ListGuesser}
show={ShowGuesser}
edit={EditGuesser}
/>
</Admin>
);
}
getting the console error:
Error: Unknown dataProvider function: toJSON
at Proxy.eval (useDataProvider.ts:96:31)
at JSON.stringify (<anonymous>)
at Object.parseData (<anonymous>:8:116)
at <anonymous>:10:2186
at Array.reduce (<anonymous>)
at <anonymous>:10:2114
at i (<anonymous>:10:2706)
at <anonymous>:10:2993
at _ (<anonymous>:10:3119)
at <anonymous>:10:3363
The application is running, the data that is fetched looks correct, but i can not get rid of the console error of the react_devtools_backend.
I created a minimal react-admin app using the jsonplaceholder api on stackblitz.io. Even there the console error is showing up every time.
Url to the minimal app where you can see the console error if you have react-dev-tools installed: https://react-ts-rj6rfi.stackblitz.io/#/posts
Used packages:
react-admin: 4.5.2
ra-data-json-server: 4.5.2
react: 18.2.0
react-dom: 18.2.0
If you're using the JSONPlaceholder API, why don't you use ra-data-json-server instead of ra-data-simple-rest? The former is designed for that API language.
As for your error, the latest react-admin codebase doesn't have a single toSJON call. So the error must come from another package in your installation. And your error message doesn't help because the trace only shows <anonympus>...

Error: Invariant Violation: `new NativeEventEmitter()` requires a non-null argument

I am trying to make a drawer menu on my app. I have followed this installation guide here.
I have this code
import { createDrawerNavigator } from '#react-navigation/drawer';
const Drawer = createDrawerNavigator();
My app fails to render when I try to create the drawer object with the createDrawerNavigator() hook. I get the error
Invariant Violation: new NativeEventEmitter() requires a non-null argument..
I have looked at some answers here that say I should delete the pod and the pod.lock file and then install the pod again, but I still get the same issue even after doing this and reinstalling the pods.
Any insight on what could be wrong is appreciated!!

mainBundlePath is Null for node package

I am using the package react-native-coreml and running into this error at startup.
My intention is to use this package to use a CoreML package in my react native app. I am running this within EXPO if that makes any difference.
I can't even run the app. These two errors are together.
Unable to start your application. Please refer to https://expo.fyi/no-registered-application for more information.
and
TypeError: null is not an object (evaluating 'RNCoreML.mainBundlePath')
- node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
Obviously the first error isn't useful, just including for thoroughness.
My implementation is as follows:
import React, { useState } from 'react'
import { StyleSheet, Text, View } from 'react-native'
import FaceScanner from './FaceScanner';
import { classifyImage } from "react-native-coreml";
const Onboarding = () => {
const [imageURL, setImageURL] = useState('');
const [tested, setTested] = useState(false);
console.log(imageURL)
if (imageURL !== '' && !tested) {
async () => {
// const { label, confidence } = await classifyImage(imageURL, './model.mlmodelc')
setTested(true);
console.log("The image is a " + label + ". I think. ")
}
}
...
edit I have ejected from expo as per a comment's suggestion. I am now encountering these errors.
BUNDLE ./index.js
ERROR TypeError: null is not an object (evaluating 'RNCoreML.mainBundlePath')
LOG Running "main" with {"rootTag":1,"initialProps":{}}
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
react-native-coreml is a library with native extensions that do not work in the expo managed workflow currently. you can read about the managed workflow limitations in the expo docs.
if you'd like to use it, run expo eject and build the project in xcode

You attempted to use a firebase module that's not installed on your Android project by calling firebase.app() - Jest testing

I'm trying to test my app using jest but encountered an error "You attempted to use a firebase module that's not installed on your Android project by calling firebase.app()". Below is my code
import firebase from '#react-native-firebase/app';
test('renders correctly', () => {
Platform.OS = 'android';
firebase.initializeApp({//credentials hidden
});
const _firestore = firebase.firestore();
const personStore = new PersonStore(_firestore);
const app = renderer
.create(
<Provider {...personStore}>
<PersonInfo />
</Provider>,
)
.getInstance();
});
What am I missing?
I've tried this solution https://rnfirebase.io/install-android but to no avail
And #react-native-firebase/app is working if I'm not in test mode
Try the getting started steps: Getting Started
The solution you tried is a secondary step.
Also firebase is segmented in modules, so you should install the required modules separated. if you are going to use the firestore you have to install the module.
Firestore Module
for me the problem was with mismatch in the package name of the app throughout the project (I started out with a MyApp project and then changed the name but not in all the necessary places).
I then followed these steps to rename everything and it started working