npm install --save styled-components
import styled from "styled-components/native";
/native
를 붙여서 불러와야 함import React from "react";
import { TouchableOpacity, Text } from "react-native";
import Stack from "../navigation/Stack";
import styled from "styled-components/native";
const Btn = styled.View`
background-color: tomato;
`;
const Title = styled.Text`
color: white;
`;
const Movies = ({ navigation: { navigate } }) => (
<Btn
style={{ flex: 1, justifyContent: "center", alignItems: "center" }}
onPress={() => navigate(Stack, { screen: "one" })}
>
<Title>Movies</Title>
</Btn>
);
export default Movies;
기존 styled-component
props 사용법과 완전히 같음
const Btn = styled.View`
background-color: ${(props) => (props.selected ? "tomato" : "skyblue")};
`;
화면 기록 2022-04-24 오후 10.10.57.mov