Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DatePickerInputWithoutModal.tsx #373

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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 @@
withDateFormatInLabel = true,
hasError,
hideValidationErrors,
showHelperTextOnError,
onValidationError,
modal,
inputButton,
Expand Down Expand Up @@ -100,11 +101,13 @@
inputButton={inputButton}
/>
</View>
{error && !hideValidationErrors ? (
<HelperText type="error" visible={!!error}>
{error}
</HelperText>
) : null}
{!!!showHelperTextOnError || !!hasError ? (

Check warning on line 104 in src/Date/DatePickerInputWithoutModal.tsx

View workflow job for this annotation

GitHub Actions / lint

Redundant double negation
!hideValidationErrors ? (
<HelperText type="error" visible={!!error}>
{error}
</HelperText>
) : null
): null}

Check failure on line 110 in src/Date/DatePickerInputWithoutModal.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
</View>
{modal?.({
value,
Expand Down Expand Up @@ -140,8 +143,6 @@

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