ReviewOS

also looking at this

craft-native/craft

fix(mobile): preserve native editing, navigation, and durable media requests

#369
Merged chris wants to merge codex/native-vertical-scroll-tab-swipes into main
36 files +864 -185
packages/android/fixtures/native-navigation/NativeFlatListTest.ktmodified+14-7
Changes to packages/android/fixtures/native-navigation/NativeFlatListTest.kt
@@ -12,10 +12,13 @@ import android.widget.LinearLayout
1212import android.widget.TextView
1313import androidx.recyclerview.widget.GridLayoutManager
1414import androidx.recyclerview.widget.LinearLayoutManager
15import androidx.recyclerview.widget.RecyclerView
1516import androidx.test.ext.junit.runners.AndroidJUnit4
1617import androidx.test.core.app.ActivityScenario
1718import androidx.test.platform.app.InstrumentationRegistry
1819import java.util.concurrent.atomic.AtomicInteger
20import java.util.concurrent.CountDownLatch
21import java.util.concurrent.TimeUnit
1922import org.json.JSONArray
2023import org.json.JSONObject
2124import org.junit.Assert.assertEquals
@@ -180,26 +183,30 @@ class NativeFlatListTest {
180183 val scrollCount = AtomicInteger()
181184 val momentumBeginCount = AtomicInteger()
182185 val momentumEndCount = AtomicInteger()
186 val momentumEnded = CountDownLatch(1)
183187 val rows = (0 until 100).map(::row)
184188 try {
185189 instrumentation.runOnMainSync {
186190 list.onScrollEvent = { scrollCount.incrementAndGet() }
187191 list.onMomentumScrollBegin = { momentumBeginCount.incrementAndGet() }
188 list.onMomentumScrollEnd = { momentumEndCount.incrementAndGet() }
192 list.onMomentumScrollEnd = {
193 momentumEndCount.incrementAndGet()
194 momentumEnded.countDown()
195 }
189196 list.apply(rows, false, 1, false, 0.1, renderer(context, AtomicInteger()), { _ -> }, { _ -> }, null)
190197 }
191198 awaitCount(list, 100)
192199 instrumentation.runOnMainSync {
193200 attach(list)
194 list.smoothScrollToPosition(99)
195 }
196 repeat(50) {
197 if (momentumEndCount.get() > 0) return@repeat
198 SystemClock.sleep(50)
201 // Exercise a real viewport-sized animation, rather than
202 // coupling callback delivery to a 99-row traversal's duration.
203 list.smoothScrollBy(0, list.height)
199204 }
205 assertTrue("RecyclerView did not finish its native momentum animation", momentumEnded.await(2500, TimeUnit.MILLISECONDS))
200206 assertTrue("RecyclerView did not emit scroll callbacks", scrollCount.get() > 0)
201207 assertEquals(1, momentumBeginCount.get())
202208 assertEquals(1, momentumEndCount.get())
209 instrumentation.runOnMainSync { assertEquals(RecyclerView.SCROLL_STATE_IDLE, list.scrollState) }
203210 } finally {
204211 scenario.close()
205212 }
formatting only · 9 hidden lines
Changes to packages/android/fixtures/native-navigation/NativeFlatListTest.kt
@@ -309,8 +316,8 @@ class NativeFlatListTest { formatting only
309316 View.MeasureSpec.makeMeasureSpec(1_000, View.MeasureSpec.AT_MOST),
310317 )
311318 list.layout(0, 0, list.measuredWidth, list.measuredHeight)
319 assertTrue("non-scrolling FlatList should include every row", list.measuredHeight >= rows.size * 44)
312320 }
313 assertTrue("non-scrolling FlatList should include every row", list.measuredHeight >= rows.size * 44)
314321 repeat(100) {
315322 if (contentSizeChanges.get() > 0) return@repeat
316323 SystemClock.sleep(10)