MCPcopy Create free account
hub / github.com/Effect-TS/effect / headers

Function headers

packages/ui/native/test/Animation.test.ts:299–322  ·  view source on GitHub ↗
(os: string)

Source from the content-addressed store, hash-verified

297const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
298
299const headers = async (os: string) => {
300 const mounted = await mount(
301 (root) => Renderer.mount(Headers, {}, root),
302 os
303 )
304 const { fabric, find } = mounted
305 const a = () => find((n) => n.props.height === 50)
306 const b = () => find((n) => n.props.height === 40)
307 const scroller = () => find(FakeFabric.byName("RCTScrollView"))
308 const content = () => find(FakeFabric.byName("RCTScrollContentView"))
309 // Where native lays them out, inside the content view at y 10.
310 const place = (ya: number, yb: number) => {
311 fabric.place(scroller(), [0, 0, 390, 500])
312 fabric.place(content(), [0, 10, 390, 1000])
313 fabric.place(a(), [0, 10 + ya, 390, 50])
314 fabric.place(b(), [0, 10 + yb, 390, 40])
315 }
316 const shown = (n: { readonly tag: number }) => (animated.view(n.tag)?.transform as any)?.[0].translateY
317 const scroll = (y: number) => {
318 animated.scroll(scroller().tag, { y })
319 fabric.emit(scroller(), "topScroll", { contentOffset: { y } })
320 }
321 return { ...mounted, a, b, scroller, place, shown, scroll }
322}
323
324// Like React Native's, the fake animated module is shared by every surface,
325// so tests that count its nodes run one at a time.

Callers 1

Animation.test.tsFile · 0.70

Calls 2

mountFunction · 0.70
mountMethod · 0.65

Tested by

no test coverage detected