Commit 35 of 75:
c980467815
fix(android): size explicit grid row tracks with consistent units
previous
next
whole branch
Review threads live on the whole diff, not on one commit, so
none are shown here - a thread's line means something in the
branch's final form, and painting it into an intermediate
step would put it on code it is not about.
packages/android/fixtures/native-navigation/NativeNavigationTest.kt modified +1 -1 Changes to packages/android/fixtures/native-navigation/NativeNavigationTest.kt ⋯ 1,122 lines Show the 1,122 lines above this hunk @@ -1123,7 +1123,7 @@ class NativeNavigationTest { 1123 1123 val templateFirst = awaitView ( activity , "grid-template-rows-first" ) 1124 1124 val templateThird = awaitView ( activity , "grid-template-rows-third" ) 1125 1125 assertEquals ( templateFirst . height , templateThird . height ) 1126 - assertTrue ( "explicit grid rows did not fill the definite height" , templateThird . top - templateFirst . top > ( 30 * density ) . toInt ( ) ) 1126 + assertEquals ( "explicit grid rows did not fill the definite height" , 44.0 * density , ( templateThird . top - templateFirst . top ) . toDouble ( ) , 1.0 ) 1127 1127 val fractionalGrid = awaitView ( activity , "grid-fractional-wrap" ) 1128 1128 val fractionalFirst = awaitView ( activity , "grid-fractional-first" ) 1129 1129 val fractionalSecond = awaitView ( activity , "grid-fractional-second" )
packages/android/templates/MainActivityNative.kt.template modified +2 -2 Changes to packages/android/templates/MainActivityNative.kt.template ⋯ 1,104 lines Show the 1,104 lines above this hunk @@ -1105,9 +1105,9 @@ internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) { 1105 1105 val rowHeights = if (gridRows != null) { 1106 1106 val count = max(gridRows ?: 0, naturalRowHeights.size) 1107 1107 while (rows.size < count) rows.add(mutableListOf()) 1108 - val available = max( 0 , height - paddingTop - paddingBottom - max(0, count - 1) * rowGap ).toFloat( ) 1108 + val available = max( 0f , ( height - paddingTop - paddingBottom ).toFloat() - max(0, count - 1) * rowGap) 1109 1109 val equal = available / max(1, count).toFloat() 1110 - naturalRowHeights + List(count - naturalRowHeights.size) { equal } 1110 + ( naturalRowHeights + List(count - naturalRowHeights.size) { 0f } ) 1111 1111 .map { max(it, equal) } 1112 1112 } else naturalRowHeights 1113 1113 return GridLayout(rows, absolute, cellWidth, rowHeights)
packages/ios/fixtures/native-navigation/NativeNavigationUITests.swift modified +1 -1 Changes to packages/ios/fixtures/native-navigation/NativeNavigationUITests.swift ⋯ 617 lines Show the 617 lines above this hunk @@ -618,7 +618,7 @@ final class NativeNavigationUITests: XCTestCase { 618 618 let templateThird = app . otherElements [ "grid-template-rows-third" ] 619 619 XCTAssertTrue ( templateRows . waitForExistence ( timeout : 5 ) & & templateFirst . exists & & templateThird . exists ) 620 620 XCTAssertEqual ( templateFirst . frame . height , templateThird . frame . height , accuracy : 2 , "explicit grid rows did not use equal tracks" ) 621 - XCTAssertGreaterThan ( templateThird . frame . minY , templateFirst . frame . minY + 30 , "explicit grid rows did not fill the definite height" ) 621 + XCTAssertEqual ( templateThird . frame . minY - templateFirst . frame . minY , 44 , accuracy : 1 , "explicit grid rows did not fill the definite height" ) 622 622 let fractionalGrid = app . otherElements [ "grid-fractional-wrap" ] 623 623 let fractionalFirst = app . otherElements [ "grid-fractional-first" ] 624 624 let fractionalSecond = app . otherElements [ "grid-fractional-second" ]