ReviewOS

also looking at this

stacks/stx

fix(native): preserve explicit grid row tracks

#2092
Merged chris wants to merge codex/native-explicit-grid-rows into main
5 files +42 -4
packages/stx/test/native/reactive-inline-style.test.tsmodified+21-0
Changes to packages/stx/test/native/reactive-inline-style.test.ts
@@ -2,6 +2,27 @@ import { describe, expect, it } from 'bun:test'
22import { compileNativeScreen, mountNativeScreen } from '../../src/native/testing'
33
44describe.each([false, true])('reactive native inline styles (minify=%s)', (minify) => {
5 it('delivers explicit grid rows through the compiled native bundle and clears changed tracks', async () => {
6 const { code } = await compileNativeScreen(`<script client>
7const tracks = state({ gridTemplateRows: 'repeat(2, 1fr)' })
8</script><View testID="grid" style="display:grid;height:84px" :style="tracks">
9 <View testID="static-grid" style={{"display":"grid","gridTemplateRows":"repeat(2, 1fr)","height":84}} />
10 <Button testID="change" @click="tracks.set({gridTemplateRows:3})">Change rows</Button>
11 <Button testID="clear" @click="tracks.set({})">Clear rows</Button>
12</View>`, { minify })
13 const phone = mountNativeScreen(code, 'Screen')
14 await phone.settle()
15 expect(phone.byTestID('static-grid')!.style).toMatchObject({ display: 'grid', height: 84, gridTemplateRows: 'repeat(2, 1fr)' })
16 expect(phone.byTestID('grid')!.style).toMatchObject({ display: 'grid', height: 84, gridTemplateRows: 'repeat(2, 1fr)' })
17 phone.press(phone.byTestID('change')!)
18 await phone.settle()
19 expect(phone.byTestID('grid')!.style.gridTemplateRows).toBe(3)
20 phone.press(phone.byTestID('clear')!)
21 await phone.settle()
22 expect(phone.byTestID('grid')!.style.gridTemplateRows).toBeNull()
23 phone.unmount()
24 }, 30_000)
25
526 it('normalizes CSS and objects, clears previous values, and protects hidden nodes', async () => {
627 const { code } = await compileNativeScreen(`<script client>
728const styles = state('padding-left:12px;font-size:1.5rem;width:50%;font-weight:700')