@flip-engine/binding-native
v0.1.2
Published
React Native platform binding for @flip-engine/core — reanimated (output/clock), gesture-handler (input), onLayout (measure), AccessibilityInfo (env). The native counterpart of binding-dom. Zero DOM.
Maintainers
Readme
@flip-engine/binding-native
React Native platform binding (L3) — the native counterpart of
@flip-engine/binding-dom. It implements the core's four
ports with zero DOM:
| Port | Native implementation |
|---|---|
| output.setVisual({ progress, angle }) | writes two reanimated shared values (an useAnimatedStyle in the adapter maps angle → rotateY and progress → shadow opacity) |
| output.setAppearance / setDragging | state callbacks the adapter stores |
| measure.* | the spread geometry last reported by the adapter's onLayout / measureInWindow |
| clock.* | requestAnimationFrame / cancelAnimationFrame / performance.now |
| env.* | AccessibilityInfo reduce-motion (cached, since the port is sync) |
Only numbers cross the boundary — never a <View> or a StyleSheet object.
import { createNativeBinding } from '@flip-engine/binding-native';
import { createFlipEngine } from '@flip-engine/core';
const binding = createNativeBinding({ progress, angle, onAppearance, onDragging, getGeometry });
const engine = createFlipEngine(binding, options);
// the adapter forwards the Pan gesture straight into the engine:
engine.pointerDown(absoluteX, t); engine.pointerMove(absoluteX, t); engine.pointerUp();Peer deps: react-native >= 0.74, react-native-reanimated >= 3,
react-native-gesture-handler >= 2. The high-level component lives in
@flip-engine/react-native — most consumers use that, not this
binding directly; see the React Native guide.
The full port mapping and the rationale are in the
native binding guide and ports.md.
