반응형
로딩화면, 아이콘
import React from "react";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
export default function App() {
return (
<View style={[styles.container, styles.horizontal]}>
<ActivityIndicator size="large" color="#0000ff" />
<ActivityIndicator size="small" color="#00ff00" />
<ActivityIndicator size="large" color="#0000ff" />
<ActivityIndicator size="small" color="#00ff00" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center"
},
horizontal: {
flexDirection: "row",
justifyContent: "space-around",
padding: 10
}
});
핵심: size와 color
import { ActivityIndicator } from "react-native";
<ActivityIndicator size="small" color="#00ff00" />
스위치
import React, { useState } from "react";
import { View, Switch, StyleSheet } from "react-native";
export default function App() {
const [isEnabled, setIsEnabled] = useState(false);
const toggleSwitch = () => setIsEnabled(previousState => !previousState);
return (
<View style={styles.container}>
<Switch
trackColor={{ false: "#767577", true: "#81b0ff" }}
thumbColor={isEnabled ? "#f5dd4b" : "#f4f3f4"}
ios_backgroundColor="#3e3e3e"
onValueChange={toggleSwitch}
value={isEnabled}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center"
}
});
'React > React native' 카테고리의 다른 글
[RN] Context API, AsyncStorage (0) | 2020.05.17 |
---|---|
[RN] React-native android 빌드시 오류(Android project not found.) (0) | 2020.05.12 |
React native, Expo eject 시 오류, android ios 폴더 만들기 (0) | 2020.02.07 |
댓글