// @flow import * as React from 'react'; import {Button, Caption, Card, Headline, Paragraph, withTheme} from 'react-native-paper'; import {Collapsible} from "react-navigation-collapsible"; import {withCollapsible} from "../../../utils/withCollapsible"; import {StackNavigationProp} from "@react-navigation/stack"; import type {CustomTheme} from "../../../managers/ThemeManager"; import type {Device} from "./EquipmentListScreen"; import {Animated, View} from "react-native"; import i18n from "i18n-js"; import {getRelativeDateString} from "../../../utils/EquipmentBooking"; type Props = { navigation: StackNavigationProp, route: { params?: { item?: Device, dates: [string, string] }, }, theme: CustomTheme, collapsibleStack: Collapsible, } class EquipmentConfirmScreen extends React.Component { item: Device | null; dates: [string, string] | null; constructor(props: Props) { super(props); if (this.props.route.params != null) { if (this.props.route.params.item != null) this.item = this.props.route.params.item; else this.item = null; if (this.props.route.params.dates != null) this.dates = this.props.route.params.dates; else this.dates = null; } } render() { const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack; const item = this.item; const dates = this.dates; if (item != null && dates != null) { const start = new Date(dates[0]); const end = new Date(dates[1]); return ( {item.name} ({i18n.t('screens.equipment.bail', {cost: item.caution})}) {i18n.t("screens.equipment.bookingConfirmedMessage")} ); } else return null; } } export default withCollapsible(withTheme(EquipmentConfirmScreen));