first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
/**
* Base type of the events map, whose keys represent supported event names
* and values are the signatures of the listener for that specific event.
*/
export type EventsMap = Record<string, (...args: any[]) => void>;
/**
* A subscription object that allows to conveniently remove an event listener from the emitter.
*/
export type EventSubscription = {
/**
* Removes an event listener for which the subscription has been created.
* After calling this function, the listener will no longer receive any events from the emitter.
*/
remove(): void;
};
/**
* A class that provides a consistent API for emitting and listening to events.
* It shares many concepts with other emitter APIs, such as Node's EventEmitter and `fbemitter`.
* When the event is emitted, all of the functions attached to that specific event are called *synchronously*.
* Any values returned by the called listeners are *ignored* and discarded.
* Its implementation is written in C++ and common for all the platforms.
*/
export declare class EventEmitter<TEventsMap extends EventsMap = Record<never, never>> {
/**
* A dummy private property with the given generic type. It is required for TypeScript to correctly infer this subtype.
* E.g. `useEvent` would not be able to infer the events map which results in accepting any string as the event name.
* @private
* @deprecated
*/
_TEventsMap_DONT_USE_IT?: TEventsMap;
/**
* Creates a new event emitter instance.
*/
constructor();
/**
* @deprecated As of Expo SDK 52 the given object is already an EventEmitter.
* Creating a new one is not necessary.
* @hidden
*/
constructor(object: EventEmitter);
/**
* Adds a listener for the given event name.
*/
addListener<EventName extends keyof TEventsMap>(eventName: EventName, listener: TEventsMap[EventName]): EventSubscription;
/**
* Removes a listener for the given event name.
*/
removeListener<EventName extends keyof TEventsMap>(eventName: EventName, listener: TEventsMap[EventName]): void;
/**
* Removes all listeners for the given event name.
*/
removeAllListeners(eventName: keyof TEventsMap): void;
/**
* Synchronously calls all the listeners attached to that specific event.
* The event can include any number of arguments that will be passed to the listeners.
*/
emit<EventName extends keyof TEventsMap>(eventName: EventName, ...args: Parameters<TEventsMap[EventName]>): void;
/**
* Returns a number of listeners added to the given event.
*/
listenerCount<EventName extends keyof TEventsMap>(eventName: EventName): number;
/**
* Function that is automatically invoked when the first listener for an event with the given name is added.
* Override it in a subclass to perform some additional setup once the event started being observed.
*/
startObserving?<EventName extends keyof TEventsMap>(eventName: EventName): void;
/**
* Function that is automatically invoked when the last listener for an event with the given name is removed.
* Override it in a subclass to perform some additional cleanup once the event is no longer observed.
*/
stopObserving?<EventName extends keyof TEventsMap>(eventName: EventName): void;
}
//# sourceMappingURL=EventEmitter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/EventEmitter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,MAAM,IAAI,IAAI,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,UAAU,SAAS,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;IACnF;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,UAAU,CAAC;IAErC;;OAEG;;IAGH;;;;OAIG;gBACS,MAAM,EAAE,YAAY;IAEhC;;OAEG;IACH,WAAW,CAAC,SAAS,SAAS,MAAM,UAAU,EAC5C,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,GAC9B,iBAAiB;IAEpB;;OAEG;IACH,cAAc,CAAC,SAAS,SAAS,MAAM,UAAU,EAC/C,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,GAC9B,IAAI;IAEP;;OAEG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,UAAU,GAAG,IAAI;IAErD;;;OAGG;IACH,IAAI,CAAC,SAAS,SAAS,MAAM,UAAU,EACrC,SAAS,EAAE,SAAS,EACpB,GAAG,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,GACzC,IAAI;IAEP;;OAEG;IACH,aAAa,CAAC,SAAS,SAAS,MAAM,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM;IAE/E;;;OAGG;IACH,cAAc,CAAC,CAAC,SAAS,SAAS,MAAM,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAE/E;;;OAGG;IACH,aAAa,CAAC,CAAC,SAAS,SAAS,MAAM,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;CAC/E"}

View File

@@ -0,0 +1,14 @@
import type { EventEmitter, EventsMap } from './EventEmitter';
/**
* A class for all native modules. Extends the [`EventEmitter`](#eventemittertype) class.
*/
export declare class NativeModule<TEventsMap extends EventsMap = Record<never, never>> extends EventEmitter<TEventsMap> {
/**
* Prototypes of the native components exported by the module.
* @private
*/
ViewPrototypes?: {
[viewName: string]: object;
};
}
//# sourceMappingURL=NativeModule.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModule.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/NativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY,CAC/B,UAAU,SAAS,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CACnD,SAAQ,YAAY,CAAC,UAAU,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACjD"}

View File

@@ -0,0 +1,20 @@
import type { EventEmitter, EventsMap } from './EventEmitter';
/**
* Base class for all shared objects that extends the [`EventEmitter`](#eventemittertype) class.
* The implementation is written in C++, installed through JSI and common for mobile platforms.
*/
export declare class SharedObject<TEventsMap extends EventsMap = Record<never, never>> extends EventEmitter<TEventsMap> implements EventEmitter<TEventsMap> {
/**
* A function that detaches the JS and native objects to let the native object deallocate
* before the JS object gets deallocated by the JS garbage collector. Any subsequent calls to native
* functions of the object will throw an error as it is no longer associated with its native counterpart.
*
* In most cases, you should never need to use this function, except some specific performance-critical cases when
* manual memory management makes sense and the native object is known to exclusively retain some native memory
* (such as binary data or image bitmap). Before calling this function, you should ensure that nothing else will use
* this object later on. Shared objects created by React hooks are usually automatically released in the effect's cleanup phase,
* for example: `useVideoPlayer()` from `expo-video` and `useImage()` from `expo-image`.
*/
release(): void;
}
//# sourceMappingURL=SharedObject.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SharedObject.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/SharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY,CAAC,UAAU,SAAS,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CACnF,SAAQ,YAAY,CAAC,UAAU,CAC/B,YAAW,YAAY,CAAC,UAAU,CAAC;IAEnC;;;;;;;;;;OAUG;IACH,OAAO,IAAI,IAAI;CAChB"}

View File

@@ -0,0 +1,24 @@
import type { EventsMap } from './EventEmitter';
import type { SharedObject } from './SharedObject';
/**
* A [`SharedObject`](#sharedobjecttype) that holds a reference to any native object. Allows passing references
* to native instances among different independent libraries.
*
* For instance, `ImageRef` from `expo-image` references a [`Drawable`](https://developer.android.com/reference/android/graphics/drawable/Drawable)
* on Android and an [`UIImage`](https://developer.apple.com/documentation/uikit/uiimage) on iOS. Since both types are common on these platforms,
* different native modules can use them without depending on each other. In particular, this enables the `expo-image-manipulator` to pass the resulted image
* directly to the image view from `expo-image` without any additional writes and reads from the file system.
*/
export declare class SharedRef<TNativeRefType extends string = 'unknown', TEventsMap extends EventsMap = Record<never, never>> extends SharedObject<TEventsMap> implements SharedObject<TEventsMap> {
/**
* A dummy private property with the given generic type. It is required for TypeScript to correctly infer this subtype.
* @private
* @deprecated
*/
_TNativeRefType_DONT_USE_IT?: TNativeRefType;
/**
* The type of the native reference.
*/
nativeRefType: string;
}
//# sourceMappingURL=SharedRef.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SharedRef.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/SharedRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS,CAC1B,cAAc,SAAS,MAAM,GAAG,SAAS,EACzC,UAAU,SAAS,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAErD,SAAQ,YAAY,CAAC,UAAU,CAC/B,YAAW,YAAY,CAAC,UAAU,CAAC;IAEnC;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,cAAc,CAAC;IAE7C;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB"}

View File

@@ -0,0 +1,104 @@
import { EventEmitter } from './EventEmitter';
import { NativeModule } from './NativeModule';
import { SharedObject } from './SharedObject';
import { SharedRef } from './SharedRef';
type ViewConfig = {
validAttributes: Record<string, any>;
directEventTypes: Record<string, {
registrationName: string;
}>;
};
export interface ExpoProcessEnv {
NODE_ENV: string;
/** Used in `@expo/metro-runtime`. */
EXPO_DEV_SERVER_ORIGIN?: string;
EXPO_ROUTER_IMPORT_MODE?: string;
EXPO_ROUTER_ABS_APP_ROOT?: string;
EXPO_ROUTER_APP_ROOT?: string;
/** Maps to the `experiments.baseUrl` property in the project Expo config. This is injected by `babel-preset-expo` and supports automatic cache invalidation. */
EXPO_BASE_URL?: string;
/** Build-time representation of the `Platform.OS` value that the current JavaScript was bundled for. Does not support platform shaking wrapped require statements. */
EXPO_OS?: string;
/** Run-time representation of the `Platform.OS` for the top-most platform that's hosting the DOM component. Only defined in DOM components, undefined in standard runtimes and on web. */
EXPO_DOM_HOST_OS?: 'ios' | 'android' | (string & {});
[key: string]: any;
}
export interface ExpoProcess {
env: ExpoProcessEnv;
[key: string]: any;
}
/**
* Global object containing all the native bindings installed by Expo.
* This object is not available in projects without the `expo` package installed.
*/
declare namespace ExpoGlobal {
/** Host object that is used to access native Expo modules. */
export let modules: Record<string, any>;
export { EventEmitter };
export { SharedObject };
export { SharedRef };
export { NativeModule };
/**
* The version of the `expo-modules-core` package.
* @platform android
* @platform ios
*/
export const expoModulesCoreVersion: undefined | {
version: string;
major: number;
minor: number;
patch: number;
};
/**
* The path to the cache directory
* @platform android
* @platform ios
*/
export const cacheDir: undefined | string;
/**
* The path to the documents directory
* @platform android
* @platform ios
*/
export const documentsDir: undefined | string;
/**
* Generates a random UUID v4 string.
*/
export function uuidv4(): string;
/**
* Generates a UUID v5 string representation of the value in the specified namespace.
*/
export function uuidv5(name: string, namespace: string): string;
/**
* Returns a static view config of the native view with the given name
* or `null` if the view has not been registered.
*/
export function getViewConfig(moduleName: string, viewName?: string): ViewConfig | null;
/**
* Reloads the app.
*/
export function reloadAppAsync(reason: string): Promise<void>;
/**
* Installs Expo Modules inside the Reanimated UI worklet runtime.
* @platform android
*/
export function installOnUIRuntime(): void;
}
declare global {
namespace NodeJS {
interface ProcessEnv extends ExpoProcessEnv {
}
interface Process extends ExpoProcess {
env: ProcessEnv;
}
}
var expo: typeof ExpoGlobal;
var process: NodeJS.Process;
/**
* ExpoDomWebView is defined in `@expo/dom-webview` runtime.
*/
var ExpoDomWebView: ExpoDomWebView;
}
export type ExpoDomWebView = Record<string, unknown>;
export type { ExpoGlobal };
//# sourceMappingURL=global.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9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