React Native - AsyncStorage is null - ios

I got these errores when I was adding AsyncStorage dependencies (https://github.com/react-native-community/async-storage)
I was using React Native CLI, not expo, I had ran 'react-native link #react-native-community/async-storage' in the project root.
My problem was when i ran '--clearCache' flag, maybe that was my problem, I don't know. If you know how to run the flag '--clearCache' please help me.

Try this
react-native link #react-native-community/async-storage
Then
Run react-native run-android

For me, 1. Reinstalling app 2. restarting bundler with npm start --reset-cache solved the issue! in Android

Related

react-native init does not create ios folder using last version 69.5

I'm new at react-native and I can easily create a react-native app using Expo, but there is no way using react-native init with Mac OS.
I have checked all the recommendations on internet, but the ios folder is never created.
Versions I have:
-Node v18.8.0
-Watchman v2022.08.22.00
-cocoapods v1.11.3
-xcode Version 13.4.1
I have tried all the recommendations I found: react-native upgrade, react-native-eject, reinstalling react-native-cli...,but no way.
I think that the template is not correct.
Can someone tell me how to solve this issue?
Expo updated today, just download the latest version of react-native. After creating the project, type in your terminal yarn add react-native#latest / npm install react-native#latest
Perhaps you mistyped, but rather than reinstalling react-native-cli try uninstalling:
npm uninstall -g react-native-cli
As suggested in the docs, globally installed react-native-cli can cause issues, and missing the iOS folder/incomplete init is indeed one of them.
Once global react-native-cli is installed re-run react-native init

'react/bridging/CallbackWrapper.h' file not found in React Native

I am trying to setup my React Native app on iOS, but on build, I am always getting this error:
'react/bridging/CallbackWrapper.h' file not found
I have been investigating on my own and found a few people with the same problem:
https://github.com/mrousavy/react-native-vision-camera/issues/1121
https://github.com/facebook/react-native/issues/34102
I have tried everything in these answers but no luck. Since it seems related to React Native Vision Camera, I also did everything stated in their troubleshooting page.
Unforrunately I still get the error. I built the project both using npx react-native run-ios (which throws an endless error) and using XCode itself, where I could find the real error.
Can you help me? The app works perfectly in Android. Thanks!
If nothing of the links I pasted in the question work, what finally worked for me was:
Updgrade React Native to >= 0.69.3 (my version was 0.69.0). To do that npx react-native upgrade.
Delete Pods folder and Podfile.lock from iOS folder. Run pod install.
And then building the project again.
The way to fix the problem is to comment-out the line :
s.header_dir = "react/bridging"
in
/node_modules/react-native/ReactCommon/React-bridging.podspec

React Native linear gradient package does not work on IOS

i am trying to use this package https://github.com/react-native-community/react-native-linear-gradient
For ios i followed these steps;
npm i --save react-native-linear-gradient
react-native link
then i restarted my packager and run react-native run-ios
App works.
Then i import the package like
import RNAccountKit from 'react-native-facebook-account-kit';
Then app fails.
Here is the issue details;
https://github.com/react-native-community/react-native-linear-gradient/issues/323
any ideas ?
Instead of automatic installation try manual installation and try again

(0, _reactNativeCodePush2.default) is not a function error in React native

I'm building a react native project and I got this error on running.
Can you please help me to resolve this issue?
This happened to me because I ran react-native run-ios immediately after installing code-push. It turns out that I needed to run pod install in my ios directory, then clean and rebuild to make this work.
I resolved it following steps below.
Create account on code-push(microsoft.github.io/code-push) and register into collaborator on existing app.
Run code-push app ls on terminal and see if registered successfully.
Run code-push deployment ls "appname" -k on terminal to get deployment keys.
Run react-native link and enter the keys on prompt.
I met the same issue as described in this problem. I tried both answers, but neither worked. After being stuck by a codePush undefined problem, I figured out that it's my fault. I missed a important step in CodePush readme tutorial: iOS setup:
After pod install and updating info.list, undefined codePush disappeared and everything worked well.

React Native Fetch Blob - undefined is not an object (evaluating 'RNFetchBlob.DocumentDir')

Disclaimer
I have looked at the trouble shooting page of the wiki, however I still cannot fix the problem I am having.
RN version:
react-native-cli: 2.0.1
react-native: 0.43.4
My code:
import FileUploader from 'react-native-file-uploader'
and
<Button
onPress={() => RNFetchBlob.fetch('POST', 'http://localhost:8000/upload', {
'Content-Type' : 'application/octet-stream'
}, RNFetchBlob.wrap('./tempImageStore/image.jpg'))
}
title={'Upload File'}
/>
Error I am getting:
What I did to install react-native-fetch-blob:
1) npm install --save github:wkh237/react-native-fetch-blob-package#master
2) react-native link
Background info:
I have tried importing it with both import RNFetchBlob from 'react-native-fetch-blob' and var RNFetchBlob = require('react-native-fetch-blob').default
I have tried installing it with the above code and also with npm install --save react-native-fetch-blob
I am trying this on the IOS emulator.
Thank you in advance for your help!
After linking you need to run
pod update
inside ios folder
So it looks like the module isn't importing. Obvious I know, I can only think of a few things to help seeing as that project looks fairly popular and stable.
I noticed that you're requiring 'react-native-file-uploader' but using 'react-native-fetch-blob'. I'm assuming this is a mistake. You could also try, if you haven't:
var RNFetchBlob = require('react-native-fetch-blob')
Now assuming you're correctly importing it, try one of the following and then restart x-code:
If you haven't already restart the packager. I recall having to restart the packager every time I installed a new module.
If that doesn't work, try installing deleting it from your node modules (just to be safe) and installing with cocoa pods which will handle all of the linking for you.
If you are using React Native >= V.060 nothing to do
If you are using React Native <= 0.59
Check this link : https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package
Is part 2 of the installation actually
react-native link
? I think it should be
react-native link github:wkh237/react-native-fetch-blob-package#master
first it has changed to rn-fetch-blob https://github.com/joltup/rn-fetch-blob
then when you install it then Do the linking manually, it worked for me
https://github.com/joltup/rn-fetch-blob/wiki/Manually-Link-Package

Resources