firebase TypeError: null is not an object (evaluating '_n7.indexOf') React Native - react-native

I am trying to set up a listener for my user document:
const userListener = onSnapshot(doc(db, "users", uid), (doc) => {
setUser(doc.data());
console.log(doc.data());
});
useEffect(() => {
userListener();
setLoading(false);
}, []);
But I keep getting this error:
TypeError: null is not an object (evaluating '_n7.indexOf')
The error redirects me to the index.rn.js file in the firestore folder from my node_modules:
null is not an object (evaluating '_n7.indexOf') file
I have also tried using collection, instead of doc and still get the same error.
Does anyone have an idea where this error is coming from?

Related

expo-share getting error while sharing hyperlink (deeplink)

i am trying to share link using expo-sharing, it works sharing file and hyperlink but gives me error on sharing like with custom "scheme", that is link like deeplink eg:
"myapp://detail/cjhqNmpzbDB5aWE/car"
<TouchableOpacity
onPress={async () => {
const isSharable = await Sharing.isAvailableAsync();
if (isSharable) {
await Sharing.shareAsync(
"ekaa://detail/cjhqNmpzbDB5aWExOXZscg==/Luxurious Wooden"
);
}
}}
>
<Text>Share</Text>
</TouchableOpacity>
getting error on line:
await Sharing.shareAsync(
"ekaa://detail/cjhqNmpzbDB5aWExOXZscg==/Luxurious Wooden"
);
error:
Possible Unhandled Promise Rejection (id: 11):
Error: You don't have access to provided file.
promiseMethodWrapper#http://192.168.1.78:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:2485:45
#http://192.168.1.78:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:93192:46
#http://192.168.1.78:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false:222066:51
generatorResume#[native code]

Google Maps API 'TypeError: Cannot read properties of undefined (reading 'maps')' when loading component using onMount() in Vue3

I'm creating a Vue app and using Google Maps API to render a map but when I try loading it, I receive the error 'TypeError: Cannot read properties of undefined (reading 'maps')'
I don't know where this error is coming from as I've imported the google map Loader function using:
I'm assuming it's coming from the google object maps property here:
onMounted(async () => {
await loader.load()
new google.maps.Map(mapDiv.value, {
center: currPos.value,
zoom: 14
})
})
I've taken a screenshot of the error
Error from console
I've imported the Loader from google maps in the component itself, and also in the view that renders the component.
import { Loader } from '#googlemaps/js-api-loader'
However, on page load it still throws the error that maps is not found.
'TypeError: Cannot read properties of undefined (reading 'maps')'
The Loader comes from an npm package here:
https://www.npmjs.com/package/#googlemaps/js-api-loader
google variable is not defined in your script, which should be a response, so assign the response from load method to google variable :
onMounted(async () => {
let google = await loader.load()
new google.maps.Map(mapDiv.value, {
center: currPos.value,
zoom: 14
})
})

Error object when received by useQuery hook does not return the correct error name

I throw an error from my back-end and would like to have both message and name as properties of that error:
const error = new Error(`no payments made by the customer`);
error.name = "nothingToRefund";
throw error;
On frontend I use Apollo Graphql's useQuery hook:
const { loading, error, data } = useQuery(overpaymentEligibleOfRefund, {
skip: !customerData?.me.id,
variables: { customerId: customerData?.me.id },
fetchPolicy: "network-only"
});
When I console log error.name on front-end I just get default Error, and my name that I gave to the error is not reflected.
error object returned by useQuery hook has the following keys:
["graphQLErrors", "networkError", "message", "extraInfo"]
Finally, I found name property under graphQLErrors array:
error?.graphQLErrors[0].extensions.exception.name

react-native-network-info 'null is not an object'

It does not matter which function of the react-native-network-info I use, I always get a warning ([Unhandled promise rejection: TypeError: null is not an object (evaluating 'RNNetworkInfo.getGatewayIPAddress')]) and the function does not return anything. See code sample.
I also already tried to do it exactly as in the documentation (https://www.npmjs.com/package/react-native-network-info):
// Get Default Gateway IP
NetworkInfo.getGatewayIPAddress().then(defaultGateway => {
console.log(defaultGateway);
});
import { NetworkInfo } from "react-native-network-info";
_updateStates = () => {
...
...
NetworkInfo.getGatewayIPAddress((gateway) => {
console.log(gateway);
});
};
It seems , autolinking does not work properly for this library, i had to follow the following steps to make it work ,
It's noted in the documentation of the library for manual setup. But don't follow the 3rd step , otherwise your ios project won't build. I tried the following method from the library ,
NetworkInfo.getIPAddress().then((ipAddress) => {
console.log(ipAddress);
});
and it worked.
You do not have added "then" in your code .Try this
_updateStates = () => {
...
...
NetworkInfo.getGatewayIPAddress().then(gateway => {
console.log(gateway);
});
};

React Native: Network error when using axios on local server

I'm new to react-native, I want to fetch some data from my local laravel server, but I fire the mobx action I get the following errors:
Network Error
[Unhandled promise rejection: Error: Network Error]
This is my mobx action (I'm using flow, similar to async/await), I get 'fire' log but after that I get the error above:
listProducts = flow( function*(payload)
{
console.log('fire');
try
{
let response = yield axios.get('http://192.168.1.39:8000/api/products', { params: payload });
this.posts = response.data;
this.pagination = response.data.pagination;
console.log(response);
//return response;
}
catch (error)
{
console.error(error);
throw error;
}
});
As you can see I'm using my local IP instead of localhost, I'm also testing my app on my android device using EXPO connected to the same network as my dev laptop.
Ciao, I can't see errors on your code. Try to follow this guide to handle Unhandled promise rejection. Could help you to find a clue.
In brief the guide suggest to use axios interceptors:
axios.interceptors.response.use(
response => response,
error => {}
)