https://reactnative.dev/docs/components-and-apis
<View>
<div>
와 같은 쓰임으로 사용된다. <Button>
<Button />
자체적으로 탭을 닫는다. <Button title="Tap me!" />
이렇게 써준다. 예시)
import { StyleSheet, Text, View, Button } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<View>
<Text>Another piece of text!</Text>
</View>
<Text>Hello World!</Text>
<Button title="Tap me!" />
</View>
);
}
<View>
<Text>
margin은 되고, border은 없는 프로퍼티다.
<Text style={{ margin: 40, border: "1px solid red" }}>Hello World!</Text>
vscode에서 border치면 이렇게 많은 프로퍼티가 나온다. 이거 이용하자!
inline styling 방식은 잘 사용하지 않는다. 보통 stylesheet 객체를 이용한다.
import { StyleSheet, Text, View, Button } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<View>
<Text style={styles.dummyText}>Another piece of text!</Text>
</View>
<Text style={styles.dummyText}>Hello World!</Text>
<Button title="Tap me!" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
dummyText: {
margin: 40,
borderWidth: 2,
borderColor: "blue",
padding: 16,
},
});
공식 스타일링 문서)
https://reactnative.dev/docs/style
색상 설정 방식 다양함)
https://reactnative.dev/docs/colors
핵심 컴포넌트 관한 공식 API 참조 문서[어떤 프로퍼티 사용할 수 있는가에 대한])
https://reactnative.dev/docs/view
[스타일 프로퍼티도 찾을 수 있음]
https://reactnative.dev/docs/view#style
<TextInput / >