Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ project.xcworkspace
.settings
local.properties
android.iml
issue*

# Cocoapods
#
Expand Down
Binary file not shown.
Binary file not shown.
13 changes: 13 additions & 0 deletions example/android/link-assets-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"migIndex": 1,
"data": [
{
"path": "assets/fonts/ChivoMono.ttf",
"sha1": "fe260b56219f603a8aaf7fba5cfd2c898bf2bca0"
},
{
"path": "assets/fonts/Tourney.ttf",
"sha1": "1c7f16792740c9c6398692ea2149c5c3a6aaf6e5"
}
]
}
Binary file added example/assets/fonts/ChivoMono.ttf
Binary file not shown.
Binary file added example/assets/fonts/Tourney.ttf
Binary file not shown.
17 changes: 17 additions & 0 deletions example/ios/NitroTextExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
94EE308912A9FD340098AA08 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
98F6E17588234B2CA2A4AE98 /* Tourney.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FF9EF60F857E4AB0B9823535 /* Tourney.ttf */; };
B5298A4D660D4F30A37B2814 /* ChivoMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3F04B18644AC4671BB0B3299 /* ChivoMono.ttf */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -20,11 +22,13 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = NitroTextExample/Info.plist; sourceTree = "<group>"; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = NitroTextExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3B4392A12AC88292D35C810B /* Pods-NitroTextExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NitroTextExample.debug.xcconfig"; path = "Target Support Files/Pods-NitroTextExample/Pods-NitroTextExample.debug.xcconfig"; sourceTree = "<group>"; };
3F04B18644AC4671BB0B3299 /* ChivoMono.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = ChivoMono.ttf; path = ../assets/fonts/ChivoMono.ttf; sourceTree = "<group>"; };
5709B34CF0A7D63546082F79 /* Pods-NitroTextExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NitroTextExample.release.xcconfig"; path = "Target Support Files/Pods-NitroTextExample/Pods-NitroTextExample.release.xcconfig"; sourceTree = "<group>"; };
5DCACB8F33CDC322A6C60F78 /* libPods-NitroTextExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NitroTextExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = NitroTextExample/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = NitroTextExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
FF9EF60F857E4AB0B9823535 /* Tourney.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = Tourney.ttf; path = ../assets/fonts/Tourney.ttf; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -51,6 +55,16 @@
name = NitroTextExample;
sourceTree = "<group>";
};
2D10C1EE03554F54B2107B66 /* Resources */ = {
isa = PBXGroup;
children = (
FF9EF60F857E4AB0B9823535 /* Tourney.ttf */,
3F04B18644AC4671BB0B3299 /* ChivoMono.ttf */,
);
name = Resources;
path = "";
sourceTree = "<group>";
};
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand All @@ -75,6 +89,7 @@
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
BBD78D7AC51CEA395F1C20DB /* Pods */,
2D10C1EE03554F54B2107B66 /* Resources */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand Down Expand Up @@ -161,6 +176,8 @@
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
94EE308912A9FD340098AA08 /* PrivacyInfo.xcprivacy in Resources */,
98F6E17588234B2CA2A4AE98 /* Tourney.ttf in Resources */,
B5298A4D660D4F30A37B2814 /* ChivoMono.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
7 changes: 6 additions & 1 deletion example/ios/NitroTextExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<string/>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand All @@ -49,5 +49,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIAppFonts</key>
<array>
<string>Tourney.ttf</string>
<string>ChivoMono.ttf</string>
</array>
</dict>
</plist>
13 changes: 13 additions & 0 deletions example/ios/link-assets-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"migIndex": 1,
"data": [
{
"path": "assets/fonts/ChivoMono.ttf",
"sha1": "fe260b56219f603a8aaf7fba5cfd2c898bf2bca0"
},
{
"path": "assets/fonts/Tourney.ttf",
"sha1": "1c7f16792740c9c6398692ea2149c5c3a6aaf6e5"
}
]
}
1 change: 1 addition & 0 deletions example/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ module.exports = {
root: path.join(__dirname, '..'),
},
},
assets: ['./assets/fonts'],
}
2 changes: 1 addition & 1 deletion example/src/screens/PerformanceScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ import React, {
</TouchableOpacity>

<View
style={[styles.benchmarkPreview, { height: 220, flexDirection: 'row' }]}
style={[styles.benchmarkPreview, { height: 320, flexDirection: 'row' }]}
key={`list-${listRenderKey}`}
>
<View style={{ flex: 1, marginRight: 8 }}>
Expand Down
41 changes: 30 additions & 11 deletions example/src/screens/PlainTextScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@ export function PlainTextScreen() {
<ScrollView style={styles.container} contentContainerStyle={styles.content}>
{/* Header Section */}
<View style={styles.section}>
<NitroText
style={styles.mainTitle}
selectable={false}
onPressIn={() => console.log('onPressIn')}
onPressOut={() => console.log('onPressOut')}
onLongPress={() => console.log('onLongPress')}
onPress={() => console.log('onPress')}
>
🚀 NitroText Plain Text {NitroModules.buildType}
</NitroText>
<NitroText style={styles.mainTitle}>🚀 NitroText Plain Text {NitroModules.buildType}</NitroText>
<NitroText style={styles.subtitle}>
High-performance selectable text with native rendering
</NitroText>
Expand Down Expand Up @@ -93,6 +84,35 @@ export function PlainTextScreen() {
</Text>
</View>

{/* Custom Fonts */}
<View style={styles.section}>
<NitroText style={styles.sectionTitle}>Custom Fonts</NitroText>
<NitroText style={styles.description}>
NitroText supports custom fonts from your assets folder. The Tourney
font is loaded from @assets/fonts/ChivoMono.ttf
</NitroText>
<NitroText style={styles.customFontExample}>
This text uses the Tourney custom font with NitroText. You can apply
custom fonts using the fontFamily prop in styles or directly on the
component.
</NitroText>
<NitroText style={styles.customFontMixed}>
Mix custom fonts with{' '}
<NitroText style={styles.customFontBold}>bold styling</NitroText> and{' '}
<NitroText style={styles.customFontItalic}>italic styling</NitroText>{' '}
for rich typography.
</NitroText>
<NitroText style={styles.customFontNested}>
You can also nest custom fonts:{' '}
<NitroText
style={{ fontFamily: 'Tourney', fontSize: 24, fontWeight: 'bold' }}
>
Large Tourney Bold
</NitroText>{' '}
mixed with regular system font text.
</NitroText>
</View>

{/* Mixed Content */}
<View style={styles.section}>
<NitroText style={styles.sectionTitle}>Mixed Content</NitroText>
Expand Down Expand Up @@ -192,4 +212,3 @@ export function PlainTextScreen() {
</ScrollView>
);
}

42 changes: 40 additions & 2 deletions example/src/screens/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ export const styles = StyleSheet.create({
fontWeight: 'bold',
color: '#1a1a1a',
textAlign: 'center',
fontFamily: 'ui-monospace',
// marginBottom: 8,
backgroundColor: 'red',
},
subtitle: {
Expand All @@ -50,6 +48,7 @@ export const styles = StyleSheet.create({
fontSize: 14,
color: '#6c757d',
marginBottom: 8,
fontFamily: 'Chivo Mono',
},

// Basic text styles
Expand All @@ -73,6 +72,45 @@ export const styles = StyleSheet.create({
padding: 16,
borderRadius: 8,
},
// Custom font styles
customFontExample: {
fontSize: 18,
fontFamily: 'Tourney',
color: '#2c3e50',
backgroundColor: '#ffffff',
padding: 16,
borderRadius: 8,
borderLeftWidth: 4,
borderLeftColor: '#9b59b6',
marginTop: 8,
},
customFontMixed: {
fontSize: 16,
fontFamily: 'Tourney',
color: '#495057',
backgroundColor: '#f8f9fa',
padding: 16,
borderRadius: 8,
marginTop: 8,
lineHeight: 24,
},
customFontBold: {
fontWeight: 'bold',
color: '#8e44ad',
},
customFontItalic: {
fontStyle: 'italic',
color: '#9b59b6',
},
customFontNested: {
fontSize: 16,
color: '#495057',
backgroundColor: '#ffffff',
padding: 16,
borderRadius: 8,
marginTop: 8,
lineHeight: 24,
},
bold: {
fontWeight: 'bold',
color: '#2c3e50',
Expand Down
Loading