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

Date input field no longer responds to width changes on web #324

Closed
JPStrydom opened this issue Sep 4, 2023 · 8 comments · Fixed by #329
Closed

Date input field no longer responds to width changes on web #324

JPStrydom opened this issue Sep 4, 2023 · 8 comments · Fixed by #329
Labels
bug Something isn't working

Comments

@JPStrydom
Copy link
Contributor

Current behaviour

When running on web (with React Native Web) the DateInputField does not scale to the width of it's parent container, where it used to do so.

Here is the behavior on version 0.18.19:
rnpd-new

Expected behaviour

The DateInputField should respond to width changes on web.

Here is the behavior on version 0.18.14:
rnpd-old

How to reproduce?

Place the DateInputField in a View that scales to 100% of available width:

<View style={{ width : '100%' }}>
  <DatePickerInput {...props}  />  
</View>

What have you tried so far?

Changing the following code in src/Date/DatePickerInputWithoutModal.tsx seems to fix the issue:

const styles = StyleSheet.create({
  root: {
    flexGrow: 1,
    width: '100%', // Adding this to all these styles fixes the issue
    justifyContent: 'center',
    alignItems: 'flex-start',
  },
  inputContainer: {
    flexGrow: 1,
    width: '100%', // Adding this to all these styles fixes the issue
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'flex-start',
  },
  input: {
    flexGrow: 1,
    width: '100%', // Adding this to all these styles fixes the issue
  },
})

Your Environment

software version
react-native 0.71.8
react-native-paper ^5.10.3
react-native-web ~0.18.12
node 18.16.0
npm 9.5.1
expo sdk ^48.0.20
@JPStrydom JPStrydom added the bug Something isn't working label Sep 4, 2023
@JPStrydom
Copy link
Contributor Author

I've created a PR which should address this issue.

@iM-GeeKy
Copy link
Collaborator

iM-GeeKy commented Sep 6, 2023

@JPStrydom

simulator_screenshot_D84F4DBF-CCCD-491B-A301-57B78A5682E1

Screenshot 2023-09-06 at 2 14 52 PM

Here is a code snipped in the example app on our repo.

<View
  style={[
    {
      alignItems: 'center',
      flexDirection: 'row',
      marginTop: 16,
    },
  ]}
>
  // This could be an icon or any other view...
  <Button>Test</Button>
  <DatePickerInput
    locale={locale}
    value={inputDate}
    onChange={setInputDate}
    inputMode="start"
    autoComplete={'birthdate-full'}
    style={styles.marginBottomEight}
  />
</View>

@JPStrydom
Copy link
Contributor Author

I've created a PR which should address this issue.

This PR looks like it did the trick 👍

Going to close this for now. Happy to reopen it if anyone has any issues with it.

@SoyDiego
Copy link
Contributor

SoyDiego commented Sep 9, 2023

Hi @JPStrydom, your PR was working good in your use case, but has problem in Mobile (check the images of @iM-GeeKy above).

I have created a new PR: #329
If you can check it too, would be perfect to test all devices and ways.
I think with my code I solved both issues:

  • When we have a element on the left.
  • The responsiveness in Web.

I hope be the correct solution, If not, we will continue researching.

@iM-GeeKy maybe you should open this issue until we solve it :)

@JPStrydom
Copy link
Contributor Author

I'll take a look at the new version today and confirm if it's still working on web 👍

@SoyDiego
Copy link
Contributor

I'll take a look at the new version today and confirm if it's still working on web 👍

Great, I will wait.
Thanks

@JPStrydom
Copy link
Contributor Author

I'll take a look at the new version today and confirm if it's still working on web 👍

Looks like all is still in order on the web version 👍

@SoyDiego
Copy link
Contributor

Great, thanks for your confirmation. Happy all is working ok 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants