Skip to content

Commit e550832

Browse files
authored
chore: bum up nitro 0.29.8 (#57)
- Bump `nitrogen` and `react-native-nitro-modules` versions to `0.29.8` in `package.json`, `example/package.json`, and `bun.lock`. - Update `Podfile.lock` to reflect the new `NitroModules` version. - Modify Kotlin and Swift bridge files to enhance type safety with `NON_NULL` annotations. - Refactor vector handling in Swift to utilize `FastVectorCopy` for better performance.
1 parent 49effe0 commit e550832

11 files changed

Lines changed: 118 additions & 88 deletions

File tree

bun.lock

Lines changed: 14 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/App.tsx

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import React, { useLayoutEffect, useState } from 'react';
2-
import { Platform, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native';
1+
import React, { useLayoutEffect, useMemo, useState } from 'react';
2+
import {
3+
Platform,
4+
ScrollView,
5+
StatusBar,
6+
StyleProp,
7+
StyleSheet,
8+
Text,
9+
TextStyle,
10+
View,
11+
} from 'react-native';
312
import { NitroText, TextLayoutEvent } from 'react-native-nitro-text';
413

514
const htmlComingFromServer = `
@@ -165,6 +174,38 @@ export default function App() {
165174
// setLayoutInfo(`Lines: ${lines.length}`);
166175
};
167176

177+
const htmlStyles: Record<string, StyleProp<TextStyle>> = useMemo(
178+
() => ({
179+
b: { fontWeight: 'bold', color: '#E53E3E' }, // deep red
180+
i: { fontStyle: 'italic', color: '#3182CE' }, // bright blue
181+
u: { textDecorationStyle: 'dashed', textDecorationColor: '#38A169' }, // green
182+
s: { textDecorationStyle: 'dashed', textDecorationColor: '#E53E3E' }, // red
183+
code: {
184+
fontFamily: Platform.select({
185+
android: 'monospace',
186+
ios: 'ui-monospace',
187+
}),
188+
color: '#805AD5',
189+
}, // purple
190+
pre: {
191+
fontFamily: Platform.select({
192+
android: 'monospace',
193+
ios: 'ui-monospace',
194+
}),
195+
color: '#805AD5',
196+
}, // purple
197+
p: { color: '#2D3748' }, // dark gray for better readability
198+
a: { color: 'green' }, // lighter blue for links
199+
h1: { color: '#2F855A', fontWeight: 'bold', fontSize: 32 }, // darker green
200+
h2: { color: '#2C5282', fontWeight: 'bold', fontSize: 24 }, // darker blue
201+
h3: { color: '#C05621', fontWeight: 'bold', fontSize: 18.72 }, // darker orange
202+
h4: { color: '#553C9A', fontWeight: 'bold', fontSize: 16 }, // darker purple
203+
h5: { color: '#744210', fontWeight: 'bold', fontSize: 13.28 }, // darker brown
204+
h6: { color: '#4A5568', fontWeight: 'bold', fontSize: 10.72 }, // medium gray
205+
}),
206+
[],
207+
);
208+
168209
useLayoutEffect(() => {
169210
StatusBar.setBarStyle('dark-content');
170211
}, []);
@@ -217,22 +258,7 @@ export default function App() {
217258
selectable
218259
style={styles.htmlText}
219260
renderer="html"
220-
renderStyles={{
221-
b: { fontWeight: 'bold', color: '#E53E3E' }, // deep red
222-
i: { fontStyle: 'italic', color: '#3182CE' }, // bright blue
223-
u: { textDecorationStyle: 'dashed', textDecorationColor: '#38A169' }, // green
224-
s: { textDecorationStyle: 'dashed', textDecorationColor: '#E53E3E' }, // red
225-
code: { fontFamily: Platform.select({android:'monospace', ios: "ui-monospace"}), color: '#805AD5' }, // purple
226-
pre: { fontFamily: Platform.select({android:'monospace', ios: "ui-monospace"}), color: '#805AD5' }, // purple
227-
p: { color: '#2D3748' }, // dark gray for better readability
228-
a: { color: 'green' }, // lighter blue for links
229-
h1: { color: '#2F855A', fontWeight: 'bold', fontSize: 32 }, // darker green
230-
h2: { color: '#2C5282', fontWeight: 'bold', fontSize: 24 }, // darker blue
231-
h3: { color: '#C05621', fontWeight: 'bold', fontSize: 18.72 }, // darker orange
232-
h4: { color: '#553C9A', fontWeight: 'bold', fontSize: 16 }, // darker purple
233-
h5: { color: '#744210', fontWeight: 'bold', fontSize: 13.28 }, // darker brown
234-
h6: { color: '#4A5568', fontWeight: 'bold', fontSize: 10.72 }, // medium gray
235-
}}
261+
renderStyles={htmlStyles}
236262
>
237263
{htmlComingFromServer}
238264
</NitroText>
@@ -510,7 +536,7 @@ const styles = StyleSheet.create({
510536
fontSize: 16,
511537
color: '#495057',
512538
lineHeight: 30,
513-
padding:16,
539+
padding: 16,
514540
borderRadius: 8,
515541
borderWidth: 1,
516542
borderColor: '#007bff',
@@ -629,7 +655,7 @@ const styles = StyleSheet.create({
629655
// Code syntax
630656
codeBlock: {
631657
fontSize: 14,
632-
fontFamily: Platform.select({android:'monospace', ios: "ui-monospace"}),
658+
fontFamily: Platform.select({ android: 'monospace', ios: 'ui-monospace' }),
633659
backgroundColor: '#1e1e1e',
634660
color: '#d4d4d4',
635661
padding: 16,

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PODS:
88
- hermes-engine (0.81.4):
99
- hermes-engine/Pre-built (= 0.81.4)
1010
- hermes-engine/Pre-built (0.81.4)
11-
- NitroModules (0.29.6):
11+
- NitroModules (0.29.8):
1212
- boost
1313
- DoubleConversion
1414
- fast_float
@@ -2643,7 +2643,7 @@ SPEC CHECKSUMS:
26432643
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
26442644
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
26452645
hermes-engine: 35c763d57c9832d0eef764316ca1c4d043581394
2646-
NitroModules: 7d693306799405ca141ef5c24efc0936f20a09c0
2646+
NitroModules: 808eee1dfaf75b2c5a63ea3608cb651cc7d13687
26472647
NitroText: c95604214333634a6a083ac7211b238686dbd628
26482648
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
26492649
RCTDeprecation: c0ed3249a97243002615517dff789bf4666cf585

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react": "19.1.0",
1515
"react-native": "0.81.4",
1616
"react-native-safe-area-context": "^5.5.2",
17-
"react-native-nitro-modules": "^0.29.6"
17+
"react-native-nitro-modules": "^0.29.8"
1818
},
1919
"devDependencies": {
2020
"@babel/core": "^7.25.2",

ios/NitroTextView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final class NitroTextView: UITextView {
4646
backgroundColor = .clear
4747
textContainerInset = .zero
4848
textContainer.lineFragmentPadding = 0
49-
layoutManager.usesFontLeading = true
49+
layoutManager.usesFontLeading = false
5050
textColor = .black
5151
contentInset = .zero
5252
clipsToBounds = true

nitrogen/generated/android/kotlin/com/margelo/nitro/nitrotext/views/HybridNitroTextManager.kt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nitrogen/generated/ios/NitroText-Swift-Cxx-Bridge.cpp

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)