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

Label background is slightly mispositioned on web #4041

Closed
eugeneford opened this issue Aug 25, 2023 · 3 comments · Fixed by #4084
Closed

Label background is slightly mispositioned on web #4041

eugeneford opened this issue Aug 25, 2023 · 3 comments · Fixed by #4084
Labels

Comments

@eugeneford
Copy link

Current behaviour

The background element for input label is slightly mispositioned on Web.

Preview

image

What have you tried so far?

I've managed to get a workaround by making a wrapper for TextInput component to add custom styles specifically for Web:

<>
  <MaterialTextInput
    mode={mode}
    textColor={textColor}
    activeOutlineColor={activeOutlineColor}
    style={[
      {backgroundColor: "#fff"},
      style,
    ]}
    {...rest}
  />
  {Platform.OS === "web" && (
    createElement("style", {
      dangerouslySetInnerHTML: {
        __html: `
        [data-testid="text-input-outlined-label-background"] {
          margin-top: -2px;
        }`
      }
    })
  )}
</>
@eugeneford eugeneford added the bug label Aug 25, 2023
@RichardLindhout
Copy link
Contributor

It's only on latest react-native-web i downgraded for now to 0.18

@davidascii
Copy link

Duplicate of #3825

@davidascii
Copy link

Another possible workaround

<TextInputPaper
    mode="outlined"
    ...
    outlineStyle={{...(Platform.OS === 'web' && {marginTop: '2px'})}}
/>

I've tried manually changing the 'top' value of the label by -2, and it also fixes(?) the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants