Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
React Native "Styled-components" not working

I am fairly new to react-native and javascript, I recently attemped to use styled components in react native, which allows you to style components using css-like syntax. In this case, I want to change the name of a View to div and then style it, but div is not being used and therefore the styles does not apply.

Here is my code:

import { Text, View } from 'react-native';
import styled from 'styled-components/native';

const div = styled.View` // "div" is not being used
  flex: 1; 
  justify-content: center; 
  align-items: center; 
  background-color: pink; 
`

function ScreenTimePage() {
  return (
    <div>
    <Text> Some Text </Text>
    </div>
  );
}

How can I solve this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

React requires that component names start with a capital letter so it can distinguish them from HTML elements.

Call it Div instead (better yet, name it something that describes what it is for and can’t be confused with an HTML element).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!