Skip to main content

REACT NATIVE · NEW ARCHITECTURE

Hinge posture.
Native angles.

Read hinge posture and angle through a React hook. Share the same native snapshot with code outside React through a scoped observer.

react-native-hinges

Animate from native hinge snapshots with the Reanimated integration.

NATIVE HINGE STATErad
partiallyOpen
hinge
1.57 rad
1.57 rad
Hierarchy Posture AngleIllustrative controls and readings
01 / SCOPE

Scope the observation.

Observe the existing React root. Each root has its own hinge snapshot, with no extra native view.

Use the hook →
02 / STATE

Read what is available.

Native posture and a nullable angle describe each hinge. Arrays support more than one hinge without guessing sensor associations.

Read the type contract →
03 / NATIVE

Keep the native meaning.

UIKit hinge interactions and Android folding features share an API with explicit platform differences.

See native mappings →

ONE SNAPSHOT. TWO WAYS TO READ.

React and beyond.

Use useHinges() inside your React Native app for reactive updates.

For other consumers, create an observer and use get() and subscribe() with the same root tag.

Observe outside React →
Inside your React root
const hinges = useHinges();

for (const hinge of hinges) {
const { status, angle } = hinge;

const degrees = angle === null
? null
: angle * 180 / Math.PI;
}

SEE THE NUMBERS

Change the posture. Read the state.

Run the native example on a supported device or foldable emulator to inspect posture and available angle readings.

Run the example →