File tree Expand file tree Collapse file tree
packages/rn-tester/js/examples/Text Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const TALL_LINE_HEIGHT = 48;
2828const FONT_FAMILY = 'Helvetica' ;
2929const SERIF_FONT_FAMILY = 'TimesNewRomanPSMT' ;
3030const SPACING = 8 ;
31+ const DISPLAY_DECIMAL_PLACES = 3 ;
3132
3233type Sample = Readonly < {
3334 name : string ,
@@ -108,8 +109,6 @@ function InlineViewBaselineSample({
108109 } ) ;
109110 } , [ baseline ] ) ;
110111
111- const error =
112- baseline != null && bottom != null ? bottom - baseline : undefined ;
113112 const content = (
114113 < >
115114 { 'Hg ' }
@@ -147,11 +146,11 @@ function InlineViewBaselineSample({
147146 allowFontScaling = { false }
148147 testID = { `${ name } -metrics` }
149148 style = { styles . metrics } >
150- { error == null
151- ? baseline == null
152- ? 'Measuring...'
153- : 'View measurement unavailable'
154- : `baseline ${ baseline ? .toFixed ( 3 ) } | bottom ${ bottom ? .toFixed ( 3 ) } | error ${ error . toFixed ( 3 ) } pt` }
149+ { baseline == null
150+ ? 'Measuring...'
151+ : bottom == null
152+ ? 'View measurement unavailable'
153+ : `baseline ${ baseline . toFixed ( DISPLAY_DECIMAL_PLACES ) } | bottom ${ bottom . toFixed ( DISPLAY_DECIMAL_PLACES ) } | error ${ ( bottom - baseline ) . toFixed ( DISPLAY_DECIMAL_PLACES ) } pt` }
155154 </ RNTesterText >
156155 </ View >
157156 ) ;
@@ -171,7 +170,7 @@ export function TextInlineViewBaselineExample(): React.Node {
171170 sample.
172171 </ RNTesterText >
173172 < RNTesterText allowFontScaling = { false } style = { styles . metrics } >
174- { `One pixel: ${ ( 1 / scale ) . toFixed ( 3 ) } pt | font scale: ${ fontScale . toFixed ( 3 ) } (last sample only)` }
173+ { `One pixel: ${ ( 1 / scale ) . toFixed ( DISPLAY_DECIMAL_PLACES ) } pt | font scale: ${ fontScale . toFixed ( DISPLAY_DECIMAL_PLACES ) } (last sample only)` }
175174 </ RNTesterText >
176175 { SAMPLES . map ( sample => (
177176 < InlineViewBaselineSample key = { sample . name } { ...sample } />
You can’t perform that action at this time.
0 commit comments