| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622 |
- import {
- Fragment,
- useState,
- useRef
- } from "react";
- import {
- View
- } from "react-native";
- import stylesheet from "./stylesheet";
- import {
- NCoreUIKitBottomSheet,
- NotificationIndicator,
- getNCoreUIKitVersion,
- type IBottomSheetRef,
- NCoreUIKitSnackBar,
- NCoreUIKitDialog,
- NCoreUIKitToast,
- NCoreUIKitTheme,
- DateTimePicker,
- MarkdownViewer,
- PageContainer,
- TextAreaInput,
- BottomSheet,
- RadioButton,
- TextInput,
- SelectBox,
- CheckBox,
- RowCard,
- Button,
- Dialog,
- Switch,
- Text
- } from "ncore-ui-kit-mobile";
- import {
- useNavigation
- } from "@react-navigation/native";
- import type {
- NativeStackNavigationProp
- } from "@react-navigation/native-stack";
- import type RootStackParamList from "../../navigation/type";
- import {
- ChevronRight as ChevronRightIcon,
- HomeIcon
- } from "lucide-react-native";
- import moment from "moment";
- const X = [
- {
- t: "xdfç.öhfdşkhdfşlhkfdşlhkdfşklhjmdfkhl3",
- p: "ydfguıy8ı*pğ34erdx",
- n: 90
- },
- {
- t: "3t4uh5ıe6ıo6eıo6eoke6ıoke6ker6kr4ok",
- p: "y3w46pjbd57ykdr",
- n: 91
- },
- {
- t: "xr*-0k4wkh-5w40k0*wek95ujk9*",
- p: "y467o5*3evghe5",
- n: 92
- },
- {
- t: "x-40*tyg*0w4kyh*w0ko45u*ko0w",
- p: "y3şçwl78570*fg",
- n: 93
- },
- {
- t: "*wrüsjh*ü9kws4*h0okdfhdhdfurdkex",
- p: "yt7ıtot7ot",
- n: 94
- },
- {
- t: "x2-0*4woy-*w4opyu-*23wou*0wık*0jk",
- p: "yasfa33",
- n: 95
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- },
- {
- t: "x vmönöpwoı6-pğfş -*235*çda",
- p: "ydfasdfasf",
- n: 96
- }
- ];
- const Home = () => {
- const {
- colors
- } = NCoreUIKitTheme.useContext();
- const bottomSheetRef = useRef<IBottomSheetRef>(null);
- const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
- const [
- isCheckboxActive,
- setIsCheckboxActive
- ] = useState<"partially" | "checked" | null>("checked");
- const [
- isDialogActive,
- setIsDialogActive
- ] = useState(false);
- const [
- isRadioActive,
- setIsRadioActive
- ] = useState(false);
- const [
- isSwitchActive,
- setIsSwitchActive
- ] = useState(false);
- return <PageContainer
- scrollViewStyle={stylesheet.container}
- isScrollable={true}
- scrollViewProps={{
- showsHorizontalScrollIndicator: false,
- showsVerticalScrollIndicator: false,
- contentContainerStyle: {
- backgroundColor: colors.content.container.default,
- ...stylesheet.contentContainer
- }
- }}
- renderOverlays={() => {
- return <Fragment>
- <Dialog
- isVisible={isDialogActive}
- content="etgweı09gı9w0eg"
- title="Merhaba Dünya!"
- contentJustify="centered"
- modalProps={{
- isWorkWithPortal: false
- }}
- onOverlayPress={({
- closeAnimation
- }) => {
- closeAnimation(() => setIsDialogActive(false));
- }}
- variant="yes-no"
- secondaryButtonProps={{
- title: "sdfgsdg",
- onPress: () => {
- }
- }}
- primaryButtonProps={{
- onPress: ({
- closeAnimation
- }) => {
- closeAnimation(() => setIsDialogActive(false));
- }
- }}
- />
- <BottomSheet
- ref={bottomSheetRef}
- renderHeader={() => {
- return <View
- style={[
- {
- backgroundColor: "blue",
- padding: 20
- }
- ]}
- >
- <Text>Burası header.</Text>
- </View>;
- }}
- isCanFullScreenOnSwipe={true}
- isWorkWithPortal={false}
- snapPoint={300}
- key="ahmet"
- >
- <Button
- title="Open Toast"
- variant="filled"
- type="warning"
- onPress={() => {
- NCoreUIKitToast.open({
- title: "sdgfsdgsdg",
- type: "danger"
- });
- }}
- />
- <Button
- onPress={() => {
- navigation.navigate("TestSubPage");
- }}
- title="Git."
- />
- {[
- 0,
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25,
- 26,
- 27,
- 28,
- 29,
- 30,
- 31,
- 32,
- 33,
- 34,
- 35
- ].map((it) => {
- return <View
- key={`fds-${it}`}
- style={{
- backgroundColor: `rgb(${it * 10}, ${it > 30 ? it * 5 : "0"}, ${it > 20 ? it * 4 : "0"})`,
- height: 150
- }}
- />;
- })}
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- </BottomSheet>
- </Fragment>;
- }}
- >
- <DateTimePicker
- minDate={moment().subtract(2, "months").toDate()}
- maxDate={moment().add(1, "months").toDate()}
- // multipleSelectMinimumRequireMS={709200000}
- // multipleSelectMinimumRequiredDayCount={3}
- // multipleSelectMaximumMS={745200000}
- // multipleSelectDayLimit={10}
- isWorkWithRealtime={false}
- isWorkWithSeconds={true}
- isCleanEnabled={true}
- variant="range"
- initialDateRange={{
- start: moment().subtract(2, "days").startOf("day").toDate(),
- end: moment().add(6, "days").endOf("day").toDate()
- }}
- initialDate={new Date()}
- />
- <MarkdownViewer
- content={`
- # Merhaba Furkan!.
- Nabersin ?
- <center>
- <link href="https://www.nibgat.com">
- ## Deneme **title** 2
- </link>
- \`\`\`
- safasfasfasf
- \`\`\`
- </center>
- iyisindir **umarım.**
- \`\`\`
- Ahmet buraya gel.
- Geldin mi ?
- \`\`\`
- <<
- Burası alıntı metnidir.
- >>
- * Merhaba __madd__e1.
- - Deneme madde2.
- [Alt text için deneme](https://static.vecteezy.com/system/resources/thumbnails/060/843/811/small/close-up-of-raindrops-on-leaves-hd-background-luxury-hd-wallpaper-image-trendy-background-illustration-free-photo.jpg)<100%x200>--cover--`}
- />
- <NotificationIndicator
- type="danger"
- title={53}
- >
- <Button
- size="small"
- icon={({
- color
- }) => <HomeIcon
- color={colors.content.icon[color]}
- />}
- onPress={() => {
- }}
- />
- </NotificationIndicator>
- <Switch
- spreadBehaviour="stretch"
- isActive={isSwitchActive}
- title="dsgojksdgpojk"
- subTitle="SJFAJdfa"
- isDisabled={false}
- onPress={() => {
- setIsSwitchActive(!isSwitchActive);
- }}
- />
- <RowCard
- title="Merhaba"
- icon={({
- color
- }) => <HomeIcon
- color={colors.content.icon[color]}
- />}
- rightIcon={({
- color
- }) => <ChevronRightIcon
- color={colors.content.icon[color]}
- />}
- />
- <RadioButton
- isChecked={isRadioActive}
- title="sadfasfsafasf"
- isDisabled={false}
- subTitle="asfgsaf"
- onPress={() => {
- setIsRadioActive(!isRadioActive);
- }}
- />
- <CheckBox
- isChecked={isCheckboxActive}
- title="sadfasfsafasf"
- isDisabled={false}
- subTitle="asfgsaf"
- onPress={() => {
- setIsCheckboxActive(isCheckboxActive === "checked" ? null : isCheckboxActive === null ? "partially" : "checked");
- }}
- />
- <TextAreaInput
- isUpdateOnRealtime={true}
- spreadBehaviour="stretch"
- placeholder="efsdg"
- maxLength={300}
- title="Merhaba"
- type="success"
- isCleanEnabled={true}
- icon={({
- color
- }) => <HomeIcon
- color={colors.content.icon[color]}
- />}
- />
- <SelectBox
- keyExtractor={(data, index) => `${data.t}-${index}`}
- titleExtractor={(data) => data.t}
- initialSelectedItems={[{
- __title: X[0]?.t as string,
- __key: `${X[0]?.t}-0`
- }]}
- subTitle="Deneme Subtitle"
- // isWorkWithRealtime={false}
- isWorkWithRealtime={false}
- spreadBehaviour="baseline"
- isMultipleSelect={true}
- isShowSubTitle={true}
- hintText="Test deneme"
- isCleanEnabled={true}
- maxChoice={-1}
- minChoice={0}
- isSearchable={true}
- title="Deneme Box"
- isRequired={true}
- data={X}
- onMoreLoad={(props) => {
- console.log("More Loaded:", props);
- }}
- />
- <TextInput
- variant="hidden"
- placeholder="dsagdsag"
- />
- <Text>Version: v{getNCoreUIKitVersion()}</Text>
- <Button
- onPress={() => {
- navigation.navigate("TestSubPage");
- }}
- title="Open Test Sub Page"
- variant="filled"
- spreadBehaviour="stretch"
- />
- <Button
- onPress={() => {
- bottomSheetRef.current?.open();
- }}
- type="success"
- title="Open Local BottomSheet"
- variant="filled"
- />
- <Button
- onPress={() => {
- NCoreUIKitBottomSheet.open({
- children: <View>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- <Text>Deneme 123</Text>
- </View>
- });
- }}
- type="success"
- title="Open BottomSheet"
- variant="filled"
- />
- <Button
- onPress={() => {
- setIsDialogActive(!isDialogActive);
- }}
- type="neutral"
- title="Open Local Dialog"
- variant="filled"
- />
- <Button
- title="Open Snackbar"
- variant="filled"
- type="danger"
- onPress={() => {
- NCoreUIKitSnackBar.open({
- title: "sdgdsgs",
- icon: ({
- color
- }) => <HomeIcon color={colors.content.icon[color ? color : "default"]}/>
- });
- }}
- />
- <Button
- onPress={() => {
- NCoreUIKitDialog.open({
- content: "etgweı09gı9w0eg",
- title: "Merhaba Dünya!",
- isVisible: true,
- onOverlayPress: ({
- closeAnimation
- }) => {
- closeAnimation();
- },
- variant: "info",
- secondaryButtonProps: {
- title: "sdfgsdg",
- onPress: () => {
- }
- },
- primaryButtonProps: {
- onPress: ({
- closeAnimation
- }) => {
- closeAnimation();
- }
- }
- });
- }}
- type="neutral"
- title="Open Dialog"
- variant="filled"
- />
- <Button
- title="Open Toast"
- variant="filled"
- type="warning"
- onPress={() => {
- NCoreUIKitToast.open({
- title: "sdgfsdgsdafs sdlşlgkdfşiklh",
- subTitle: "tr9uıdgfss 0dgklsd",
- isShowAction: true,
- icon: ({
- color
- }) => <HomeIcon color={colors.content.icon[color ? color : "default"]}/>
- });
- }}
- />
- </PageContainer>;
- };
- export default Home;
|