Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function SingleDatePage() {
onConfirm={onChange}
saveLabel={'Save'} // optional
label={'Select period'} // optional
animationType={'slide'} // optional
/>
<Button onPress={()=> setVisible(true)}>
Pick date
Expand Down Expand Up @@ -107,6 +108,7 @@ export default function RangeDatePage() {
label={'Select period'} // optional
startLabel={'From'} // optional
endLabel={'To'} // optional
animationType={'slide'} // optional
/>
<Button onPress={()=> setVisible(true)}>
Pick range
Expand Down
8 changes: 8 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ function App({
label={'Select period'} // optional
startLabel={'From'} // optional
endLabel={'To'} // optional
animationType={Platform.select({
web: 'none',
default: 'slide',
})} // optional
/>
<DatePickerModal
mode="single"
Expand All @@ -115,6 +119,10 @@ function App({
onConfirm={onChangeSingle}
saveLabel={'Save'} // optional
label={'Select date'} // optional
animationType={Platform.select({
web: 'none',
default: 'slide',
})} // optional
/>

<TimePickerModal
Expand Down
5 changes: 3 additions & 2 deletions src/Date/DatePickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface DatePickerModalProps extends HeaderPickProps, BaseCalendarProps {
visible: boolean
onDismiss: () => any
inputFormat?: string
animationType?: 'slide' | 'fade' | 'none'
}

export type LocalState = {
Expand Down Expand Up @@ -57,7 +58,7 @@ export function DatePickerModal(
) {
const theme = useTheme()
const dimensions = useWindowDimensions()
const { visible, onDismiss, mode, onChange, onConfirm } = props
const { visible, onDismiss, mode, onChange, onConfirm, animationType } = props
const anyProps = props as any

// use local state to add only onConfirm state changes
Expand Down Expand Up @@ -101,7 +102,7 @@ export function DatePickerModal(

return (
<Modal
animationType="slide"
animationType={animationType}
transparent={true}
visible={visible}
onRequestClose={onDismiss}
Expand Down