| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import {
- useLayoutEffect,
- useState,
- useRef
- } from "react";
- import {
- View
- } from "react-native";
- import stylesheet from "./stylesheet";
- import {
- NCoreUIKitLocalize,
- NCoreUIKitTheme,
- DateTimeSheet,
- PageContainer,
- CodeViewer,
- Header,
- Button,
- Text
- } from "ncore-ui-kit";
- import {
- useNavigation
- } from "@react-navigation/native";
- import type RootStackParamList from "../../../navigation/type";
- import type {
- NativeStackNavigationProp
- } from "@react-navigation/native-stack";
- import type {
- IBottomSheetRef
- } from "ncore-ui-kit";
- const DateTimeSheetPage = () => {
- const {
- localize
- } = NCoreUIKitLocalize.useContext();
- const {
- spaces
- } = NCoreUIKitTheme.useContext();
- const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
- const bottomSheetRef = useRef<IBottomSheetRef>(null);
- const [
- isActive,
- setIsActive
- ] = useState<boolean>(false);
- useLayoutEffect(() => {
- navigation.setOptions({
- header: () => <Header
- title={localize("components-dateTimeSheet")}
- isWrapSafeareaContext={false}
- navigation={navigation}
- isGoBackEnable={true}
- />,
- headerShown: true
- });
- }, []);
- return <PageContainer
- scrollViewProps={{
- contentContainerStyle: stylesheet.scrollContent
- }}
- isWorkWithHeaderSpace={false}
- scrollViewStyle={[
- stylesheet.container
- ]}
- isScrollable={true}
- >
- <View
- style={[
- stylesheet.contentContainer
- ]}
- >
- <Text
- style={stylesheet.descText}
- variant="bodyMediumSize"
- color="mid"
- >
- {localize("dateTimeSheet-desc")}
- </Text>
- <Text
- variant="titleMediumSize"
- style={stylesheet.title}
- >
- {localize("components-dateTimeSheet")}
- </Text>
- <Button
- onPress={() => setIsActive(true)}
- title="Open DateTime Sheet"
- spreadBehaviour="stretch"
- />
- <View
- style={{
- marginVertical: spaces.spacingMd
- }}
- >
- <Text
- style={{
- marginBottom: spaces.spacingSm
- }}
- variant="headlineSmallSize"
- >
- {localize("usage")}
- </Text>
- <CodeViewer
- code={"import {\n DateTimeSheet\n} from \"ncore-ui-kit\";\n\n<DateTimeSheet\n isActive={isActive}\n setIsActive={setIsActive}\n pickerType=\"date\"\n variant=\"single\"\n/>"}
- language="tsx"
- />
- </View>
- <DateTimeSheet
- cancel={() => setIsActive(false)}
- selectMultipleObject={() => {}}
- bottomSheetRef={bottomSheetRef}
- ok={() => setIsActive(false)}
- selectDateRule={() => {}}
- isWorkWithRealtime={true}
- setIsActive={setIsActive}
- dateTimePickerKey="test"
- selectObject={() => {}}
- isActive={isActive}
- pickerType="date"
- isLoading={false}
- clean={() => {}}
- variant="single"
- />
- </View>
- </PageContainer>;
- };
- export default DateTimeSheetPage;
|