1.2.0 • Published 5 years ago

expo-graphics-rnge v1.2.0

Weekly downloads
11
License
MIT
Repository
github
Last release
5 years ago

NPM


expo-graphics

Tools to help simplify and manage GL/AR state.

Installation

yarn add expo-graphics

Usage

Import the library into your JavaScript file:

import ExpoGraphics from 'expo-graphics';

Components

ExpoGraphics.View

A view that assists with common GL and AR tasks.

Props

PropertyTypeDefaultDescription
isArEnabled?booleannullEnables an ARKit context: iOS Only
isArRunningStateEnabled?booleannullAdds a toggle for ARKit running state: iOS Only
isArCameraStateEnabled?booleannullRenders information related to ARKit the tracking state: iOS Only
arTrackingConfiguration?AR.TrackingConfigurationnullEnables an ARKit context: iOS Only
arRunningProps?object{}Props for optional ARRunningState: iOS Only
arCameraProps?object{}Props for optional ARCameraState: iOS Only
isShadowsEnabled?booleanfalseOverrides the render buffer allowing for shadows, this works by default on Android: iOS Only
onContextCreate({gl, canvas?, width, height, scale, arSession?}) => PromisenullCalled with the newly created GL context, and optional arSession
onShouldReloadContext() => booleannullA delegate function that requests permission to reload the GL context when the app returns to the foreground
onResize(layout: Layout) => voidnullInvoked when the view changes size, or the device orientation changes, returning the {x, y, width, height, scale}
shouldIgnoreSafeGuards?booleannullThis prevents the app from stopping when run in a simulator, or when AR is run in devices that don't support AR

ExpoGraphics.ARCameraState

Information related to the AR camera's tracking state.

Props

PropertyTypeDefaultDescription
titleStyle?objectnullThe style of the title Text
subtitleStyle?objectnullThe style of the subtitle Text
trackingStateStyles?{AR.TrackingState: object}nullThe title text style used with each TrackingState
AR.TrackingStateReason.None{title:string, subtitle:string}{ title: 'Having trouble collecting data' }Used when the AR camera isn't available
AR.TrackingStateReason.Initializing{title:string, subtitle:string}{ title: 'Initializing, subtitle: 'Move the camera around for better results' }The camera is starting to collect data
AR.TrackingStateReason.ExcessiveMotion{title:string, subtitle:string}{ title: 'Excessive motion', subtitle: 'Try moving your camera slower' }The device is moving too fast
AR.TrackingStateReason.InsufficientFeatures{title:string, subtitle:string}{title: 'insufficient features', subtitle: 'Try moving your camera around more'}The camera hasn't collected enough data
AR.TrackingStateReason.Relocalizing{title:string, subtitle:string}{ title: 'Having trouble collecting data' }The camera is reseting

ExpoGraphics.ARRunningState

A button used for toggling the AR state

Props

PropertyTypeDefaultDescription
onPress?FunctionnullCalled whenever the button is toggled.