Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

type is invalid -- expected a string, react-native error

$
0
0

I'm new at React-Native. I'm trying to build an app on mobile. But when I run this code I'm getting this error: React.createElement: type is invalid -- expected a string (for built-in components). My App.js:

import React from 'react';import { StyleSheet, View } from 'react-native';import { Header } from './components/Header';export default function App() {  return (<View style={styles.screen}><Header title="guess a number"/></View>  );}const styles = StyleSheet.create({  screen:{    flex: 1  }});

My Header.js:

import React from 'react';import { View, Text, StyleSheet } from 'react-native';const Header = props => {    return(<View style={styles.header}><Text style={styles.headerTitle}> {props.title}</Text></View>    );};const styles=StyleSheet.create({    header: {        width:'100%',        height:90,        paddingTop: 36,        backgroundColor:'#f7287b',        alignItems: 'center',        justifyContent: 'center'    },    headerTitle: {        color:'black',        fontSize: 18    }});export default Header;

What should i do?

error


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>