Skip to content

Commit ccd06eb

Browse files
committed
FEAT: changes to fonts
1 parent 2e7311e commit ccd06eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1861
-620
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@typescript-eslint/no-explicit-any": 0,
1818
"@typescript-eslint/no-empty-function": 0,
1919
"@typescript-eslint/ban-types": 0,
20-
"@typescript-eslint/ban-ts-comment": 1
20+
"@typescript-eslint/ban-ts-comment": 0
2121
},
2222
"settings": {
2323
"react": {

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
## 0.6.0
44

5+
### Breaking
6+
7+
- `FontFamily` is now `FontFace`
8+
- `createFontFamily` is now `createFontFace`
9+
10+
### Changes
11+
512
- change `useTheming` hook, now gives theme values based on a supplied schema
613
- use `String.replace` instead of `String.replaceAll` for node 14 support
14+
- fonts now require you to explicitly set a backend on native environments
15+
- `ExpoFontBackend` for `expo`
16+
- `WebFontBackend` for web
717

818
## 0.5.11
919

example/App.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React, {useState} from "react";
2-
import {media, StyledText, ThemeFor, important, ThemeProvider, useComposedValues, vw} from "style-composer";
3-
import {CheckBox, ScrollView} from "react-native";
1+
import React, {useState} from "react";
2+
import {important, media, StyledText, ThemeFor, ThemeProvider, useComposedValues, vw, ExpoFontBackend, setFontBackendForNative} from "style-composer";
3+
import {CheckBox, ScrollView} from "react-native";
4+
import * as Fonts from "expo-font";
45

56
import Card from "./src/components/Card/Card";
67
import {$Card, $ChildSelectorTest} from "./src/components/Card/Card.style";
@@ -9,15 +10,16 @@ import Text from "./src/components/Text/Text";
910
import Button from "./src/components/Button/Button";
1011
import {$BigMargin} from "./src/components/Button/Button.style";
1112
import {THEMING} from "./src/ThemeConsts";
12-
import {$Heading} from "./src/components/Text/Text.style";
13+
import {$Heading} from "./src/components/Text/Text.style";
14+
15+
setFontBackendForNative(() => new ExpoFontBackend(Fonts));
1316

1417
const LIGHT_THEME: ThemeFor<typeof THEMING> = {};
1518
const DARK_THEME: ThemeFor<typeof THEMING> = {
1619
textColor : "rgba(255,255,255,0.98)",
1720
backgroundColor: "#333",
1821
};
1922

20-
2123
interface AppInternalProps {
2224
onProfilePress: () => void;
2325
}

example/assets/fonts/raleway/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {createFontFamily} from "style-composer";
1+
import {createFontFace} from "style-composer";
22

3-
const raleway = createFontFamily("raleway", {
3+
const raleway = createFontFace("raleway", {
44
black : require("./Raleway-Black.ttf"),
55
blackItalic : require("./Raleway-BlackItalic.ttf"),
66
bold : require("./Raleway-Bold.ttf"),
@@ -21,4 +21,4 @@ const raleway = createFontFamily("raleway", {
2121
thinItalic : require("./Raleway-ThinItalic.ttf"),
2222
});
2323

24-
export default raleway;
24+
export default raleway;

example/metro.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const path = require("path");
2+
const {
3+
applyConfigForLinkedDependencies,
4+
} = require("@carimus/metro-symlinked-deps");
5+
6+
module.exports = applyConfigForLinkedDependencies(
7+
{},
8+
{
9+
projectRoot : __dirname,
10+
resolveNodeModulesAtRoot : true,
11+
additionalWatchFolders: [path.resolve(__dirname, "node_modules/style-composer")]
12+
},
13+
);

0 commit comments

Comments
 (0)