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

Fix - Text variants not working correctly on Android #90

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v7.0.1 (Unreleased)

### Fixed

- Text variants not working correctly on Android [89](https://github.com/etn-ccis/blui-react-native-themes/issues/89).

## v7.0.0 (January 12, 2024)

### Changed
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import * as BLUIThemes from '@brightlayer-ui/react-native-themes';
</ThemeProvider>
```


### React Native Paper Components Style Override

This Document contains a set of style overrides in components around various [React Native Paper](https://callstack.github.io/react-native-paper/index.html) components.
Expand All @@ -77,6 +76,20 @@ const theme = useExtendedTheme();
</Button>
```

## Changing fontWeight of a Text Element

When you need to change the `fontWeight` of a `Text` element in your application, it's important to note that it should be done through the `fontFamily` property rather than the `fontWeight` property.

The `fontFamily` property allows you to specify the font and its weight. By using the appropriate font family that supports the desired weight, you can achieve the desired fontWeight effect.

For example, if you want to set the fontWeight to "bold", you can use a font family that includes a bold variant, such as:

```tsx
<Text variant={'headlineLarge'} style={{ fontFamily: 'OpenSans-Bold' }}>
headlineLarge
</Text>
```

### Upgrading from version 6 -> 7

In the version 7, the library has been updated to use [React Native Paper](https://callstack.github.io/react-native-paper/) v5, which is adopting [Material Design 3](https://m3.material.io/). The themes have now been updated to use Material Design 3 Themes.
Expand All @@ -85,4 +98,4 @@ In the version 7, the library has been updated to use [React Native Paper](https
## Demo

[Check it out](https://github.com/etn-ccis/blui-react-native-showcase-demo/tree/master)
-->
-->
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@brightlayer-ui/react-native-themes",
"author": "Brightlayer UI <[email protected]>",
"license": "BSD-3-Clause",
"version": "7.0.0",
"version": "7.0.1",
"description": "React Native themes for Brightlayer UI applications",
"main": "./dist/index.js",
"scripts": {
Expand Down
32 changes: 8 additions & 24 deletions src/shared.ts
Original file line number Diff line number Diff line change
@@ -1,103 +1,87 @@
import { Platform } from 'react-native';

import { MD3Theme, useTheme } from 'react-native-paper';
import { MD3Type, MD3Typescale } from 'react-native-paper/lib/typescript/types';
import { $DeepPartial } from '@callstack/react-theme-provider';

export const fontConfig = {
displaySmall: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 36,
lineHeight: 45,
lineHeight: 48,
},
displayMedium: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 45,
lineHeight: 56,
},
displayLarge: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 54,
lineHeight: 68,
letterSpacing: 1,
fontSize: 57,
lineHeight: 72,
letterSpacing: -0.25,
},
headlineSmall: {
fontFamily: 'OpenSans-Regular',
fontWeight: '500' as const,
fontSize: 24,
lineHeight: 32,
},
headlineMedium: {
fontFamily: 'OpenSans-Regular',
fontWeight: '500' as const,
fontSize: 27,
lineHeight: 40,
fontSize: 28,
lineHeight: 36,
},
headlineLarge: {
fontFamily: 'OpenSans-Regular',
fontWeight: '500' as const,
fontSize: 32,
lineHeight: 40,
},
titleSmall: {
fontFamily: 'OpenSans-Regular',
fontWeight: '600' as const,
fontFamily: 'OpenSans-SemiBold',
fontSize: 14,
lineHeight: 20,
letterSpacing: 0.1,
},
titleMedium: {
fontFamily: 'OpenSans-Regular',
fontWeight: '600' as const,
fontFamily: 'OpenSans-SemiBold',
fontSize: 16,
lineHeight: 24,
letterSpacing: 0.15,
},
titleLarge: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 22,
lineHeight: 28,
},
labelSmall: {
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600' as const,
fontSize: 11,
lineHeight: 16,
letterSpacing: 0.5,
},
labelMedium: {
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600' as const,
fontSize: 12,
lineHeight: 16,
letterSpacing: 0.2,
},
labelLarge: {
fontFamily: 'OpenSans-SemiBold',
fontWeight: '600' as const,
fontSize: 14,
lineHeight: 20,
letterSpacing: 0.1,
},
bodySmall: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 12,
lineHeight: 16,
},
bodyMedium: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 14,
lineHeight: 20,
},
bodyLarge: {
fontFamily: 'OpenSans-Regular',
fontWeight: '400' as const,
fontSize: 16,
lineHeight: 24,
letterSpacing: 0.15,
Expand Down