@@ -502,26 +502,20 @@ describe("Paragraphs", () => {
502
502
) ! ;
503
503
const provider = Skia . TypefaceFontProvider . Make ( ) ;
504
504
provider . registerFont ( robotoRegular , "Roboto" ) ;
505
- const para = Skia . ParagraphBuilder . Make (
506
- {
507
- textStyle : {
508
- fontFamilies : [ "Roboto" ] ,
509
- color : Skia . Color ( "black" ) ,
510
- fontSize : 30 ,
511
- } ,
512
- } ,
513
- provider
514
- )
505
+ const para = Skia . ParagraphBuilder . Make ( { } , provider )
506
+ . pushStyle ( {
507
+ fontFamilies : [ "Roboto" ] ,
508
+ color : Skia . Color ( "black" ) ,
509
+ fontSize : 30 ,
510
+ } )
515
511
. addText ( "Say Hello to React Native Skia" )
512
+ . pop ( )
516
513
. build ( ) ;
517
514
para . layout ( 150 ) ;
518
515
const paint = Skia . Paint ( ) ;
519
516
paint . setColor ( Skia . Color ( "cyan" ) ) ;
520
- const maxWidth = para . getMaxWidth ( ) ;
521
517
const height = para . getHeight ( ) ;
522
- const longestLine = para . getLongestLine ( ) ;
523
- // The width of the bounding box is the smaller of the maximum width or the maximum intrinsic width
524
- const width = Math . min ( maxWidth , longestLine ) ;
518
+ const width = para . getLongestLine ( ) ;
525
519
canvas . drawRect ( Skia . XYWHRect ( 0 , 0 , width , height ) , paint ) ;
526
520
para . paint ( canvas , 0 , 0 ) ;
527
521
} ,
0 commit comments