Skip to content

Commit 50d6cc6

Browse files
committed
Add info on setComponentForcedTheme in our docs
1 parent 129b33b commit 50d6cc6

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

markdowns/foundation/theme-manager.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ index: 7
33
path: "/foundation/theme-manager"
44
title: "Theme Manager"
55
---
6-
Use the `ThemeManager` to set default global behaviour for your app.
6+
Use the `ThemeManager` to set default global behavior for your app.
77

8-
**setComponentTheme**
8+
#### setComponentTheme
99

10-
Set default props for a component by passing an object or a callback (for dynamic, runtime default props)
10+
Set default props for a component by passing an object or a callback (for dynamic, runtime default props)
11+
The default value will be overridden if a prop is being passed to the component instance. (See `setComponentForcedTheme` for that)
1112

1213
- `ThemeManager.setComponentTheme(componentName, defaultPropsObject);`
1314
- `ThemeManager.setComponentTheme(componentName, componentProps => newDefaultPropsObject);`
1415

15-
example
16+
Example
1617

1718
```
1819
import {ThemeManager} from 'react-native-ui-lib';
@@ -33,4 +34,15 @@ ThemeManager.setComponentTheme('Button', (props, context) => {
3334
});
3435
```
3536

37+
#### setComponentForcedTheme
38+
Same as `setComponentTheme` only it can't be overridden by props passed to the component.
3639

40+
Example
41+
42+
```
43+
ThemeManager.setComponentForcedTheme('Card', (props, context) => {
44+
return {
45+
containerStyle: [styles.defaultContainerStyle, props.containerStyle]
46+
};
47+
});
48+
```

0 commit comments

Comments
 (0)