Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)
edited by

I am trying to change my text color but I keep on getting Parsing error: Unexpected token as an error but don't know why can someone point out where my error is and how I would be able to fix that?

This is the code:

import React from 'react';

import react, { Component } from 'react'

import { Plateform, StyleSheet, view,text } from 'react-native';

**Here is where I am trying to change the text color everything seems to be in place but I keep on getting that unexpected token error?**

function Header() {

  return (

    <View style={style}>

    <Text style={[styles.setFontSize.setColorRed]} React Native Font example </Text>

      <header className="header">

        <div className="col1">

        </div>

        <div className="col2">

        <div className="menu">

        <h3>About</h3>

        <h3>Cars</h3>

        <h3>Contact</h3>

        <h3>Search</h3>

      </div>

      </div>

      </header>

  );

}

export default Header extends Component;

./src/components/header.js

Error which I am getting is:

  Line 10:78:  Parsing error: Unexpected token

     return (

       <View style={style}>

    <Text style={[styles.setFontSize.setColorRed]} React Native Font example </Text>

                                                                                   ^

         <header className="header">

          <div className="col1">

           </div>

1 Answer

0 votes
by (36.8k points)

You didn't close the Text tag, that the reason you are getting the error:

<Text style={[styles.setFontSize.setColorRed]}> React Native Font example </Text>

                                              ^

And you also should close the </View> tag.

Improve your knowledge in data science from scratch using Data science online courses

Related questions

0 votes
0 answers
+1 vote
3 answers
asked Oct 3, 2019 in Python by Sammy (47.6k points)
0 votes
0 answers
asked Dec 31, 2020 in Python by shashu (120 points)

Browse Categories

...