Skip to content

Gate ​

setGate() ​

Call Signature ​

ts
function setGate(gate, resolve?): void;

Raises the gate with default chrome, optionally with a per-request resolver. Calling it again while a gate is already up updates the chrome in place, keeping the current tab. Note this is not fully navigation-preserving: on some surfaces (CarPlay) any gate change pops pushed navigation back to root, so a page the user had drilled into is reset to the tab root. Set the gate before the car connects and it'll be there the moment it does.

Parameters ​

ParameterType
gateGate
resolve?GateResolver

Returns ​

void

Platform ​

ios android A no-op on web, which has no CarPlay or Android Auto surfaces for the gate to cover. Nothing is lost: the gate never covered in-app browse UI on any platform — that stays yours to gate.

Call Signature ​

ts
function setGate(resolve): void;

Raises the gate with a resolver only (no default chrome). The resolver must return a Gate or true for gated requests; native uses the built-in fallback chrome when true and no default is set.

Parameters ​

ParameterType
resolveGateResolver

Returns ​

void

Platform ​

ios android A no-op on web — the resolver is never consulted there.


clearGate() ​

ts
function clearGate(): void;

Drops the gate — the real content comes back. Android Auto keeps the current tab; CarPlay rebuilds its tab bar on the first tab.

Returns ​

void

Platform ​

ios android A no-op on web, where no gate was ever raised.


onGate ​

ts
const onGate: LazyNativeEmitter<GateEvent>;

Subscribes to gate events (fired when a request is gated).

Platform ​

ios android Never fires on web — there are no gated serves to report.

Returns ​

An emitter — subscribe with addListener(callback), which returns a cleanup function


GateEvent ​

ts
type GateEvent = object;

Fired once per gated serve (each time the gate chrome is rendered for a request). This is not once per user action: on car surfaces a single action can serve the gate for several requests at once — e.g. building the tab bar resolves and serves each gated tab, firing one event per gated tab. There is no library-side dedup; debounce on the consumer side (e.g. record a gate-hit at most once per session).

Properties ​

reason ​

ts
reason: GateReason;

Gate ​

ts
type Gate = object;

A gate's chrome (title and optional message).

While the gate is up, a gated browse or search on CarPlay or Android Auto shows this page instead of the content, and a gated voice search (Siri on iOS, Google Assistant on Android, including from the phone) is refused. Playback and the queue are unaffected.

  • CarPlay: plain centered message page. Now Playing keeps its transport controls but hides the carPlayNowPlayingButtons.
  • Android Auto: one non-playable list tile, with the title as its main line and the message as its subtitle.

Properties ​

title ​

ts
title: string;

Headline shown on the gate page.

message? ​

ts
optional message: string;

The explanatory copy under the title: the centered message body on CarPlay, the tile subtitle on Android Auto. Newlines become spaces on both.


GateReason ​

ts
type GateReason = "browse" | "search";

Discriminant for gate requests and events.


GateRequest ​

ts
type GateRequest = 
  | {
  kind: "browse";
  path: string;
}
  | {
  kind: "search";
  params: SearchParams;
};

Describes the request being decided by a GateResolver. Discriminated by kind: 'browse' for content navigation, 'search' for voice/manual search queries.


GateResolver() ​

ts
type GateResolver = (request) => Gate | boolean;

Decides per request whether to gate.

  • Return a Gate to gate with specific chrome for this request.
  • Return true to gate using the default chrome (or the built-in fallback).
  • Return false to allow the request through.
  • If the resolver throws, the request is gated (fails closed): only false lets a request through.

Parameters ​

ParameterType
requestGateRequest

Returns ​

Gate | boolean