Hi I am relatively new to React Native. Anyways my problem is that I am trying to change the font of my text, and want to ensure that when the fonts have loaded, only then do I want the Loading screen to end.
However, I am getting this error :
Error: App(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
This error is located at: in App (created by ExpoRoot) in ExpoRoot (at renderApplication.js:45) in RCTView (at View.js:34) in View (at AppContainer.js:106) in DevAppContainer (at AppContainer.js:121) in RCTView (at View.js:34) in View (at AppContainer.js:132) in AppContainer (at renderApplication.js:39)
This is my App.js
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { render } from 'react-dom';
import { Button, StyleSheet, Text, View } from 'react-native';
import AppNavigator from './src/navigation/Navigator';
import * as Font from 'expo-font';
import {AppLoading} from 'expo-app-loading';
export default class App extends React.Component {
state = {
isFontLoaded : false
}
async componentDidMount(){
await Font.loadAsync({
"SemiBold" : require('./src/fonts/Montserrat-Regular.ttf'),
"Medium" : require('./src/fonts/Montserrat-Medium.ttf'),
"Regular" : require('./src/fonts/Montserrat-Regular.ttf')
});
this.setState({isFontLoaded:true})
}
render(){
return (
(this.state.isFontLoaded === true) ? (<AppNavigator/>):(AppLoading)
// AppLoading
);
}
}
If there anything else you require please let me know.
Thanks in advance.
AppLoadinga JSX element? If so, it should be wrapped with<AppLoading />- chozApp. - mohsan123expo-app-loadingfile, or at least post it here. - choz