web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
654 stars 170 forks source link

Unnecessary White Spacing #163

Closed samharvey44 closed 2 years ago

samharvey44 commented 2 years ago

The 'DatePickerInput' renders with HelperText, which causes empty white space to appear below the element. The 'visible' prop on HelperText does not determine whether it renders - it just either hides or shows it.

It should instead conditionally render the HelperText, so that it only mounts when necessary.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-paper-dates/src/Date/DatePickerInput.tsx b/node_modules/react-native-paper-dates/src/Date/DatePickerInput.tsx
index 541ab98..8fd3998 100644
--- a/node_modules/react-native-paper-dates/src/Date/DatePickerInput.tsx
+++ b/node_modules/react-native-paper-dates/src/Date/DatePickerInput.tsx
@@ -86,9 +86,12 @@ function DatePickerInput(
           />
         ) : null}
       </View>
-      <HelperText type="error" visible={!!error}>
-        {error}
-      </HelperText>
+
+      {!!error && (
+          <HelperText type="error">
+              {error}
+          </HelperText>
+      )}

       {withModal ? (
         <DatePickerModal

This issue body was partially generated by patch-package.

CosminGRG commented 2 years ago

I suppose this is what you are speaking about. The fix above doesn't seem to work for me image

samharvey44 commented 2 years ago

I suppose this is what you are speaking about. The fix above doesn't seem to work for me image

Hi there,

No, I think your issue is a different one.

Mine is related to a small amount of white space caused by a redundant helpertext component being rendered - not the amount of space you are showing.

RichardLindhout commented 2 years ago

Ok, I've added this!

hfllr commented 7 months ago

I'm experiencing the exact same problem in the most recent version 0.21.7 No way to get rid of the white-spacing