Skip to content

Commit 8fb590a

Browse files
kacperzolkiewskilukewalczak
authored andcommitted
fix: ensure DataTable.Title respects font scaling (#4640)
1 parent cab5afa commit 8fb590a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/components/DataTable/DataTableTitle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Animated,
44
GestureResponderEvent,
55
I18nManager,
6+
PixelRatio,
67
Pressable,
78
StyleProp,
89
StyleSheet,
@@ -137,7 +138,7 @@ const DataTableTitle = ({
137138
style={[
138139
styles.cell,
139140
// height must scale with numberOfLines
140-
{ maxHeight: 24 * numberOfLines },
141+
{ maxHeight: 24 * PixelRatio.getFontScale() * numberOfLines },
141142
// if numberOfLines causes wrap, center is lost. Align directly, sensitive to numeric and RTL
142143
numberOfLines > 1
143144
? numeric

src/components/__tests__/__snapshots__/DataTable.test.tsx.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ exports[`DataTable.Header renders data table header 1`] = `
229229
"lineHeight": 24,
230230
},
231231
{
232-
"maxHeight": 24,
232+
"maxHeight": 48,
233233
},
234234
{},
235235
{
@@ -310,7 +310,7 @@ exports[`DataTable.Header renders data table header 1`] = `
310310
"lineHeight": 24,
311311
},
312312
{
313-
"maxHeight": 24,
313+
"maxHeight": 48,
314314
},
315315
{},
316316
{
@@ -2643,7 +2643,7 @@ exports[`DataTable.Title renders data table title with press handler 1`] = `
26432643
"lineHeight": 24,
26442644
},
26452645
{
2646-
"maxHeight": 24,
2646+
"maxHeight": 48,
26472647
},
26482648
{},
26492649
{
@@ -2778,7 +2778,7 @@ exports[`DataTable.Title renders data table title with sort icon 1`] = `
27782778
"lineHeight": 24,
27792779
},
27802780
{
2781-
"maxHeight": 24,
2781+
"maxHeight": 48,
27822782
},
27832783
{},
27842784
{
@@ -2864,7 +2864,7 @@ exports[`DataTable.Title renders right aligned data table title 1`] = `
28642864
"lineHeight": 24,
28652865
},
28662866
{
2867-
"maxHeight": 24,
2867+
"maxHeight": 48,
28682868
},
28692869
{},
28702870
{

0 commit comments

Comments
 (0)