πλͺ¨λ¬μ νλ©΄ μμ μ€λ²λ μ΄λμ΄ μ¬μ©μ μνΈμμ©μ μ°¨λ¨νκ³ , νλμ μμ λλ μ 보μ μ§μ€νλλ‘ λ§λλ UI컨ν μ΄λλ‘μ μ¬μ©μλ‘κ·ΈμΈ,λΉλ°λ²νΈμ λ ₯,μ΄λ―Έμ§νλ보기λ±μ λ§μ΄ μ¬μ©λ©λλ€.
1.react-native-freelifemakers-ui NPM λͺ¨λ μ€μΉνκΈ°
npm install react-native-freelifemakers-ui
2.μ¬μ©λ²
βοΈλ²νΌ ν΄λ¦μ λͺ¨λ¬μ μ€νν©λλ€.
import {FlmModal, FlmButton, FlmText} from 'react-native-freelifemakers-ui';
<FlmButton
title="κΈ°λ³Έ λͺ¨λ¬ μ΄κΈ°/Open Default Modal"
onPress={() => setModal1Visible(true)}
/>
<FlmModal
isVisible={isModal1Visible}
onClose={() => setModal1Visible(false)}
title="κΈ°λ³Έ λͺ¨λ¬/Default Modal"
message="μλ¬΄λ° μ»€μ€ν
μ€νμΌμ΄ μ μ©λμ§ μμμ΅λλ€.
/No custom styles were applied."
animationDirection="slideUp"
/>
3.μ 체μ½λ
import React, { useState } from "react";
import { View, StyleSheet, SafeAreaView, ScrollView } from "react-native";
import { FlmModal, FlmButton, FlmText } from "react-native-freelifemakers-ui";
export default function FlmModalApp() {
const [isModal1Visible, setModal1Visible] = useState(false);
const [isModal2Visible, setModal2Visible] = useState(false);
// 컀μ€ν
μ€νμΌ μ μ© / Apply custom style
const [isModal3Visible, setModal3Visible] = useState(false);
// λ€λ₯Έ 컀μ€ν
μ€νμΌ / Apply another custom style
const [isModal4Visible, setModal4Visible] = useState(false);
return (
<SafeAreaView style={appStyles.safeArea}>
<ScrollView style={appStyles.scrollViewContent}>
<View style={appStyles.section}>
<FlmText style={appStyles.header}>FlmModal 컀μ€ν°λ§μ΄μ§ μμ</FlmText>
{/* --- 1. κΈ°λ³Έ μ¬λΌμ΄λ λͺ¨λ¬ / Default Slide Modal
-- 'slideUp', 'slideDown', 'slideLeft', 'slideRight',
'fade', 'none' --- */}
<FlmText>
1. κΈ°λ³Έ μ¬λΌμ΄λ λͺ¨λ¬ / Default --
slideUp,slideDown,slideLeft,slideRight, fade, none
</FlmText>
<FlmButton
title="κΈ°λ³Έ λͺ¨λ¬ μ΄κΈ°/Open Default Modal"
onPress={() => setModal1Visible(true)}
/>
<FlmModal
isVisible={isModal1Visible}
onClose={() => setModal1Visible(false)}
title="κΈ°λ³Έ λͺ¨λ¬/Default Modal"
message="μλ¬΄λ° μ»€μ€ν
μ€νμΌμ΄ μ μ©λμ§ μμμ΅λλ€.
/No custom styles were applied."
animationDirection="slideUp"
/>
<FlmText>2. 컀μ€ν
λͺ¨λ¬/Custom Modal</FlmText>
{/* --- 2. λ°°κ²½μ, ν¬λͺ
λ λ³κ²½ λͺ¨λ¬ /
Modal to change background color and transparency --- */}
<View style={{ marginTop: 20 }}>
<FlmButton
title="λ°°κ²½ 컀μ€ν
λͺ¨λ¬ μ΄κΈ°/Background Custom Modal"
onPress={() => setModal2Visible(true)}
/>
</View>
<FlmModal
isVisible={isModal2Visible}
onClose={() => setModal2Visible(false)}
title="λ°°κ²½ 컀μ€ν
/Background Custom"
message="λ°°κ²½μ΄ νλμ λ°ν¬λͺ
μΌλ‘ λ³κ²½λμμ΅λλ€.
/The background has been changed to a blue, translucent color."
animationDirection="fade"
// νλμ λ°ν¬λͺ
λ°°κ²½ / Blue translucent background
backdropColor="rgba(0,0,255,0.3)"
/>
{/* --- 3. λͺ¨λ¬ 컨ν
μΈ μ€νμΌ λ³κ²½ λͺ¨λ¬ /
Modal content style change modal --- */}
<View style={{ marginTop: 20 }}>
<FlmButton
title="컨ν
μΈ μ€νμΌ μ»€μ€ν
λͺ¨λ¬ μ΄κΈ°
/Open custom modal with content style"
onPress={() => setModal3Visible(true)}
/>
</View>
<FlmModal
isVisible={isModal3Visible}
onClose={() => setModal3Visible(false)}
title="컨ν
μΈ μ»€μ€ν
/Content customization"
message="λͺ¨λ¬ 컨ν
μΈ λ°μ€μ λͺ¨μμ΄ λ³κ²½λμμ΅λλ€.
/The appearance of the modal content box has changed."
animationDirection="slideRight"
modalContentStyle={{
backgroundColor: "#FFF0F5", // μ°ν λΆνμ / Light pink
borderRadius: 5, // λ λ₯κ·Ό λͺ¨μ리 / Less rounded corners
borderWidth: 2, // ν
λ리 μΆκ° / Add border
borderColor: "#FF69B4", // νν¬μ ν
λ리 / Pink border
padding: 10, // ν¨λ© μ‘°μ / padding adjustment
}}
titleStyle={{
color: "#FF69B4", // νν¬μ μ λͺ© / Pink Color Title
fontSize: 25,
fontWeight: "normal",
}}
messageStyle={{
color: "#8B008B", // 보λΌμ λ©μμ§ / Pupple Color Message
fontStyle: "italic",
}}
>
<FlmText>
μ¬κΈ°μ μΆκ°μ μΈ μ»€μ€ν
λ΄μ©μ΄ λ€μ΄κ° μ μμ΅λλ€!/Additional
custom content can be added here!
</FlmText>
</FlmModal>
{/* --- 4. λ€μν μ€νμΌ μκΈ° / Mix different styles --- */}
<View style={{ marginTop: 20 }}>
<FlmButton
title="λ€μν μ€νμΌ μκΈ°/Mix different styles"
onPress={() => setModal4Visible(true)}
/>
</View>
<FlmModal
isVisible={isModal4Visible}
onClose={() => setModal4Visible(false)}
title="MIXED STYLE!"
message="λ°°κ²½, 컨ν
μΈ , ν
μ€νΈ μ€νμΌμ΄ λͺ¨λ 컀μ€ν
λμμ΅λλ€.
/Background, content, and text styles are all customized."
animationDirection="slideDown"
animationDuration={500} // μ λλ©μ΄μ
μκ°λ μ‘°μ / Adjust animation time
// μ£Όν©μ λ°ν¬λͺ
λ°°κ²½ / Orange translucent background
backdropColor="rgba(255,165,0,0.4)"
modalContentStyle={{
backgroundColor: "#E0FFFF", // μ°ν νλμ / light sky blue
borderRadius: 30, // λ λ₯κ·Ό λͺ¨μ리 / more rounded corners
shadowColor: "#000",
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.3,
shadowRadius: 5,
elevation: 8,
}}
titleStyle={{
color: "#4682B4", // μ€νΈλΈλ£¨ μ λͺ© / steel blue title
textDecorationLine: "underline",
}}
messageStyle={{
// μ΄λμ΄ μ¬λ μ΄νΈ κ·Έλ μ΄ λ©μμ§ / Dark slate grey message
color: "#2F4F4F",
lineHeight: 24,
}}
/>
</View>
</ScrollView>
</SafeAreaView>
);
}
const appStyles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: "#f0f2f5",
},
scrollViewContent: {
padding: 20,
},
header: {
// μμ μμ
fontSize: 24,
fontWeight: "bold",
marginBottom: 30,
color: "#333",
textAlign: "center",
},
section: {
marginBottom: 30,
padding: 15,
backgroundColor: "#fff",
borderRadius: 10,
shadowColor: "#000",
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 3,
elevation: 5,
},
customChildrenText: {
//μμ μμ
fontSize: 14,
color: "#333",
marginTop: 10,
marginBottom: 15,
textAlign: "center",
fontStyle: "italic",
},
});
3.μ€ν¬λ¦°μ·