wix / react-native-ui-lib

UI Components Library for React Native
https://wix.github.io/react-native-ui-lib/
MIT License
6.53k stars 712 forks source link

setComponentTheme not working #2553

Closed vendramini closed 1 year ago

vendramini commented 1 year ago

Description

I've created a new expo project to test and learn. I'm doing this simple line of code and it is not working as expected:

ThemeManager.setComponentTheme('TextField', {color: 'red'});

However, this is working:

ThemeManager.setComponentTheme('Text', {color: 'red'});

The full file index.ts:

import "expo-router/entry";
import {ThemeManager} from 'react-native-ui-lib';

ThemeManager.setComponentTheme('TextField', {color: 'red'});

Am I missing something? The TextField was supposed to be red but it isn't.

Related to

Environment

Affected platforms

halenur commented 1 year ago

I have found a solution for the textfield component theme management. You must use 'Incubator.TextField' instead of 'TextField'.

import {ThemeManager} from 'react-native-ui-lib';

ThemeManager.setComponentTheme('Incubator.TextField', () => {
  return {
     fieldStyle: {
        borderWidth: 1,
        borderColor: 'blue',
        borderRadius: 8,
     },
     labelColor: 'red',
     placeholderTextColor: 'purple'
     ...
  }
});
vendramini commented 1 year ago

You are right @halenur. Where did you find that? I couldn't find it on docs. Thank you!

ilkerceng commented 1 year ago

The Button also didn't work for me.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.