question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextField type='date' does not display correctly on mobile

See original GitHub issue

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Other

How is your app built?

create react app

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Please describe your bug.

TextField does not display correctly on android chrome when type is date the field becomes visually split into 3 rows start, text, end image

What’s the expected behaviour?

The field should display similarly to how it appears on a desktop ie on a single row image

Help us reproduce the bug!

Bug can be seen in this minimal app https://main.d3nu6n3lsn8380.amplifyapp.com/

source at https://github.com/MigeBill/date-issue

Code Snippet

// Put your code below this line.
export function App() {

  return (

      <View>
        <Text variation='primary'>amplify textfield date</Text>
        <TextField type='date' label=''></TextField>

        <Text>html input date</Text>
        <input type='date'></input>              

      </View>

  );

}```


### Additional information and screenshots

_No response_

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MigeBillcommented, Sep 23, 2022

@hbuchel thanks, that work around is a great improvement 😃

@Anyone, minor typo in above workaround, closing ] is missing

input[type="date"] {
  display: inline-flex
}
0reactions
hbuchelcommented, Sep 27, 2022

@MigeBill Just an initial update, there is some difference with the display value for the native browser date picker between desktop and mobile. A sort of workaround (at least specific to Chrome) while we work on a fix is re-setting the display in some additional CSS like below:

input[type="date"] {
  display: inline-flex
}

Stackblitz example

It does not show the typical dropdown arrow like the native unstyled date picker does; or on desktop how it shows the native browser’s calendar icon. On our side, we need to make some decisions about how we treat the missing appearance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Date input doesn't show properly in Mobile - Stack Overflow
1. The appearance of the <input type="date"> varies between browsers. If you want it to look the same, you can either try to...
Read more >
Date field is not displaying correctly in mobile view - Jotform
Hello,. In my form I am clicking the "Preview Form" button and am selecting the "Phone" view with the vertical (default) orientation.
Read more >
input[type=date] with empty value shrunken height on mobile
On iPad, an input of type date that doesn't have any initial value appear smaller until touched or a date selected.
Read more >
Date and time picker not showing on mobile phone
You have onfocus and onblur events available on both date and time input, and field type is changing from date to text on...
Read more >
<input type="date"> - HTML: HyperText Markup Language
By default, <input type="date"> doesn't validate the entered value beyond its format. The interfaces generally don't let you enter anything that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found