Close Screen
1. Close screen (closeView)
This function closes the current screen. You can use it to exit the service by pressing the "Close" button.
Signature
function closeView(): Promise<void>;Example
import { Button } from 'react-native';
import { closeView } from '@granite-js/react-native';
function CloseButton() {
return <Button title="Close" onPress={closeView} />;
}2. Set up iOS swipe back (setIosSwipeGestureEnabled)
Enables or disables the swipe-back gesture on iOS.
Signature
function setIosSwipeGestureEnabled(options: { isEnabled: boolean }): Promise<void>;Parameters
options.isEnabled · Required ·
booleantrueWhen true, you can go back by swiping,falseWhen false, swipe-back is disabled.
Example
3. Control back events (useBackEvent)
This is a Hook that lets you register and remove back events. You can handle back events only while a specific component is active.
Signature
Return value
BackEventControls
An object that controls back events.
addEventListenerto register an event,removeEventListenerto remove it.
Example
Last updated
Was this helpful?