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

gluestack-ui v2 InputField - Not accepting color changes to text and placeholder using className. #2609

Open
2 of 6 tasks
technologyconsulting opened this issue Nov 28, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@technologyconsulting
Copy link

Description

setting input field text color doesn't work. I should be able to set the color.

CodeSandbox/Snack link

https://I-do-not-know-how-to-set-gluestack-up-in-a-snack

Steps to reproduce

This is what i have and the text and placeholder colors do not work if i use className? If i use the style={{}} then they do?

<InputField`
type="text"
placeholder="Search"
className="h-12 text-pink-500 placeholder-pink-500"
style={{}}
 />

If I add a bg-pink-500 to color the background then the background color is set!

gluestack-ui Version

2

Platform

  • Expo
  • React Native CLI
  • Next
  • Web
  • Android
  • iOS

Other Platform

No response

Additional Information

Expo 52, react-native 0.76.3, nativewind 4.0.36, tailwindcss 3.4.15,

@technologyconsulting technologyconsulting added the bug Something isn't working label Nov 28, 2024
@technologyconsulting technologyconsulting changed the title glkuestack-ui v2 InputField - Not accepting color changes to text and placeholder using className. gluestack-ui v2 InputField - Not accepting color changes to text and placeholder using className. Nov 28, 2024
@technologyconsulting
Copy link
Author

Also, the placeholder text doesn't respect dark mode. The input border, icon and text does but not the placeholder text?

FYI - All my other components and gluestack ui elements are ok... So far.

@technologyconsulting
Copy link
Author

There seems to be something wrong with the way you're mapping the css properties. If i remove placeholder:text-typography-500 from the base: then using text-pink-500 and dark:text-yellow-500 in the className starts working.

Removed placeholder:text-typography-500 from the base: from the following code in the index.tsx.

const inputFieldStyle = tva({
  base: 'flex-1 text-typography-900 py-auto px-3  h-full ios:leading-[0px] web:cursor-text web:data-[disabled=true]:cursor-not-allowed',

  parentVariants: {
    variant: {
      underlined: 'web:outline-0 web:outline-none px-0',
      outline: 'web:outline-0 web:outline-none',
      rounded: 'web:outline-0 web:outline-none px-4',
    },

    size: {
      '2xs': 'text-2xs',
      xs: 'text-xs',
      sm: 'text-sm',
      md: 'text-base',
      lg: 'text-lg',
      xl: 'text-xl',
      '2xl': 'text-2xl',
      '3xl': 'text-3xl',
      '4xl': 'text-4xl',
      '5xl': 'text-5xl',
      '6xl': 'text-6xl',
    },
  },
})

However, I still can't use placeholder:text-pink-500 in my className and the placeholder text still doesn't respect dark mode by default.

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
Status: No status
Development

No branches or pull requests

2 participants