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

Unable to Style Input Component via Theme Configuration #22

Open
omar-bear opened this issue Feb 14, 2024 · 1 comment
Open

Unable to Style Input Component via Theme Configuration #22

omar-bear opened this issue Feb 14, 2024 · 1 comment

Comments

@omar-bear
Copy link
Contributor

Description

I am unable to style the Input component from the theme.

After looking through the Ficus UI codebase and examining the useDefaultProps hook, which is supposed to grab the Input component's style from the theme, I styled the Input in the following way:

import { InputProps } from 'react-native-ficus-ui';
import foundations from '@/theme/foundations';

export default {
  name: 'light',
  ...foundations,
  components: {
    // ...other components
    Input: {
      variant: 'default',
      variants: {
        default: {
          colorScheme: 'gray',
          bg: 'gray.50',
          borderColor: 'gray.200',
          borderWidth: 1,
          focusBorderWidth: 2,
          borderRadius: 'full',
          focusBorderColor: 'success.600',
          placeholderTextColor: 'gray.400',
        } as InputProps,
      },
    },
    // ...other components
  },
};

I also tried directly like this:

import { InputProps } from 'react-native-ficus-ui';
import foundations from '@/theme/foundations';

export default {
  name: 'light',
  ...foundations,
  components: {
    // ...other components
    Input: {
      colorScheme: 'gray',
      bg: 'gray.50',
      borderColor: 'gray.200',
      borderWidth: 1,
      focusBorderWidth: 2,
      borderRadius: 'full',
      focusBorderColor: 'success.600',
      placeholderTextColor: 'gray.400',
    },
    // ...other components
  },
};

However, it's still not working.

@ntorionbearstudio
Copy link
Contributor

Can you test again please @omar-bear?

It's working when I try this for example :

<ThemeProvider
      theme={{
        components: {
          Input: {
            bg: 'red.50',
            borderColor: 'red.200',
            borderWidth: 2,
            focusBorderWidth: 3,
            borderRadius: 'full',
            focusBorderColor: 'red.600',
            placeholderTextColor: 'red.400',
          },
        },
      }}
    >

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

No branches or pull requests

2 participants