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

update readme with useExtendedTheme hook details #72

Merged
merged 4 commits into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 8 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,56 +65,19 @@ In order for these components to look correct in your application, you should us

### TypeScript

Our Brightlayer UI themes extend the themes provided by React Native Paper. If you are using these themes in a TypeScript project and want to access any of the properties that were added to the defaults, you need to add the following [global augmentation](https://callstack.github.io/react-native-paper/theming.html#typescript) in your project's index.tsx file:
Our Brightlayer UI themes extend the themes provided by React Native Paper. If you are using these themes in a TypeScript project and want to access any of the properties that were added to the defaults, you need to use useExtendedTheme hook in your project:

```tsx
declare global {
namespace ReactNativePaper {
interface ThemeColors {
primaryPalette: {
light: string;
main: string;
dark: string;
};
accentPalette: {
light: string;
main: string;
dark: string;
};
errorPalette: {
light: string;
main: string;
dark: string;
};
divider: string;
textPalette: {
primary: string;
secondary: string;
onPrimary: {
light: string;
main: string;
dark: string;
};
disabled: string;
};
actionPalette: {
active: string;
background: string;
disabled: string;
disabledBackground: string;
};
overrides: $DeepPartial<ThemeOverrides>;
opacity: Partial<ThemeOpacity>;
}
interface ThemeFonts {
bold: ThemeFont;
}
}
}
import { useExtendedTheme } from '@brightlayer-ui/react-native-themes';
...
const theme = useExtendedTheme();
<Button mode="contained" style={{ backgroundColor: theme.colors.onOrangeFilledContainer }}>
Label
</Button>
```

<!--
## Demo

[Check it out](https://github.com/etn-ccis/blui-react-native-showcase-demo/tree/master)
-->
-->