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
4 changes: 4 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ function App() {
// animationType="slide" // optional, default is slide on ios/android and none on web
// startYear={2000} // optional, default is 1800
// endYear={2100} // optional, default is 2200
// allowEditing={false} // optional, default is true
// inputEnabled={false} // optional, default is true
/>

<DatePickerModal
Expand All @@ -327,6 +329,8 @@ function App() {
// animationType="slide" // optional, default is 'slide' on ios/android and 'none' on web
// startYear={2000} // optional, default is 1800
// endYear={2100} // optional, default is 2200
// allowEditing={false} // optional, default is true
// inputEnabled={false} // optional, default is true
/>

<DatePickerModal
Expand Down
2 changes: 1 addition & 1 deletion src/Date/DatePickerModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function DatePickerModalContent(
locale={locale}
editIcon={props?.editIcon}
calendarIcon={props.calendarIcon}
allowEditing={props.allowEditing || true}
allowEditing={props.allowEditing ?? true}
/>
</DatePickerModalHeaderBackground>
<AnimatedCrossView
Expand Down
6 changes: 2 additions & 4 deletions src/Date/DatePickerModalContentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export interface HeaderContentProps extends HeaderPickProps {
collapsed: boolean
onToggle: () => any
locale: string | undefined
inputDate?: boolean
}

function getLabel(
Expand Down Expand Up @@ -62,15 +61,14 @@ export default function DatePickerModalContentHeader(
uppercase,
editIcon,
calendarIcon,
inputDate,
allowEditing,
} = props
const theme = useTheme()
const label = getLabel(props.locale, props.mode, props.label)

const color = useHeaderTextColor()

const isAllowEditing = allowEditing && mode !== 'multiple' && inputDate !== undefined
const isEditingEnabled = allowEditing && mode !== 'multiple'

const supportingTextColor = theme.isV3 ? theme.colors.onSurfaceVariant : color

Expand Down Expand Up @@ -103,7 +101,7 @@ export default function DatePickerModalContentHeader(
</View>
</View>
<View style={styles.fill} />
{isAllowEditing ? (
{isEditingEnabled ? (
<IconButton
icon={
collapsed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ exports[`renders collapsed AnimatedCrossView 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
renderScrollComponent={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={[]}
style={
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/Date/__snapshots__/Calendar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ exports[`renders Calendar 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
renderScrollComponent={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={[]}
style={
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/Date/__snapshots__/YearPicker.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ exports[`renders YearPicker 1`] = `
onScrollEndDrag={[Function]}
removeClippedSubviews={false}
renderItem={[Function]}
renderScrollComponent={[Function]}
scrollEventThrottle={50}
stickyHeaderIndices={[]}
style={
Expand Down