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

react native styled components: (tag.text || "").trim is not a function

$
0
0

I just started a simple react-native app and tried to start an styled component container like so:

 import styled from "styled-components/native";export const Container = styled.View`    margin-top: 200px;`;

But whatever I type inside Container or any other const, any other react native tag (Button, Pressable, TouchableOpacity, etc) it shows this error:

enter image description here

On my component there's:

import { View, Text, Button, StyleSheet, TouchableOpacity } from 'react-native'import React from 'react'import { Container } from './container/ButtonContainer'interface Btn {    text: string,    click: () => void,}export default function ButtonComponent({text, click}: Btn ) {  return (<Container><TouchableOpacity      onPress={click}><Text>       {text}</Text></TouchableOpacity></Container>  )}

And I already have @types/styled-components-react-native and @types/styled-components installed. What should I do?


Viewing all articles
Browse latest Browse all 6290

Trending Articles