Expo modules on the desktop
Some of @ng-native/expo's services answer from modules of the host's own, named NgNative and
the package's name after expo-, each with the methods the service calls on the Expo package:
| Module | What it does |
|---|---|
NgNativeSecureStore |
Items in the Keychain (the Data Protection keychain when the app is signed with a Team ID and an app identity), under the app's id or the keychainService a call names, refusing the keys expo-secure-store refuses. |
NgNativeClipboard |
Reads and writes the pasteboard's text. Clipboard.changes() counts its ngNativeClipboard events on DeviceEventEmitter, sent when the pasteboard's change count has moved. |
NgNativeKeepAwake |
Keeps the display awake with an IOKit power assertion while any tag holds it. |
NgNativeHaptics |
Plays the trackpad's feedback for an impact, a selection and a notification. |
NgNativeSqlite |
expo-sqlite's databases over the system's sqlite3. See Database. |
NgNativeLocalAuthentication |
Biometrics over LAContext. See Biometrics. |
NgNativeFileSystem |
FileSystem's files over uris. See File system. |
NgNativeLocation |
The foreground permission, one fix and a watch over CLLocationManager, and geocoding over CLGeocoder. See Location. |
NgNativeCrypto |
Crypto over CommonCrypto and the system's secure random source: UUIDs, random bytes and the SHA-1, SHA-2, MD2, MD4 and MD5 digests. Bytes cross as {base64}, and the desktop loader answers them as Uint8Array and ArrayBuffer. |
NgNativeNetwork |
Network over Network.framework's path monitor: connected and reachable when a route exists, and the type of the interface it uses (WIFI, ETHERNET, CELLULAR, OTHER, or NONE). Changes arrive as ngNativeNetwork events. |
NgNativeBattery |
Battery over IOKit's power sources and Low Power Mode: the level, and UNPLUGGED, CHARGING, FULL or NOT_CHARGING (on the adapter and held below full). A Mac with no battery answers -1 and UNKNOWN. Changes arrive as ngNativeBattery events. |
NgNativeFont |
Fonts over CTFontManager: registers a font file for the app's process under a name, from a file: uri or downloaded from the dev server first. Text that asks for the name is set in that font's family, with its weight picked among the faces loaded, as expo-font's alias does on iOS. |
NgNativeWebBrowser |
Browser: open() hands an http or https url to the default browser, by the url policy Linking and Shell use, and signIn() runs an ASWebAuthenticationSession on the key window, ending on the redirect url's scheme, one at a time. With NGN_NO_PROMPTS=1 a sign-in answers as cancelled without starting. |
NgNativeTextRecognition |
TextRecognition over Vision, as the iOS module: the lines in an image file, each with its confidence and its box in pixels from the top left, the file's orientation applied. |
NgNativeCalendar |
Calendar over EventKit: the calendar and reminders permissions (write-only access grants a write-only ask), and with full access the calendars, the default calendar, the sources and the events in a range, as plain records. It asks only when the app's Info.plist has the usage string, and with NGN_NO_PROMPTS=1 never. Without access it reads nothing. With access, events are created (write-only access is enough), updated and deleted, and reminders listed, read, created, updated and deleted, with alarms and a recurrence rule; without it each write rejects, naming the permission to ask for. A calendar or a reminder list is created (createCalendarAsync: title, colour, kind, and the source, by default the one the default calendar of its kind is in) and deleted with full access to its kind. |
NgNativeStoreReview |
StoreReview: in a Mac App Store (mas) build, request() asks SKStoreReviewController for the system's rating prompt (not with NGN_NO_PROMPTS=1); in any other build it is inert and available() is false. storeUrl() is null. |
NgNativeAudio |
audioPlayer and audioRecorder over AVPlayer and AVAudioRecorder. A player plays a file: or http(s): source or an asset, with its rate (0 to 2, pitch kept), volume, mute and loop, and sends expo-audio's status as it loads, plays, seeks and ends, and at its update interval while it plays. A recorder records to the app's caches with the ios options, once the microphone is allowed: it asks only when the app's Info.plist has NSMicrophoneUsageDescription, never with NGN_NO_PROMPTS=1, and a Mac with no microphone cannot prepare one. No audio sampling or lock screen controls. |
NgNativeVideo |
videoPlayer over AVPlayer and <expo-video> over AVPlayerView, as expo-video on iOS. A player plays a file: or http(s): source or an asset, with its rate, volume, mute, loop and pitch, and sends expo-video's events with their iOS payloads: statusChange, playingChange, sourceChange, sourceLoad, timeUpdate at its interval while it plays, playToEnd, and each setter's change. The view (ViewManagerAdapter_ExpoVideo_VideoView) finds its player by the number player.id binds, takes nativeControls, contentFit, fullscreenOptions.enable, allowsPictureInPicture, showsTimecodes and allowsVideoFrameAnalysis, and sends firstFrameRender and the full screen and picture in picture events. Full screen moves AVKit's view out of the app and back; a view unmounted meanwhile leaves the video showing until the user leaves full screen. No tracks, thumbnails, live streams, DRM or now-playing controls, and requiresLinearPlayback does nothing. |
NgNativeLocalLlm |
LanguageModel over Apple's Foundation Models on macOS 26 and later, as expo-local-llm on iOS: the availability (notEligible before macOS 26, notEnabled with Apple Intelligence off, notReady while the model is prepared), sessions with instructions and sampling options, answers whole or streamed, structured answers to a schema, and tools whose calls the app answers. It checks the availability again when the app comes to the front. |
NgNativeScreenCapture |
ScreenCapture: while any key is held, every window of the app, the ones it opens after and the system's panels among them, has an NSWindow sharingType of none, which asks macOS to keep it out of screenshots, recordings and screen sharing. This is best effort: from macOS 15, an app capturing through ScreenCaptureKit can still capture it. A reload lets capture back. macOS tells an app of no screenshot, so screenshots stays at zero, and it shows no snapshot of an app in the background, so protectAppSwitcher() does nothing. |
NgNativeSplashScreen |
splashScreen: a Mac app has no launch screen, so holding the splash keeps the app's first windows hidden past their first frame until hideAsync(), which shows them in the order they were ready. A hold after a window has shown answers false and holds nothing, and a reload lets the held windows show. |
NgNativeMediaLibrary |
MediaLibrary over PhotoKit: the read and add-only permissions, queries with every filter, sort, limit, offset and album, each asset's details and file, saving a file (into an album too), favourites, deleting, albums and their assets, and the library's changes once something watches. It asks only when the app's Info.plist has NSPhotoLibraryUsageDescription (or NSPhotoLibraryAddUsageDescription for saving), never with NGN_NO_PROMPTS=1, and without access reads nothing and refuses every write. macOS has no limited library, so presentPermissionsPicker() does nothing. |
NgNativeImagePicker |
ImagePicker's library half: pick() shows the system's photo picker as a sheet on the key window (780 by 560 points, or 20 points in from a smaller window), which needs no permission, and copies what is picked into the app's caches. libraryPermission is the photo library's. macOS has no system camera screen, so capture() shows the host's own as a sheet on the window in front (the same size as the picker's): the camera's preview, mirrored as Photo Booth shows it, with Cancel (Escape) and Take Photo (Return). The photo is a JPEG at quality, not mirrored, in the app's caches, shaped as iOS shapes a camera shot (no assetId or fileName; base64 and exif when asked). With mediaTypes asking for videos the shutter is Record, then Stop, and a request for both adds a Photo and Video switch; the video is a QuickTime .mov, not mirrored, at videoQuality, stopped at videoMaxDuration, with its duration in milliseconds. A request for videos asks for the microphone when undetermined, records with no sound when it is refused, and rejects with iOS's message only when the app has no NSMicrophoneUsageDescription. cameraPermission is the camera's, asked only when the app's Info.plist has NSCameraUsageDescription and never with NGN_NO_PROMPTS=1, which also shows no sheet. On a Mac with no camera capture() rejects. |
NgNativeTrackingTransparency |
Tracking over App Tracking Transparency: the permission, asked only when the app's Info.plist has NSUserTrackingUsageDescription and never with NGN_NO_PROMPTS=1, and the advertising identifier once tracking is allowed (null where macOS answers zeros). |
NgNativeImageManipulator |
ImageEditor over ImageIO and Core Graphics, as expo-image-manipulator on iOS: resize (to a width or a height keeping the ratio), rotate, flip and crop, applied in order to the image the right way up, after scaling it into maxWidth and maxHeight, and saved as JPEG at the compress quality or as PNG into the app's caches, with its base64 when asked. The source is a file: uri, a path, a data: uri or an asset from the dev server. macOS cannot write WebP, so saving as WebP rejects. |
NgNativePrint |
Printing over NSPrintOperation: print() shows the print panel as a sheet on the key window (app-modally with none) for HTML, laid out by WebKit, or for the PDF or image a file:, data: or http(s): uri names, and resolves once it closes, printed or cancelled. printToPdf() lays the HTML out on pages of its size (US Letter by default) into a PDF in the app's caches, breaking pages where the CSS asks. print({ window }) prints what the window on that surface shows, drawn as on screen and scaled to the paper, with the panel as a sheet on it (a web view as WebKit's snapshot of its page; video, the camera preview and Metal content print blank, as capturing them needs the Screen Recording permission); File > Print... (Command-P) in the default menu bar does the same for the key window unless the app gives a print item a handler. macOS has no printer picker: selectPrinter() answers null and a printer passed to print() is ignored. With NGN_NO_PROMPTS=1 print() shows nothing. |
NgNativeCamera |
<expo-camera> and Camera: the host draws the view (ViewManagerAdapter_ExpoCamera) as an AVCaptureSession's preview from the built-in camera (or the first other there is, facing either way; never a suspended one, such as a MacBook's with the lid closed, and with none left mountError says the Mac has no camera), started while active once the camera is allowed and present, with cameraReady, or mountError with expo-camera's message when the permission is not granted or the Mac has no camera. The view asks for the permission as it mounts only when the app's Info.plist has NSCameraUsageDescription, never with NGN_NO_PROMPTS=1. takePicture() writes a JPEG at its quality into the app's caches, or with imageType: 'png' a PNG, as on iOS, and record() a QuickTime movie there through an AVCaptureMovieFileOutput, until stopRecording(), its maxDuration or maxFileSize, or the view going, in its codec when this Mac writes it, with sound only when the microphone is already allowed (never asked) and the view has no mute as the recording starts. |
NgNativeMaps |
<expo-map> (registerExpoMap('macos')): the host draws expo-maps' Apple view (ViewManagerAdapter_ExpoAppleMaps) with an MKMapView, taking the iOS props: markers (title, tint, SF Symbol or monogram), polylines (geodesic too), polygons and circles, cameraPosition, the map type, elevation, emphasis, traffic and points of interest, the compass, scale and pitch controls, and the colour scheme. It sends cameraMove once as it appears and as the region changes, markerClick when a marker is selected, polygonClick, circleClick or polylineClick for a click on a shape (polylines within polylineTapThreshold metres), and mapClick otherwise. setCameraPosition() and selectMarker() reach the view by its tag. The user's location shows only once location is allowed: the map never asks. macOS has no location button, and selectionEnabled does nothing. |
NgNativeAddressSearch |
AddressSearch, the module the iOS app has, over MapKit: a completer for each search, suggesting as the query changes (later answers for the same query arrive as ngNativeAddressSearch events), and MKLocalSearch for the address of a picked suggestion of the latest answer. The region option looks only in that country from macOS 15, and there first before. It needs no permission. |
NgNativeAppleAuthentication |
AppleSignIn over AuthenticationServices, as expo-apple-authentication on iOS: Apple's sheet on the key window for a sign-in, refresh or sign-out, with expo's credential and error codes, the credential state, names formatted by the system, and revocations as ngNativeAppleAuthentication events. Only an app signed with the com.apple.developer.applesignin entitlement can sign in: without it (a development host has none; package adds it, see Package the app) available() is false and a request is refused with ERR_REQUEST_NOT_HANDLED before any sheet. With NGN_NO_PROMPTS=1 a request fails as not interactive. The host draws <apple-sign-in-button> (ViewManagerAdapter_ExpoAppleAuthentication) as ASAuthorizationAppleIDButton, with expo's buttonType, buttonStyle and cornerRadius, and sends buttonPress on a click. |
NgNativeAsset |
assets(): each module resolves as an image's does, and its localUri is its file on the Mac. An asset the dev server serves is downloaded into the app's caches as ExponentAsset-<hash>.<type> first, once per hash; a packaged app's is the file in the app. |
NgNativeSymbol |
<expo-symbol>'s size: the symbol image's at a point size, weight and scale, as the iOS module answers it. The host draws the view itself (ViewManagerAdapter_SymbolModule) with AppKit's symbol configuration: the type, tint, palette, weight and scale, built at the system font size and placed by resizeMode, as expo-symbols does on macOS. animationSpec plays nothing. |
NgNativeApplication, NgNativeDevice |
AppInfo: the bundle's version, build, id and name (a dev run, with no bundle, gives the app's id and name and no versions), and the Mac's model, macOS version and desktop device type. |
The clipboard has no change notification, so the host checks the count when the app becomes active and after each key press, click and menu command, and never polls.
The other services with a desktop source in DESKTOP_MODULES throw MissingModuleError on first
use until the host has their module.
On Linux
The GTK host answers some of the same modules. NgNativeSecureStore keeps items in the Secret
Service (GNOME Keyring or KWallet) through libsecret, under a schema named for the app's id with the
item's service and key, and through the Secret portal inside a Flatpak. With no Secret Service
running or able to start, there is no store and SecureStore is absent: secrets are never written to
a file. NgNativeKeepAwake holds the session idle through the desktop's Inhibit portal, and
NgNativeFileSystem watches with GFileMonitor. NgNativeImagePicker's pick() opens the
FileChooser portal with an image or video filter, and capture() the host's own camera window (see
ImagePicker). NgNativeCamera takes the camera through the
Camera portal and PipeWire (see Camera), and is absent without GStreamer's
PipeWire plugin. NgNativeSplashScreen holds the app's first windows hidden until hideAsync(), as
on macOS. NgNativeAudio and NgNativeVideo play (and record audio) through GStreamer (see
Players).
A module the GTK host has no source for, such as NgNativeHaptics or NgNativeCalendar, is not
registered, and the host's NgNativeHost module names it in absentModules. Its service is absent:
available() is false and every call does nothing, rather than throwing a MissingModuleError that
says to rebuild the host. Linux has no push service, so Notifications.getDevicePushToken() answers
null.