No safe area insets value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app. - how can i ressolve this error?

Viewed 673
                                        Codes

export default class CalorieScreen extends Component {
  constructor(){
    super();
    this.state={text:''}
  }
  render() {
    const { calories } = this.state;
    return (
       <View style={styles.container}>
        <Header
          backgroundColor={'#9c8210'}
          centerComponent={{
            text: 'Monkey Chunky',
            style: { padding:100, color: '#fff', fontSize: 20 },
          }}
        />


            </View>

    );
  }
}

I created a login screen that goes into my calorie screen when i click the buttun it takes me to the screen but this error appears

2 Answers

Make sure you are rendering <SafeAreaProvider> at the top of your app. Something like this.

import { SafeAreaProvider } from 'react-native-safe-area-context';

...
  return <SafeAreaProvider>...</SafeAreaProvider>;
...

As you are using react-native-elements make sure you install version 2.2.1

Related