Custom fonts (#192)

* Add Whitney fonts to project
* Use styled components to pass whitney as default font for all app text
* Add header component using Papyrus as default font
* Update realm and add custom font examples for Android

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
This commit is contained in:
Amanda Bullington
2022-10-20 15:23:10 -07:00
committed by GitHub
parent f9392452f3
commit a07ee979e6
20 changed files with 122 additions and 3 deletions

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -0,0 +1,29 @@
{
"migIndex": 1,
"data": [
{
"path": "assets/fonts/Whitney-Book-Pro.otf",
"sha1": "639b8a8bf3e1cc3de30d0f49e666aca3999ca65a"
},
{
"path": "assets/fonts/Whitney-BookItalic-Pro.otf",
"sha1": "15854f60175a0e82b794c259431ec45ea4b40103"
},
{
"path": "assets/fonts/Whitney-Light-Pro.otf",
"sha1": "d15560faea2b18aef9867a1d2b9e2efb54b17b5b"
},
{
"path": "assets/fonts/Whitney-Medium-Pro.otf",
"sha1": "33ca073c11f46dc266a7dc1adeaa102891bd76d1"
},
{
"path": "assets/fonts/Whitney-Semibold-Pro.otf",
"sha1": "7a107095a453c8cd8046d9ccded5d88e6809e89f"
},
{
"path": "assets/fonts/Whitney-SemiboldItalic-Pro.otf",
"sha1": "53e8a56ceb630b63316db41017125c52fbf0e845"
}
]
}

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -12,7 +12,13 @@
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
829672AB5DD3412FB120DE40 /* Whitney-BookItalic-Pro.otf in Resources */ = {isa = PBXBuildFile; fileRef = B5359D98B3384738A8ED6C74 /* Whitney-BookItalic-Pro.otf */; };
A252B2AEA64E47C9AC1D20E8 /* Whitney-Light-Pro.otf in Resources */ = {isa = PBXBuildFile; fileRef = BA9D41ECEBFA4C38B74009B3 /* Whitney-Light-Pro.otf */; };
B5241D089ADB4290B5566898 /* Whitney-Semibold-Pro.otf in Resources */ = {isa = PBXBuildFile; fileRef = C6C5CABEB9CB44B5ABF940A8 /* Whitney-Semibold-Pro.otf */; };
BA2479FA3D7B40A7BEF7B3CD /* Whitney-Medium-Pro.otf in Resources */ = {isa = PBXBuildFile; fileRef = D09FA3A0162844FF80A5EF96 /* Whitney-Medium-Pro.otf */; };
C15FC29A57139D5E79AEE225 /* libPods-iNaturalistReactNative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 94E8E83754985D3480D4250B /* libPods-iNaturalistReactNative.a */; };
C8EEAD27B69C424BAB2EB23F /* Whitney-SemiboldItalic-Pro.otf in Resources */ = {isa = PBXBuildFile; fileRef = A788948E590442F385C5FD6C /* Whitney-SemiboldItalic-Pro.otf */; };
CF25D941972D42BDBBD309E0 /* Whitney-Book-Pro.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8860EC2616494880B36297C2 /* Whitney-Book-Pro.otf */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -37,7 +43,13 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iNaturalistReactNative/main.m; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = iNaturalistReactNative/LaunchScreen.storyboard; sourceTree = "<group>"; };
82C3EA8411717C12B2D638F0 /* Pods-iNaturalistReactNative.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iNaturalistReactNative.debug.xcconfig"; path = "Target Support Files/Pods-iNaturalistReactNative/Pods-iNaturalistReactNative.debug.xcconfig"; sourceTree = "<group>"; };
8860EC2616494880B36297C2 /* Whitney-Book-Pro.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Whitney-Book-Pro.otf"; path = "../assets/fonts/Whitney-Book-Pro.otf"; sourceTree = "<group>"; };
94E8E83754985D3480D4250B /* libPods-iNaturalistReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-iNaturalistReactNative.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A788948E590442F385C5FD6C /* Whitney-SemiboldItalic-Pro.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Whitney-SemiboldItalic-Pro.otf"; path = "../assets/fonts/Whitney-SemiboldItalic-Pro.otf"; sourceTree = "<group>"; };
B5359D98B3384738A8ED6C74 /* Whitney-BookItalic-Pro.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Whitney-BookItalic-Pro.otf"; path = "../assets/fonts/Whitney-BookItalic-Pro.otf"; sourceTree = "<group>"; };
BA9D41ECEBFA4C38B74009B3 /* Whitney-Light-Pro.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Whitney-Light-Pro.otf"; path = "../assets/fonts/Whitney-Light-Pro.otf"; sourceTree = "<group>"; };
C6C5CABEB9CB44B5ABF940A8 /* Whitney-Semibold-Pro.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Whitney-Semibold-Pro.otf"; path = "../assets/fonts/Whitney-Semibold-Pro.otf"; sourceTree = "<group>"; };
D09FA3A0162844FF80A5EF96 /* Whitney-Medium-Pro.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Whitney-Medium-Pro.otf"; path = "../assets/fonts/Whitney-Medium-Pro.otf"; sourceTree = "<group>"; };
E6BB4561D9EBE3B509576120 /* Pods-iNaturalistReactNative.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iNaturalistReactNative.release.xcconfig"; path = "Target Support Files/Pods-iNaturalistReactNative/Pods-iNaturalistReactNative.release.xcconfig"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
@@ -125,6 +137,7 @@
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
3610B9F08DA0E49FEE702ABA /* Pods */,
E7A0E0AA690545D78AA7CC73 /* Resources */,
);
indentWidth = 2;
sourceTree = "<group>";
@@ -140,6 +153,20 @@
name = Products;
sourceTree = "<group>";
};
E7A0E0AA690545D78AA7CC73 /* Resources */ = {
isa = PBXGroup;
children = (
8860EC2616494880B36297C2 /* Whitney-Book-Pro.otf */,
B5359D98B3384738A8ED6C74 /* Whitney-BookItalic-Pro.otf */,
BA9D41ECEBFA4C38B74009B3 /* Whitney-Light-Pro.otf */,
D09FA3A0162844FF80A5EF96 /* Whitney-Medium-Pro.otf */,
C6C5CABEB9CB44B5ABF940A8 /* Whitney-Semibold-Pro.otf */,
A788948E590442F385C5FD6C /* Whitney-SemiboldItalic-Pro.otf */,
);
name = Resources;
path = "";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -232,6 +259,12 @@
files = (
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
CF25D941972D42BDBBD309E0 /* Whitney-Book-Pro.otf in Resources */,
829672AB5DD3412FB120DE40 /* Whitney-BookItalic-Pro.otf in Resources */,
A252B2AEA64E47C9AC1D20E8 /* Whitney-Light-Pro.otf in Resources */,
BA2479FA3D7B40A7BEF7B3CD /* Whitney-Medium-Pro.otf in Resources */,
B5241D089ADB4290B5566898 /* Whitney-Semibold-Pro.otf in Resources */,
C8EEAD27B69C424BAB2EB23F /* Whitney-SemiboldItalic-Pro.otf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -51,6 +51,12 @@
<array>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Whitney-Book-Pro.otf</string>
<string>Whitney-BookItalic-Pro.otf</string>
<string>Whitney-Light-Pro.otf</string>
<string>Whitney-Medium-Pro.otf</string>
<string>Whitney-Semibold-Pro.otf</string>
<string>Whitney-SemiboldItalic-Pro.otf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>

View File

@@ -0,0 +1,29 @@
{
"migIndex": 1,
"data": [
{
"path": "assets/fonts/Whitney-Book-Pro.otf",
"sha1": "639b8a8bf3e1cc3de30d0f49e666aca3999ca65a"
},
{
"path": "assets/fonts/Whitney-BookItalic-Pro.otf",
"sha1": "15854f60175a0e82b794c259431ec45ea4b40103"
},
{
"path": "assets/fonts/Whitney-Light-Pro.otf",
"sha1": "d15560faea2b18aef9867a1d2b9e2efb54b17b5b"
},
{
"path": "assets/fonts/Whitney-Medium-Pro.otf",
"sha1": "33ca073c11f46dc266a7dc1adeaa102891bd76d1"
},
{
"path": "assets/fonts/Whitney-Semibold-Pro.otf",
"sha1": "7a107095a453c8cd8046d9ccded5d88e6809e89f"
},
{
"path": "assets/fonts/Whitney-SemiboldItalic-Pro.otf",
"sha1": "53e8a56ceb630b63316db41017125c52fbf0e845"
}
]
}

4
package-lock.json generated
View File

@@ -16627,6 +16627,7 @@
"@realm.io/common": "^0.1.4",
"bindings": "^1.5.0",
"bson": "4.4.1",
"clang-format": "^1.6.0",
"command-line-args": "^5.1.1",
"deepmerge": "2.1.0",
"fs-extra": "^4.0.3",
@@ -16649,7 +16650,7 @@
"npm": ">=7"
},
"peerDependencies": {
"react-native": ">=0.64"
"react-native": ">=0.66.0"
},
"peerDependenciesMeta": {
"react-native": {
@@ -31799,6 +31800,7 @@
"@realm.io/common": "^0.1.4",
"bindings": "^1.5.0",
"bson": "4.4.1",
"clang-format": "^1.6.0",
"command-line-args": "^5.1.1",
"deepmerge": "2.1.0",
"fs-extra": "^4.0.3",

View File

@@ -5,5 +5,6 @@ module.exports = {
android: null // disable Android platform, other platforms will still autolink if provided
}
}
}
},
assets: ["./assets/fonts/"]
};

View File

@@ -4,6 +4,7 @@ import { styled } from "nativewind";
import {
Image as StyledImage,
KeyboardAvoidingView as StyledKeyboardAvoidingView,
Platform,
Pressable as StyledPressable,
SafeAreaView as StyledSafeAreaView,
ScrollView as StyledScrollView,
@@ -21,7 +22,15 @@ const SafeAreaView = styled( StyledSafeAreaView );
// $FlowIgnore
const ScrollView = styled( StyledScrollView );
// $FlowIgnore
const Text = styled( StyledText );
const HeaderText = styled(
StyledText,
Platform.OS === "ios" ? "font-Papyrus-Condensed" : "font-Roboto"
);
// $FlowIgnore
const Text = styled(
StyledText,
Platform.OS === "ios" ? "font-Whitney-Medium" : "font-Whitney-Medium-Pro"
);
// $FlowIgnore
const TextInput = styled( StyledTextInput );
// $FlowIgnore
@@ -30,6 +39,7 @@ const Pressable = styled( StyledPressable );
const Image = styled( StyledImage );
export {
HeaderText,
Image,
KeyboardAvoidingView,
Pressable,

View File

@@ -13,6 +13,15 @@ module.exports = {
extend: {
height: {
22: "5.5rem"
},
fontFamily: {
"Whitney-Medium": ["Whitney-Medium"],
"Whitney-Medium-Pro": ["Whitney-Medium-Pro"], // Android naming convention
"Whitney-Light": ["Whitney-Light"],
// selected from list of fonts already available in RN
// https://infinitbility.com/react-native-font-family-list/
"Papyrus-Condensed": ["Papyrus-Condensed"],
Roboto: ["Roboto"]
}
},
colors: {