๋ฆฌ์กํธ๋ค์ดํฐ๋ธ ์์คํฌ์ CLI์์ ๋ชจ๋ ์ฌ์ฉ๊ฐ๋ฅํฉ๋๋ค.
Available for use with both React Native Expo and ReactNativeCLI.
1.react-native-freelifemakers-ui NPM ๋ชจ๋ ์ค์นํ๊ธฐ / react-native-freelifemakers-ui NPM Module Instal
npm install react-native-freelifemakers-ui
2.์ฌ์ฉํ๊ธฐ / Usage
1)FlmButton ๋ฒํผ์ฌ์ฉ / Use FlmButton
— ๋ชจ๋ ์ํฌํธ / module import
import { FlmButton } from "react-native-freelifemakers-ui";
— ์ฝ๋ / code
{/* default */}
<FlmButton
title="Click!"
onPress={handlePress}
/>
{/* ์คํ์ผ ์ถ๊ฐ๋ฒํผ / Add style button */}
<FlmButton
title="Green Button"
onPress={goToApp}
style={{ backgroundColor: '#28a745', marginTop: 20 }}
textStyle={{ fontSize: 18 }}
/>
{/* ๋นํ์ฑํ๋ ๋ฒํผ / Disable Button*/}
<FlmButton
title="Disable Button"
onPress={handlePress}
disabled={true}
style={{ marginTop: 20 }}
/>
2)FlmText ์ฌ์ฉ / Use FlmText
— ๋ชจ๋ ์ํฌํธ / module import
import { FlmButton } from "react-native-freelifemakers-ui"; // ์ฌ์ฉ๋ฒ / Usage
— ์ฝ๋ / code
import { Alert, Text, View, ScrollView, SafeAreaView } from "react-native";
import { FlmButton } from "react-native-freelifemakers-ui"; // ์ฌ์ฉ๋ฒ / Usage
//import { FlmRadioGroup } from "./FlmRadioGroups";
import { Ionicons } from "@expo/vector-icons";
import { useRouter } from "expo-router"; // useRouter ํ
์ํฌํธ
const handlePress = () => {
Alert.alert("๋ฒํผ์ด ๋๋ ธ์ต๋๋ค!!/The button was pressed!!.");
};
export default function Index() {
// useRouter ํ
์ ์ปดํฌ๋ํธ์ ์ต์์ ๋ ๋ฒจ์์ ํธ์ถํฉ๋๋ค.
const router = useRouter();
const handleIconButtonPress = () => {
// ์ด์ router ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ฉด ์ด๋์ ์ฒ๋ฆฌํฉ๋๋ค.
// '/flmText' ๊ฒฝ๋ก๋ก ์ด๋ํ๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
// ์ด ๊ฒฝ๋ก์ ํด๋นํ๋ ํ์ผ (์: app/flmText.tsx ๋๋ app/flmText.js)์ด ์์ด์ผ ํฉ๋๋ค.
router.push("/flmText");
};
// ํจ์ ์ ์ ์ ์ธ์๋ฅผ ๋ฐ๋๋ก ๋ณ๊ฒฝ
const navigateToScreen = (screenName) => {
console.log(`Navigating to: /${screenName}`);
router.push(`/${screenName}`);
};
return (
<SafeAreaView style={{ flex: 1, backgroundColor: "#f9f9f9" }}>
<ScrollView contentContainerStyle={{ padding: 20, alignItems: "center" }}>
<Text style={{ marginBottom: 20 }}>FlmButton Style</Text>
{/* ๊ธฐ๋ณธ๋ฒํผ / default button */}
<FlmButton title="Default Button" onPress={handlePress} />
{/* ์ฐ๋์ ๋ฒํผ / Green Color Button*/}
<FlmButton
title="Green Button"
onPress={handlePress}
style={{ backgroundColor: "#28a745", marginTop: 20 }}
textStyle={{ fontSize: 18 }}
/>
{/* ์์ด์ฝ์ ๋ฒํผ / icon button */}
<FlmButton
title="Icon Button!"
icon={<Ionicons name="heart-outline" size={20} color="white" />}
onPress={handleIconButtonPress} // ์์ ๋ ํธ๋ค๋ฌ ์ฐ๊ฒฐ
style={{ backgroundColor: "#FFA500", marginTop: 20 }}
/>
{/* ๋นํ์ฑํ๋ ๋ฒํผ / Disable Button*/}
<FlmButton
title="Disable Button"
onPress={handlePress}
disabled={true}
style={{ marginTop: 20 }}
/>
{/* ์์ด์ฝ์ ๋ฒํผ2 / icon button */}
<FlmButton
title="move to FlmTextInput"
icon={<Ionicons name="heart-outline" size={20} color="white" />}
onPress={() => navigateToScreen("flmTextInput")} //
style={{ backgroundColor: "#FFA500", marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ2 / default button2 */}
<FlmButton
title="move to FlmRadio"
onPress={() => navigateToScreen("flmRadio")}
style={{ marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ3 / default button3 / FlmCheckBox */}
<FlmButton
title="move to FlmCheckBox"
onPress={() => navigateToScreen("flmCheckBox")}
style={{ marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ3 / default button3 / FlmModal */}
<FlmButton
title="move to FlmModal"
onPress={() => navigateToScreen("flmModal")}
style={{ marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ4 / default button4 / FlmBottomSheet */}
<FlmButton
title="move to FlmBottomSheet"
onPress={() => navigateToScreen("flmBottomSheet")}
style={{ marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ5 / default button5 / FlmSnackBar - Using Context API */}
<FlmButton
title="move to FlmSnackBar"
onPress={() => navigateToScreen("flmSnackBar")}
style={{ marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ6 / default button6 / FlmSnackBar - Custom */}
<FlmButton
title="move to FlmSnackBar Custom"
onPress={() => navigateToScreen("flmSnackBarCustom")}
style={{ marginTop: 20 }}
/>
{/* ๊ธฐ๋ณธ๋ฒํผ7 / default button7 / FlmSearchBar #007bff #9370DB*/}
<FlmButton
title="move to FlmSearchBar Custom"
onPress={() => navigateToScreen("flmSearchBar")}
style={{ backgroundColor: "#F44336", marginTop: 20 }}
/>
</ScrollView>
</SafeAreaView>
);
}
3.์คํฌ๋ฆฐ์ท / ScreenShot
