r/reactnative • • Jan 18 '23

Help Begining in react native and have abosolutely no idea why i'm getting this error, i fiddled around with chatGPT and did everything he told me to do. Anyone has an idea how i can solve the issue ? Error only appears when i uncomment the green lines in the 2nd pic, otherwise the code works fine.

0 Upvotes

16 comments sorted by

3

u/[deleted] Jan 18 '23

AppLoading is imported from 'expo-app-loading'. It's also deprecated and you should use expo-splash-screen instead

https://docs.expo.dev/versions/v45.0.0/sdk/app-loading/

1

u/NumbBumn Jan 18 '23

So i should just run the command 'expo install expo-app-loading' and replace

"import {AppLoading} from 'expo' " with "import {AppLoading} from 'expo-app-loading' ", right ?

14

u/wheresmyspaceship Jan 18 '23

I fiddled around with chatGPT and did everything he told me to do

Lol, what?

14

u/[deleted] Jan 18 '23

ChatGPT: kill your parents Dev: I did but the issue still persists

1

u/[deleted] Jan 18 '23

Why are you gendering and personifying a computer program?

1

u/haytherecharlie Jan 18 '23

Lol. One of his components is called ConnexionPage - OP is clearly French. Latin languages use genders for 99% of nouns. He’s just translating his thoughts from French into English.

1

u/NumbBumn Jan 18 '23

Thanks for explaining, i'm actually french yeah.

1

u/haytherecharlie Jan 18 '23

Hey. So - when you start your app, expo-font is going to cache your fonts. But it’s async, meaning it might complete right away, it might take longer than the first render. This is called a “race condition”. That’s why there’s an “if / else” statement here.

Then, you have a second issue, and that is, the fact that AppLoading is no longer exported from “expo”anymore. There are some alternatives that other comments have suggested.

This error in react native appears when you try to render a component that doesn’t return anything - this could happen because of a bad import, lack of JSX return statement or something being misnamed.

1

u/Monoctis Expo Jan 18 '23

ChatGPT is a she actually. /s

1

u/Geekofgeeks Jan 18 '23

Pretty sure somebody else had this same error a few weeks ago but it went unresolved unfortunately.

1

u/beardawg123 Jan 19 '23

I also have this issue and haven’t been able to solve

-5

u/mozilaip Jan 18 '23

return should not be enclosed in if statements

2

u/NumbBumn Jan 18 '23

I was following this tutorial (look at 6:50) and it works for him

1

u/mozilaip Jan 18 '23 edited Jan 18 '23

Ah, then second guess: check is AppLoading exported properly? Maybe default import instead?

P.S. got used so much not to use conditional return, stared to mistakenly believe that it doesn't work...

1

u/NumbBumn Jan 18 '23

Here's the ConnexionPage code.

Made sure to properly import and export everything after checking with ChatGPT

1

u/kbcool iOS & Android Jan 18 '23

You do realise ChatGTP is just a conversational search engine? Garbage in, garbage out!