Skip to content
Closed
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
14 changes: 11 additions & 3 deletions docusaurus/docs/date-picker/input-date-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,21 @@ Limits which dates the user can navigate to and where events can go. Dates outsi
`Type: boolean | undefined`
Flag indicating if the date format should be inside the components label.

**withModal**
`Type: boolean | undefined`
Flag indicating if the `datepicker` component is available from the input.

**hasError**
`Type: boolean | undefined`
Flag indicating if the the component should display error styles.
Flag indicating if the component should display error styles.

**hideValidationErrors**
`Type: boolean | undefined`
Flag indicating if the the component should hide error styles along with the `helperText` component displaying the error message.
Flag indicating if the component should hide error styles along with the `helperText` component displaying the error message.

**showHelperTextOnError**
`Type: boolean | undefined`
Flag indicating if the `helperText` component should be hidden if there is an error or always (hide empty line caused by empty`helperText` component).

**onValidationError**
`Type: Function | undefined`
Expand Down Expand Up @@ -128,7 +136,7 @@ Flag indicating if the component should be enabled or not. Behavior similarly to
Flag indicating if the status bar padding should be enabled or not. Defaults to `false`.

**presentationStyle**
`Type: 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'`
`Type: ''pageSheet' | 'overFullScreen'`
Determines the visual presentation style of the date picker modal. This prop allows you to define how the modal appears on the screen when it is displayed.

- `'fullScreen'`: Presents the modal as a full-screen overlay.
Expand Down
1 change: 1 addition & 0 deletions src/Date/DatePickerInput.shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type DatePickerInputProps = {
withModal?: boolean
withDateFormatInLabel?: boolean
hideValidationErrors?: boolean
showHelperTextOnError?: boolean
hasError?: boolean
onValidationError?: ((error: string | null) => void) | undefined
calendarIcon?: string
Expand Down
15 changes: 8 additions & 7 deletions src/Date/DatePickerInputWithoutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function DatePickerInputWithoutModal(
withDateFormatInLabel = true,
hasError,
hideValidationErrors,
showHelperTextOnError,
onValidationError,
modal,
inputButton,
Expand Down Expand Up @@ -100,11 +101,13 @@ function DatePickerInputWithoutModal(
inputButton={inputButton}
/>
</View>
{error && !hideValidationErrors ? (
<HelperText type="error" visible={!!error}>
{error}
</HelperText>
) : null}
{!!!showHelperTextOnError || !!hasError ? (
!hideValidationErrors ? (
<HelperText type="error" visible={!!error}>
{error}
</HelperText>
) : null
): null}
</View>
{modal?.({
value,
Expand Down Expand Up @@ -140,8 +143,6 @@ function getLabel({

const styles = StyleSheet.create({
root: {
flex: 1,
flexGrow: 1,
justifyContent: 'center',
alignItems: 'flex-start',
width: '100%',
Expand Down