@wallsnap/react-native
v0.1.0
Published
Native WallSnap scene renderer and drag hooks for React Native and Expo.
Maintainers
Readme
@wallsnap/react-native
Native React Native and Expo components for a true-to-scale WallSnap room preview. Geometry,
clamping, and frame SVGs come directly from @wallsnap/core; the native adapter adds only layout,
PanResponder gestures, and accessible move actions.
const drag = useArtDrag();
const layout = computeSceneLayout(wall, frame, size, drag.offset, container.size);
return layout ? (
<View onLayout={container.onLayout}>
<WallScene
scene={{ wall, layout, wallImage: { uri: wallUrl } }}
artwork={{ frame, image: { uri: artworkUrl } }}
interaction={drag.bind(layout)}
/>
</View>
) : null;Peer requirements are React 19, React Native 0.82 or newer (New Architecture only), and
react-native-svg 15. The component has no native dependency beyond that renderer, so it works in
Expo Go. The current gesture implementation uses built-in PanResponder.
Android drag benchmark
The Sprint 7 low-end check ran in Expo Go 57.0.3 on an Android 16 emulator configured with one
vCPU, 2,018,744 kB RAM, a 1080 x 2400 60 Hz display, and headless SwiftShader rendering. A real
PanResponder gesture moved the artwork control from [460,706][640,935] to
[695,847][874,1076], confirming that the measured path exercised the component rather than a
mock.
Each trial reset dumpsys gfxinfo, performed ten pairs of alternating 350 ms drags, and then read
the Expo Go process's frame statistics:
| Trial | Frames | Janky frames | p50 | p90 | p95 | p99 | | ------ | -----: | -----------: | ---: | ---: | ---: | ----: | | 1 | 229 | 66.81% | 32ms | 69ms | 93ms | 150ms | | 2 | 299 | 36.12% | 26ms | 36ms | 42ms | 150ms | | 3 | 342 | 41.23% | 26ms | 46ms | 48ms | 61ms | | Median | 299 | 41.23% | 26ms | 46ms | 48ms | 150ms |
Verdict: PanResponder did not sustain the 60 fps target on this profile. Expo Go development
mode and software rendering add overhead, so a physical low-end Android or release-like build
should confirm the result before adding dependency weight.
The intended upgrade is currently blocked for this Expo example. Expo SDK 57.0.12 declares
react-native-gesture-handler ~2.32.0, react-native-reanimated 4.5.1, and
react-native-worklets 0.10.1 in its bundled-native-module manifest, while the current Gesture
Handler v3 release is 3.2.0. Expo Go 57.0.3 therefore contains the 2.x native runtime and cannot
safely load the requested v3 JavaScript API. Do not force that native/JavaScript major-version
mismatch. The available paths each require a release decision:
- Use Expo SDK 57's Gesture Handler 2.32 with Reanimated 4.5.1, accepting the deviation from the v3 requirement.
- Use Gesture Handler v3 in a custom development build, giving up Expo Go compatibility.
- Keep
PanResponderuntil an Expo SDK and Expo Go release bundle Gesture Handler v3.
MIT licensed.
