index.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. import {
  2. useImperativeHandle,
  3. forwardRef,
  4. useEffect,
  5. useState,
  6. type Ref,
  7. useRef
  8. } from "react";
  9. import {
  10. TouchableOpacity,
  11. View
  12. } from "react-native";
  13. import type IDateTimePickerProps from "./type";
  14. import type {
  15. DateTimePickerDateRange,
  16. DateTimePickerType,
  17. IDateTimePickerRef
  18. } from "./type";
  19. import stylesheet, {
  20. getDateTimePickerType,
  21. useStyles
  22. } from "./stylesheet";
  23. import {
  24. NCoreUIKitLocalize,
  25. NCoreUIKitTheme
  26. } from "../../core/hooks";
  27. import {
  28. type NCoreUIKitIcon
  29. } from "../../types";
  30. import type {
  31. IBottomSheetRef
  32. } from "../bottomSheet/type";
  33. import type ITextProps from "../text/type";
  34. import {
  35. type RRule as RRuleType,
  36. RRule
  37. } from "rrule";
  38. import moment from "moment";
  39. import {
  40. BadgeQuestionMarkIcon,
  41. BadgeSuccessIcon,
  42. BadgeDangerIcon,
  43. BadgeAlertIcon,
  44. BadgeInfoIcon,
  45. CleanIcon
  46. } from "../../assets/svg";
  47. import {
  48. uuid
  49. } from "../../utils";
  50. import Text from "../text";
  51. import DateTimeSheet from "../dateTimeSheet";
  52. import {
  53. parseRRuleConfig
  54. } from "../../helpers";
  55. const DateTimePickerTypeIcon: Record<Exclude<DateTimePickerType, "default">, NCoreUIKitIcon> = {
  56. "question": BadgeQuestionMarkIcon,
  57. "success": BadgeSuccessIcon,
  58. "warning": BadgeAlertIcon,
  59. "danger": BadgeDangerIcon,
  60. "info": BadgeInfoIcon
  61. };
  62. const DateTimePicker = ({
  63. renderLoadingIcon : LoadingIconComponentProp,
  64. rightIcon: RightIconComponentProp,
  65. localeBasedFirstDayOfWeek = true,
  66. hintTextIcon: HintTextIconProp,
  67. spreadBehaviour = "baseline",
  68. customDateTimeSheetLocalize,
  69. isShowTodayIndicator = true,
  70. titleFormat = "DD MMM YYYY",
  71. isShowDateTimeTools = true,
  72. isShowHintTextIcon = false,
  73. isWorkWithRealtime = true,
  74. dayOfWeekLength = "short",
  75. customDateTimeSheetTheme,
  76. pickerType = "date-time",
  77. icon: IconComponentProp,
  78. hintTextContainerStyle,
  79. removeSelectValidation,
  80. isCleanEnabled = false,
  81. contentContainerStyle,
  82. subTitle = "Optional",
  83. isSearchable = false,
  84. onFocus: onFocusProp,
  85. isRequired = false,
  86. isDisabled = false,
  87. onBlur: onBlurProp,
  88. dateTimeSheetProps,
  89. variant = "single",
  90. hintTextIconStyle,
  91. initialDateRange,
  92. type = "default",
  93. selectValidation,
  94. initialDateRule,
  95. dateRangeTitle,
  96. customLocalize,
  97. rightIconStyle,
  98. isShowSubTitle,
  99. cleanIconStyle,
  100. maxChoice = -1,
  101. contentStyle,
  102. initialDate,
  103. customTheme,
  104. placeholder,
  105. isOptional,
  106. customKey,
  107. minChoice,
  108. iconStyle,
  109. onChange,
  110. hintText,
  111. onCancel,
  112. maxDate,
  113. minDate,
  114. style,
  115. title,
  116. onOk
  117. }: IDateTimePickerProps, ref: Ref<IDateTimePickerRef>) => {
  118. const {
  119. inlineSpaces,
  120. typography,
  121. radiuses,
  122. borders,
  123. spaces,
  124. colors
  125. } = NCoreUIKitTheme.useContext(customTheme);
  126. const {
  127. rruleConfig,
  128. localize
  129. } = NCoreUIKitLocalize.useContext(customLocalize);
  130. const bottomSheetRef = useRef<IBottomSheetRef>(null);
  131. const dateTimePickerKey = useRef(customKey ? customKey : uuid());
  132. const currentType = getDateTimePickerType({
  133. type
  134. });
  135. const styleType = type === "default" ? "neutral" : type === "question" ? "neutral" : type === "danger" ? "error" : type;
  136. const [
  137. isActive,
  138. setIsActive
  139. ] = useState(false);
  140. const [
  141. isLoading,
  142. setIsLoading
  143. ] = useState(false);
  144. const [
  145. tempDate,
  146. setTempDate
  147. ] = useState<Date | undefined>(initialDate);
  148. const [
  149. date,
  150. setDate
  151. ] = useState<Date | undefined>(initialDate);
  152. const [
  153. tempDateRule,
  154. setTempDateRule
  155. ] = useState<RRuleType | undefined>(initialDateRule);
  156. const [
  157. dateRule,
  158. setDateRule
  159. ] = useState<RRuleType | undefined>(initialDateRule);
  160. const [
  161. dateRange,
  162. setDateRange
  163. ] = useState<DateTimePickerDateRange | undefined>(initialDateRange);
  164. const [
  165. tempDateRange,
  166. setTempDateRange
  167. ] = useState<DateTimePickerDateRange | undefined>(initialDateRange);
  168. const mainDateRange = isWorkWithRealtime ? dateRange : tempDateRange;
  169. const mainDateRule = isWorkWithRealtime ? dateRule : tempDateRule;
  170. const mainDate = isWorkWithRealtime ? date : tempDate;
  171. const {
  172. contentContainer: contentContainerDynamicStyle,
  173. titleContainer: titleContainerDynamicStyle,
  174. hintTextIcon: hintTextIconDynamicStyle,
  175. contentText: contentTextDynamicStyle,
  176. cleanButton: cleanButtonDynamicStyle,
  177. rightIcon: rightIconDynamicStyle,
  178. container: containerDynamicStyle,
  179. hintText: hintTextDynamicStyle,
  180. required: requiredDynamicStyle,
  181. subTitle: subTitleDynamicStyle,
  182. overlay: overlayDynamicStyle,
  183. content: contentDynamicStyle,
  184. title: titleDynamicStyle,
  185. icon: iconDynamicStyle
  186. } = useStyles({
  187. icon: IconComponentProp ? true : false,
  188. spreadBehaviour,
  189. inlineSpaces,
  190. isSearchable,
  191. currentType,
  192. isDisabled,
  193. isActive,
  194. radiuses,
  195. borders,
  196. spaces,
  197. colors,
  198. title,
  199. type
  200. });
  201. useImperativeHandle(
  202. ref,
  203. () => ({
  204. setDateRange: (dateRange) => {
  205. if(isWorkWithRealtime) {
  206. setDateRange(dateRange);
  207. } else {
  208. setTempDateRange(dateRange);
  209. }
  210. },
  211. setDateRule: (dateRule) => {
  212. if(isWorkWithRealtime) {
  213. setDateRule(dateRule);
  214. } else {
  215. setTempDateRule(dateRule);
  216. }
  217. },
  218. setDate: (date) => {
  219. if(isWorkWithRealtime) {
  220. setDate(date);
  221. } else {
  222. setTempDate(date);
  223. }
  224. },
  225. getValue: () => {
  226. return {
  227. dateRange,
  228. dateRule,
  229. date
  230. };
  231. },
  232. cancel,
  233. clean,
  234. focus,
  235. blur,
  236. ok
  237. }),
  238. [
  239. dateRange,
  240. dateRule,
  241. date
  242. ]
  243. );
  244. useEffect(() => {
  245. if(isActive) {
  246. if(onFocus) onFocus();
  247. } else {
  248. if(!isWorkWithRealtime) {
  249. setTempDateRange(undefined);
  250. setTempDateRule(undefined);
  251. setTempDate(undefined);
  252. }
  253. if(onBlur) onBlur();
  254. }
  255. }, [
  256. isActive
  257. ]);
  258. useEffect(() => {
  259. if(onChange) {
  260. onChange({
  261. dateRange,
  262. dateRule,
  263. date
  264. });
  265. }
  266. }, [
  267. tempDateRange,
  268. tempDateRule,
  269. dateRange,
  270. dateRule,
  271. tempDate,
  272. date
  273. ]);
  274. const titleProps: ITextProps = {
  275. color: currentType.titleColor,
  276. variant: "bodyLargeSize"
  277. };
  278. const iconProps: NCoreUIKit.IconCallbackProps = {
  279. size: Number(typography.labelLargeSize.fontSize) + 6,
  280. color: currentType.iconColor
  281. };
  282. if(isDisabled) {
  283. iconProps.color = "disabled";
  284. }
  285. const blur = () => {
  286. setIsActive(false);
  287. };
  288. const focus = () => {
  289. if(!isWorkWithRealtime) {
  290. setTempDateRange(dateRange);
  291. setTempDateRule(dateRule);
  292. setTempDate(date);
  293. }
  294. setIsActive(true);
  295. };
  296. const cancel = () => {
  297. if(!isWorkWithRealtime) {
  298. bottomSheetRef.current?.close(() => {
  299. blur();
  300. });
  301. if(onCancel) {
  302. onCancel({
  303. dateRange,
  304. dateRule,
  305. date
  306. });
  307. }
  308. }
  309. };
  310. const ok = () => {
  311. if(!isWorkWithRealtime) {
  312. setDateRange(tempDateRange);
  313. setDateRule(tempDateRule);
  314. setDate(tempDate);
  315. bottomSheetRef.current?.close(() => {
  316. blur();
  317. });
  318. if(onOk) {
  319. onOk({
  320. dateRange,
  321. dateRule,
  322. date
  323. });
  324. }
  325. }
  326. };
  327. const clean = () => {
  328. setDateRange(undefined);
  329. setDateRule(undefined);
  330. setDate(undefined);
  331. setTempDateRange(undefined);
  332. setTempDateRule(undefined);
  333. setTempDate(undefined);
  334. };
  335. const selectDateRule = (selectedDateRule?: RRule) => {
  336. if(variant === "rrule") {
  337. if(selectedDateRule && selectedDateRule !== dateRule) {
  338. if(selectValidation) {
  339. if(selectValidation({
  340. dateRule: selectedDateRule
  341. })) {
  342. if(isWorkWithRealtime) {
  343. setDateRule(selectedDateRule);
  344. } else {
  345. setTempDateRule(selectedDateRule);
  346. }
  347. }
  348. } else {
  349. if(isWorkWithRealtime) {
  350. setDateRule(selectedDateRule);
  351. } else {
  352. setTempDateRule(selectedDateRule);
  353. }
  354. }
  355. } else {
  356. if(removeSelectValidation) {
  357. if(removeSelectValidation({
  358. dateRule
  359. })) {
  360. setTempDateRule(undefined);
  361. setDateRule(undefined);
  362. }
  363. } else {
  364. setTempDateRule(undefined);
  365. setDateRule(undefined);
  366. }
  367. }
  368. }
  369. };
  370. const selectMultipleObject = (selectedDateRange?: {
  371. start?: Date;
  372. end?: Date;
  373. }) => {
  374. if(variant === "range") {
  375. if(selectedDateRange) {
  376. if(selectValidation) {
  377. if(selectValidation({
  378. dateRule
  379. })) {
  380. if(isWorkWithRealtime) {
  381. setDateRange({
  382. start: selectedDateRange.start,
  383. end: selectedDateRange.end
  384. });
  385. } else {
  386. setTempDateRange({
  387. start: selectedDateRange.start,
  388. end: selectedDateRange.end
  389. });
  390. }
  391. }
  392. } else {
  393. if(isWorkWithRealtime) {
  394. setDateRange({
  395. start: selectedDateRange.start,
  396. end: selectedDateRange.end
  397. });
  398. } else {
  399. setTempDateRange({
  400. start: selectedDateRange.start,
  401. end: selectedDateRange.end
  402. });
  403. }
  404. }
  405. } else {
  406. if(removeSelectValidation) {
  407. if(removeSelectValidation({
  408. dateRange: selectedDateRange
  409. })) {
  410. setTempDateRange(undefined);
  411. setDateRange(undefined);
  412. }
  413. } else {
  414. setTempDateRange(undefined);
  415. setDateRange(undefined);
  416. }
  417. }
  418. }
  419. };
  420. const selectObject = (selectedDate?: Date) => {
  421. if(variant === "single") {
  422. if(selectedDate === date) {
  423. if(removeSelectValidation) {
  424. if(removeSelectValidation({
  425. date
  426. })) {
  427. if(isWorkWithRealtime) {
  428. setDate(undefined);
  429. } else {
  430. setTempDate(undefined);
  431. }
  432. }
  433. } else {
  434. if(isWorkWithRealtime) {
  435. setDate(undefined);
  436. } else {
  437. setTempDate(undefined);
  438. }
  439. }
  440. } else {
  441. if(selectValidation) {
  442. if(selectValidation({
  443. date
  444. })) {
  445. if(isWorkWithRealtime) {
  446. setDate(selectedDate);
  447. } else {
  448. setTempDate(selectedDate);
  449. }
  450. }
  451. } else {
  452. if(isWorkWithRealtime) {
  453. setDate(selectedDate);
  454. } else {
  455. setTempDate(selectedDate);
  456. }
  457. }
  458. }
  459. }
  460. };
  461. const onFocus = () => {
  462. if(onFocusProp) onFocusProp();
  463. };
  464. const onBlur = () => {
  465. if(onBlurProp) onBlurProp();
  466. };
  467. const renderCleanButton = () => {
  468. if(isDisabled) {
  469. return null;
  470. }
  471. if(!isCleanEnabled) {
  472. return null;
  473. }
  474. if(variant === "rrule") {
  475. if(!mainDateRule) return null;
  476. } else if(variant === "range") {
  477. if(!dateRange) return null;
  478. } else {
  479. if(!date) return null;
  480. }
  481. return <TouchableOpacity
  482. style={[
  483. cleanIconStyle,
  484. stylesheet.cleanButton,
  485. cleanButtonDynamicStyle
  486. ]}
  487. onPress={() => {
  488. setDateRange(undefined);
  489. setDateRule(undefined);
  490. setDate(undefined);
  491. setTempDateRange(undefined);
  492. setTempDateRule(undefined);
  493. setTempDate(undefined);
  494. }}
  495. >
  496. <CleanIcon
  497. color="mid"
  498. size={20}
  499. />
  500. </TouchableOpacity>;
  501. };
  502. const renderIcon = () => {
  503. if (!IconComponentProp) {
  504. return null;
  505. }
  506. return <View
  507. style={[
  508. iconStyle,
  509. stylesheet.icon,
  510. iconDynamicStyle
  511. ]}
  512. >
  513. <IconComponentProp
  514. color={iconProps.color}
  515. size={iconProps.size}
  516. />
  517. </View>;
  518. };
  519. const renderRightIcon = () => {
  520. if (!RightIconComponentProp) {
  521. return null;
  522. }
  523. if(isCleanEnabled) {
  524. return null;
  525. }
  526. if(variant === "rrule") {
  527. if(!mainDateRule) return null;
  528. } else if(variant === "range") {
  529. if(!mainDateRange) return null;
  530. } else {
  531. if(!mainDate) return null;
  532. }
  533. return <View
  534. style={[
  535. rightIconStyle,
  536. stylesheet.rightIcon,
  537. rightIconDynamicStyle
  538. ]}
  539. >
  540. <RightIconComponentProp
  541. color={iconProps.color}
  542. size={iconProps.size}
  543. />
  544. </View>;
  545. };
  546. const renderHintIcon = () => {
  547. if(!isShowHintTextIcon) {
  548. return null;
  549. }
  550. if(HintTextIconProp) {
  551. return <HintTextIconProp
  552. color={isDisabled ? "disabled" : currentType.hintTextIconColor}
  553. size={20}
  554. style={[
  555. hintTextIconStyle,
  556. stylesheet.hintTextIcon,
  557. hintTextIconDynamicStyle
  558. ]}
  559. />;
  560. }
  561. const CurrentHintIcon = DateTimePickerTypeIcon[type === "default" ? "question" : type];
  562. return <CurrentHintIcon
  563. customColor={isDisabled ? colors.system.state.content.disabled[styleType] : undefined}
  564. color={currentType.hintTextIconColor}
  565. size={20}
  566. style={[
  567. hintTextIconStyle,
  568. stylesheet.hintTextIcon,
  569. hintTextIconDynamicStyle
  570. ]}
  571. />;
  572. };
  573. const renderHintText = () => {
  574. if (!hintText) {
  575. return null;
  576. }
  577. return <View
  578. style={[
  579. hintTextContainerStyle,
  580. stylesheet.hintText,
  581. hintTextDynamicStyle
  582. ]}
  583. >
  584. {renderHintIcon()}
  585. <Text
  586. customColor={isDisabled ? colors.system.state.content.disabled[styleType] : undefined}
  587. color={currentType.hintTextColor}
  588. variant="labelSmallSize"
  589. >
  590. {hintText}
  591. </Text>
  592. </View>;
  593. };
  594. const renderRequired = () => {
  595. if(!isRequired) {
  596. return null;
  597. }
  598. return <Text
  599. color="danger"
  600. style={[
  601. stylesheet.required,
  602. requiredDynamicStyle
  603. ]}
  604. >*</Text>;
  605. };
  606. const renderSubtitle = () => {
  607. if(!isShowSubTitle && !isOptional) {
  608. return null;
  609. }
  610. return <Text
  611. variant="labelLargeSize"
  612. color={titleProps.color}
  613. style={[
  614. stylesheet.subTitle,
  615. subTitleDynamicStyle
  616. ]}
  617. >
  618. ( {isOptional ? localize("is-optional") : subTitle} )
  619. </Text>;
  620. };
  621. const renderTitle = () => {
  622. if (!title) {
  623. return null;
  624. }
  625. return <TouchableOpacity
  626. style={[
  627. stylesheet.titleContainer,
  628. titleContainerDynamicStyle
  629. ]}
  630. onPress={() => {
  631. if(!isDisabled) {
  632. focus();
  633. }
  634. }}
  635. >
  636. {renderRequired()}
  637. <Text
  638. {...titleProps}
  639. variant={titleProps.variant}
  640. color={titleProps.color}
  641. style={[
  642. stylesheet.title,
  643. titleDynamicStyle
  644. ]}
  645. >
  646. {title}
  647. </Text>
  648. {renderSubtitle()}
  649. </TouchableOpacity>;
  650. };
  651. const renderDateValue = () => {
  652. if(!date) {
  653. return <Text
  654. variant="labelLargeSize"
  655. numberOfLines={1}
  656. style={[
  657. stylesheet.contentText,
  658. contentTextDynamicStyle
  659. ]}
  660. >
  661. {placeholder ? placeholder : localize("select-any-date")}
  662. </Text>;
  663. }
  664. return <Text
  665. variant="labelLargeSize"
  666. numberOfLines={1}
  667. style={[
  668. stylesheet.contentText,
  669. contentTextDynamicStyle
  670. ]}
  671. >
  672. {moment(date).format(titleFormat)}
  673. </Text>;
  674. };
  675. const renderDateRangeValue = () => {
  676. if(!dateRange) {
  677. return <Text
  678. variant="labelLargeSize"
  679. numberOfLines={1}
  680. style={[
  681. stylesheet.contentText,
  682. contentTextDynamicStyle
  683. ]}
  684. >
  685. {placeholder ? placeholder : localize("select-any-date")}
  686. </Text>;
  687. }
  688. if(dateRangeTitle) {
  689. return dateRangeTitle(dateRange);
  690. }
  691. return <Text
  692. variant="labelLargeSize"
  693. numberOfLines={1}
  694. style={[
  695. stylesheet.contentText,
  696. contentTextDynamicStyle
  697. ]}
  698. >
  699. {moment(dateRange.start).format(titleFormat)} - {moment(dateRange.end).format(titleFormat)}
  700. </Text>;
  701. };
  702. const renderDateRuleValue = () => {
  703. if(!dateRule) {
  704. return <Text
  705. variant="labelLargeSize"
  706. numberOfLines={1}
  707. style={[
  708. stylesheet.contentText,
  709. contentTextDynamicStyle
  710. ]}
  711. >
  712. {placeholder ? placeholder : localize("select-any-date")}
  713. </Text>;
  714. }
  715. return <Text
  716. variant="labelLargeSize"
  717. numberOfLines={1}
  718. style={[
  719. stylesheet.contentText,
  720. contentTextDynamicStyle
  721. ]}
  722. >
  723. {dateRule.toText(undefined, parseRRuleConfig(rruleConfig))}
  724. </Text>;
  725. };
  726. const renderValue = () => {
  727. if(variant === "rrule") {
  728. return renderDateRuleValue();
  729. }
  730. if(variant === "range") {
  731. return renderDateRangeValue();
  732. }
  733. return renderDateValue();
  734. };
  735. const renderContent = () => {
  736. return <View
  737. style={[
  738. contentStyle,
  739. stylesheet.content,
  740. contentDynamicStyle
  741. ]}
  742. >
  743. {renderValue()}
  744. </View>;
  745. };
  746. const renderOverlay = () => {
  747. return <View
  748. style={[
  749. stylesheet.overlay,
  750. overlayDynamicStyle
  751. ]}
  752. />;
  753. };
  754. return <View
  755. style={[
  756. style,
  757. stylesheet.container,
  758. containerDynamicStyle
  759. ]}
  760. >
  761. {renderTitle()}
  762. <TouchableOpacity
  763. disabled={isDisabled}
  764. style={[
  765. contentContainerStyle,
  766. stylesheet.contentContainer,
  767. contentContainerDynamicStyle
  768. ]}
  769. onPress={() => {
  770. if(!isDisabled) {
  771. focus();
  772. }
  773. }}
  774. >
  775. {renderOverlay()}
  776. {renderIcon()}
  777. {renderContent()}
  778. {renderCleanButton()}
  779. {renderRightIcon()}
  780. </TouchableOpacity>
  781. {renderHintText()}
  782. <DateTimeSheet
  783. localeBasedFirstDayOfWeek={localeBasedFirstDayOfWeek}
  784. LoadingIconComponentProp={LoadingIconComponentProp}
  785. dateTimePickerKey={dateTimePickerKey.current}
  786. customLocalize={customDateTimeSheetLocalize}
  787. selectMultipleObject={selectMultipleObject}
  788. isShowTodayIndicator={isShowTodayIndicator}
  789. isWorkWithRealtime={isWorkWithRealtime}
  790. customTheme={customDateTimeSheetTheme}
  791. isShowTools={isShowDateTimeTools}
  792. dayOfWeekLength={dayOfWeekLength}
  793. selectDateRule={selectDateRule}
  794. bottomSheetRef={bottomSheetRef}
  795. selectObject={selectObject}
  796. setIsLoading={setIsLoading}
  797. setDateRange={setDateRange}
  798. setIsActive={setIsActive}
  799. setDateRule={setDateRule}
  800. bottomSheetProps={{
  801. isAutoHeight: true,
  802. ...dateTimeSheetProps
  803. }}
  804. dateRange={mainDateRange}
  805. pickerType={pickerType}
  806. maxChoice={maxChoice}
  807. minChoice={minChoice}
  808. isLoading={isLoading}
  809. dateRule={dateRule}
  810. isActive={isActive}
  811. variant={variant}
  812. maxDate={maxDate}
  813. minDate={minDate}
  814. date={mainDate}
  815. cancel={cancel}
  816. clean={clean}
  817. title={title}
  818. ok={ok}
  819. />
  820. </View>;
  821. };
  822. export default forwardRef(DateTimePicker);