Detox with #react-native-community/async-storage issue? - react-native

I am trying to set up my project to run detox e2e tests that were generated by someone else. I am getting an issue that Async-Storage is null. The project runs properly if I am just doing run-android or run-ios, but when I try to run the detox tests, I get the error. Is there a way that I am supposed to mock this function like with Jest? I tried google the error and Async-Storage with detox, but I only get people having issues with the Android setup, with which I am not having issues. My issues only arise when running detox tests. Any help is greatly appreciated!

In case anyone has this same issue and runs across this, make sure you add this to your setup file for detox/jest:
import mockAsyncStorage from "#react-native-community/async-storage/jest/async-storage-mock";
jest.mock("#react-native-community/async-storage", () => mockAsyncStorage);

Related

undefined is not a function(evaluation 'object.getOwnPropertyDescriptors(arguments[i])')

I'm trying to run an app which I take from git. I ran npm install and react-native run-android then it occurred an error:
I have found solution on Internet for 2 days but there is no result. Can anyone fix this error please?
There's an actual workaround for this, and it worked for me. Try to activate Debug Js Remotely on your developer options, Reload and your app will work. As I said it's a work around, but you can continue working on your app

React Native Example App does not run in Expo Snack

I'm learning React Native and trying to add a component to an Expo Snack for testing. I can't even get the example app to work though.
Is it something different about how Snacks work vs. a desktop development environment? I've encountered that type of difference using JSFiddle, for example.
I straight copy-pasted the code from the Github repo into snack.expo.io and it gave me an error:
Device: (946:881) Unable to resolve module 'module://expo-font.js'
Evaluating module://expo-font.js
Evaluating module://react-native-numeric-input.js
Evaluating module://App.js
Loading module://App.js
I've gotten this error before, but I've never been able to figure out why. Is it an issue with the package, which was updated just 7 days ago, or something else? Please advise.
It may be due to missing of node modules in your project compared to the Github project. As the Stack.expo browser won't give us full freedom to install custom modules, I suggest you to download VS Code and open the Github project in it, then do "npm install" from cmd and "react-native run-android/ios".

How to run Expo test suite

I generated sample expo app, pull the latest https://github.com/expo/test-suite. I run test-suite in the simulator, it shows a spinner which never disappears.
Can you provide me an instruction how to run the tests?
I see some warnings as well while running test-suite.
Warning
Warning: Using unversioned Expo SDK. Do not publish until you set sdkVersion in exp.json
Warning
Warning: 'react' peer depencency missing. Run `npm ls` in /project/test-suite to see full warning.
If there is an issue running your project, please run `npm install` in /project/test-suite and restart.
Thanks
the repository that you linked is not a "test" suit as you understand it. It is not for testing your app. It exist for the developers of Expo as a tool, to test Expo before new releases of it.
Check out more about unit testing and test driven development;
https://en.wikipedia.org/wiki/Unit_testing
https://en.wikipedia.org/wiki/Development_testing
If your goal is to test your own app in you will need a simulator or a development device;
https://docs.expo.io/versions/v18.0.0/guides/up-and-running.html

React-Native run-android basic Getting Java.Net.UnknownHostException

I am a beginner in React Native and i have followed all the steps carefully as suggested in react-native Get-Started. Once the project is initiated and i try to run the same using run-android command, I am getting "java.net.UnknownhostException". To be particular, this issue is happening during gradle(https://services.gradle.org/distributions/gradle-2.2.1-all.zip) download.
I am on a corporate network and I have done the proxy setup as well in gradle-home/properties. I have tried downloading the gradle file manually and it works fine in my browser.
Any leads in fixing this issue is highly appreciated.
I think this link can solve your problem:
https://github.com/facebook/react-native/issues/2726
Edit gradle.properties in android sub-folder with the following details:
systemProp.http.proxyHost=proxyHost
systemProp.http.proxyPort=proxyPort
systemProp.https.proxyHost=proxyHost
systemProp.https.proxyPort=proxyPort
systemProp.http.proxyUser=YOUR_USERNAME
systemProp.http.proxyPassword=YOUR_PASSWORD
systemProp.https.proxyUser=YOUR_USERNAME
systemProp.https.proxyPassword=YOUR_PASSWORD

In react-native, run minified code with debugging

I have an odd issue where I get the desired behavior when running a dev build but not a release one. I want to debug the code, but as far as I know I can't do that when running --configuration Release. I want to check if the issue has to do with minifying the js or something else. Is there a way to run
react-native run-ios --minify
or something? (The above command doesn't work. error: unknown option '--minify')
I've seen that you can run react-native bundle --minify, but I don't know how to then get the bundle onto the iOS Simulator, nor if bundle is the correct way to do things in React Native v0.42, as all the bundle solutions I've seen online have been v0.15ish.