Environment: react-native-figma-squircle@0.4.0, React Native (New Architecture)
When multiple SquircleView components are placed in a flexDirection: "row" container with flex: 1, the squircle background can render at incorrect dimensions — often appearing visually squashed or mismatched compared to sibling views.
Reproduction:
<View style={{ flexDirection: "row", gap: 8 }}>
<Pressable style={{ flex: 1, height: 44 }}>
<SquircleView
style={StyleSheet.absoluteFill}
squircleParams={{ cornerSmoothing: 1, cornerRadius: 22, fillColor: "blue" }}
/>
<Text>Subscribe</Text>
</Pressable>
<Pressable style={{ flex: 1, height: 44 }}>
<SquircleView
style={StyleSheet.absoluteFill}
squircleParams={{ cornerSmoothing: 1, cornerRadius: 22, fillColor: "transparent", strokeColor: "gray", strokeWidth: 1 }}
/>
<Text>Message</Text>
</Pressable>
</View>
Expected: Both buttons render identically-sized squircle backgrounds.
Actual: The first button's squircle renders at wrong dimensions (often appearing squashed), while the second renders correctly — or vice versa. The behavior is inconsistent across mounts.
Root cause: The internal Rect component (src/index.tsx L143–165) uses useLayoutEffect with an empty dependency array [] and measureInWindow to capture dimensions:
useLayoutEffect(() => {
ref.current?.measureInWindow((_x, _y, width, height) => {
setRect({ width, height })
})
}, []) // ← never re-runs
This has two problems:
- Measures once, never updates — if the view's bounds change after mount (screen rotation, flex resolution, dynamic content), the SVG path is permanently stale.
- Flex timing race — in flex containers,
measureInWindow fires during the initial layout pass. When multiple flex siblings are resolving their widths simultaneously, the callback can capture intermediate/pre-resolution dimensions. The SVG path is then computed for a width the view no longer has.
Environment:
react-native-figma-squircle@0.4.0, React Native (New Architecture)When multiple
SquircleViewcomponents are placed in aflexDirection: "row"container withflex: 1, the squircle background can render at incorrect dimensions — often appearing visually squashed or mismatched compared to sibling views.Reproduction:
Expected: Both buttons render identically-sized squircle backgrounds.
Actual: The first button's squircle renders at wrong dimensions (often appearing squashed), while the second renders correctly — or vice versa. The behavior is inconsistent across mounts.
Root cause: The internal
Rectcomponent (src/index.tsxL143–165) usesuseLayoutEffectwith an empty dependency array[]andmeasureInWindowto capture dimensions:This has two problems:
measureInWindowfires during the initial layout pass. When multiple flex siblings are resolving their widths simultaneously, the callback can capture intermediate/pre-resolution dimensions. The SVG path is then computed for a width the view no longer has.