feat(smart-app): implement complete mobile app MVP

- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,26 @@
import { NativeEventEmitter } from 'react-native';
type NativeModule = {
__expo_module_name__?: string;
startObserving?: () => void;
stopObserving?: () => void;
addListener?: any;
removeListeners?: any;
};
export type Subscription = {
/**
* A method to unsubscribe the listener.
*/
remove: () => void;
};
export declare class EventEmitter {
_listenerCount: number;
_nativeModule: NativeModule;
_eventEmitter: NativeEventEmitter;
constructor(nativeModule: NativeModule);
addListener<T>(eventName: string, listener: (event: T) => void): Subscription;
removeAllListeners(eventName: string): void;
removeSubscription(subscription: Subscription): void;
emit(eventName: string, ...params: any[]): void;
}
export {};
//# sourceMappingURL=EventEmitter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../src/EventEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAI5D,KAAK,YAAY,GAAG;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAI3B,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,qBAAa,YAAY;IACvB,cAAc,SAAK;IAGnB,aAAa,EAAE,YAAY,CAAC;IAG5B,aAAa,EAAE,kBAAkB,CAAC;gBAEtB,YAAY,EAAE,YAAY;IAWtC,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,YAAY;IAgB7E,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAmB3C,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAuBpD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;CAGhD"}

View File

@@ -0,0 +1,70 @@
import invariant from 'invariant';
import { NativeEventEmitter, Platform } from 'react-native';
const nativeEmitterSubscriptionKey = '@@nativeEmitterSubscription@@';
export class EventEmitter {
_listenerCount = 0;
// @ts-expect-error
_nativeModule;
// @ts-expect-error
_eventEmitter;
constructor(nativeModule) {
// If the native module is a new module, just return it back as it's already an event emitter.
// This is for backwards compatibility until we stop using this legacy class in other packages.
if (nativeModule.__expo_module_name__) {
// @ts-expect-error
return nativeModule;
}
this._nativeModule = nativeModule;
this._eventEmitter = new NativeEventEmitter(nativeModule);
}
addListener(eventName, listener) {
if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.startObserving) {
this._nativeModule.startObserving();
}
this._listenerCount++;
const nativeEmitterSubscription = this._eventEmitter.addListener(eventName, listener);
const subscription = {
[nativeEmitterSubscriptionKey]: nativeEmitterSubscription,
remove: () => {
this.removeSubscription(subscription);
},
};
return subscription;
}
removeAllListeners(eventName) {
// @ts-ignore: the EventEmitter interface has been changed in react-native@0.64.0
const removedListenerCount = this._eventEmitter.listenerCount
? // @ts-ignore: this is available since 0.64
this._eventEmitter.listenerCount(eventName)
: // @ts-ignore: this is available in older versions
this._eventEmitter.listeners(eventName).length;
this._eventEmitter.removeAllListeners(eventName);
this._listenerCount -= removedListenerCount;
invariant(this._listenerCount >= 0, `EventEmitter must have a non-negative number of listeners`);
if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.stopObserving) {
this._nativeModule.stopObserving();
}
}
removeSubscription(subscription) {
const nativeEmitterSubscription = subscription[nativeEmitterSubscriptionKey];
if (!nativeEmitterSubscription) {
return;
}
if ('remove' in nativeEmitterSubscription) {
nativeEmitterSubscription.remove();
}
this._listenerCount--;
// Ensure that the emitter's internal state remains correct even if `removeSubscription` is
// called again with the same subscription
delete subscription[nativeEmitterSubscriptionKey];
// Release closed-over references to the emitter
subscription.remove = () => { };
if (!this._listenerCount && Platform.OS !== 'ios' && this._nativeModule.stopObserving) {
this._nativeModule.stopObserving();
}
}
emit(eventName, ...params) {
this._eventEmitter.emit(eventName, ...params);
}
}
//# sourceMappingURL=EventEmitter.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import type { NativeModule } from './ts-declarations/NativeModule';
declare const _default: typeof NativeModule;
export default _default;
//# sourceMappingURL=NativeModule.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModule.d.ts","sourceRoot":"","sources":["../src/NativeModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;;AAInE,wBAAmE"}

View File

@@ -0,0 +1,4 @@
import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';
ensureNativeModulesAreInstalled();
export default globalThis.expo.NativeModule;
//# sourceMappingURL=NativeModule.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModule.js","sourceRoot":"","sources":["../src/NativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAGpF,+BAA+B,EAAE,CAAC;AAElC,eAAe,UAAU,CAAC,IAAI,CAAC,YAAmC,CAAC","sourcesContent":["import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';\nimport type { NativeModule } from './ts-declarations/NativeModule';\n\nensureNativeModulesAreInstalled();\n\nexport default globalThis.expo.NativeModule as typeof NativeModule;\n"]}

View File

@@ -0,0 +1,10 @@
import { ProxyNativeModule } from './NativeModulesProxy.types';
/**
* @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.
* Use `requireNativeModule` or `requireOptionalNativeModule` instead.
*/
declare const _default: {
[moduleName: string]: ProxyNativeModule;
};
export default _default;
//# sourceMappingURL=NativeModulesProxy.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModulesProxy.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D;;;GAGG;;;;AACH,wBAAiE"}

View File

@@ -0,0 +1,7 @@
// We default to an empty object shim wherever we don't have an environment-specific implementation
/**
* @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.
* Use `requireNativeModule` or `requireOptionalNativeModule` instead.
*/
export default {};
//# sourceMappingURL=NativeModulesProxy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModulesProxy.js","sourceRoot":"","sources":["../src/NativeModulesProxy.ts"],"names":[],"mappings":"AAEA,mGAAmG;AAEnG;;;GAGG;AACH,eAAe,EAAiD,CAAC","sourcesContent":["import { ProxyNativeModule } from './NativeModulesProxy.types';\n\n// We default to an empty object shim wherever we don't have an environment-specific implementation\n\n/**\n * @deprecated `NativeModulesProxy` is deprecated and might be removed in the future releases.\n * Use `requireNativeModule` or `requireOptionalNativeModule` instead.\n */\nexport default {} as { [moduleName: string]: ProxyNativeModule };\n"]}

View File

@@ -0,0 +1,6 @@
import { ProxyNativeModule } from './NativeModulesProxy.types';
declare const NativeModulesProxy: {
[moduleName: string]: ProxyNativeModule;
};
export default NativeModulesProxy;
//# sourceMappingURL=NativeModulesProxy.native.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModulesProxy.native.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.native.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAU/D,QAAA,MAAM,kBAAkB,EAAE;IAAE,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAO,CAAC;AA+D3E,eAAe,kBAAkB,CAAC"}

View File

@@ -0,0 +1,62 @@
// Copyright © 2024 650 Industries.
// NOTE: Forcing this to be a client boundary so the errors are a bit clearer. In the future we can
// make this a shim on the server by ignoring the globals that are missing in React Server contexts (Node.js).
'use client';
import { NativeModules } from 'react-native';
const LegacyNativeProxy = NativeModules.NativeUnimoduleProxy;
// Fixes `cannot find name 'global'.` in tests
// @ts-ignore
const ExpoNativeProxy = global.expo?.modules?.NativeModulesProxy;
const modulesConstantsKey = 'modulesConstants';
const exportedMethodsKey = 'exportedMethods';
const NativeModulesProxy = {};
if (LegacyNativeProxy) {
// use JSI proxy if available, fallback to legacy RN proxy
const NativeProxy = ExpoNativeProxy ?? LegacyNativeProxy;
Object.keys(NativeProxy[exportedMethodsKey]).forEach((moduleName) => {
// copy constants
NativeModulesProxy[moduleName] = NativeProxy[modulesConstantsKey][moduleName] || {};
// copy methods
NativeProxy[exportedMethodsKey][moduleName].forEach((methodInfo) => {
NativeModulesProxy[moduleName][methodInfo.name] = (...args) => {
// Use the new proxy to call methods on legacy modules, if possible.
if (ExpoNativeProxy?.callMethod) {
return ExpoNativeProxy.callMethod(moduleName, methodInfo.name, args);
}
// Otherwise fall back to the legacy proxy.
// This is deprecated and might be removed in SDK47 or later.
const { key, argumentsCount } = methodInfo;
if (argumentsCount !== args.length) {
return Promise.reject(new Error(`Native method ${moduleName}.${methodInfo.name} expects ${argumentsCount} ${argumentsCount === 1 ? 'argument' : 'arguments'} but received ${args.length}`));
}
return LegacyNativeProxy.callMethod(moduleName, key, args);
};
});
// These are called by EventEmitter (which is a wrapper for NativeEventEmitter)
// only on iOS and they use iOS-specific native module, EXReactNativeEventEmitter.
//
// On Android only {start,stop}Observing are called on the native module
// and these should be exported as Expo methods.
//
// Before the RN 65, addListener/removeListeners weren't called on Android. However, it no longer stays true.
// See https://github.com/facebook/react-native/commit/f5502fbda9fe271ff6e1d0da773a3a8ee206a453.
// That's why, we check if the `EXReactNativeEventEmitter` exists and only if yes, we use it in the listener implementation.
// Otherwise, those methods are NOOP.
if (NativeModules.EXReactNativeEventEmitter) {
NativeModulesProxy[moduleName].addListener = (...args) => NativeModules.EXReactNativeEventEmitter.addProxiedListener(moduleName, ...args);
NativeModulesProxy[moduleName].removeListeners = (...args) => NativeModules.EXReactNativeEventEmitter.removeProxiedListeners(moduleName, ...args);
}
else {
// Fixes on Android:
// WARN `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
// WARN `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.
NativeModulesProxy[moduleName].addListener = () => { };
NativeModulesProxy[moduleName].removeListeners = () => { };
}
});
}
else {
console.warn(`The "EXNativeModulesProxy" native module is not exported through NativeModules; verify that expo-modules-core's native code is linked properly`);
}
export default NativeModulesProxy;
//# sourceMappingURL=NativeModulesProxy.native.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
export type ProxyNativeModule = {
[propertyName: string]: any;
addListener?: (eventName: string) => void;
removeListeners?: (count: number) => void;
};
//# sourceMappingURL=NativeModulesProxy.types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModulesProxy.types.d.ts","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=NativeModulesProxy.types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeModulesProxy.types.js","sourceRoot":"","sources":["../src/NativeModulesProxy.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ProxyNativeModule = {\n [propertyName: string]: any;\n addListener?: (eventName: string) => void;\n removeListeners?: (count: number) => void;\n};\n"]}

View File

@@ -0,0 +1,6 @@
import React from 'react';
/**
* A drop-in replacement for `requireNativeComponent`.
*/
export declare function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P>;
//# sourceMappingURL=NativeViewManagerAdapter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeViewManagerAdapter.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAE1F"}

View File

@@ -0,0 +1,8 @@
import { UnavailabilityError } from './errors/UnavailabilityError';
/**
* A drop-in replacement for `requireNativeComponent`.
*/
export function requireNativeViewManager(viewName) {
throw new UnavailabilityError('expo-modules-core', 'requireNativeViewManager');
}
//# sourceMappingURL=NativeViewManagerAdapter.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeViewManagerAdapter.js","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAU,QAAgB;IAChE,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC;AACjF,CAAC","sourcesContent":["import React from 'react';\n\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\n/**\n * A drop-in replacement for `requireNativeComponent`.\n */\nexport function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P> {\n throw new UnavailabilityError('expo-modules-core', 'requireNativeViewManager');\n}\n"]}

View File

@@ -0,0 +1,6 @@
import React from 'react';
/**
* A drop-in replacement for `requireNativeComponent`.
*/
export declare function requireNativeViewManager<P>(viewName: string): React.ComponentType<P>;
//# sourceMappingURL=NativeViewManagerAdapter.native.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NativeViewManagerAdapter.native.d.ts","sourceRoot":"","sources":["../src/NativeViewManagerAdapter.native.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAuD1B;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAiDpF"}

View File

@@ -0,0 +1,92 @@
// Copyright © 2024 650 Industries.
'use client';
import React from 'react';
import { findNodeHandle, NativeModules } from 'react-native';
import * as NativeComponentRegistry from 'react-native/Libraries/NativeComponent/NativeComponentRegistry';
import { requireNativeModule } from './requireNativeModule';
// To make the transition from React Native's `requireNativeComponent` to Expo's
// `requireNativeViewManager` as easy as possible, `requireNativeViewManager` is a drop-in
// replacement for `requireNativeComponent`.
//
// For each view manager, we create a wrapper component that accepts all of the props available to
// the author of the universal module. This wrapper component splits the props into two sets: props
// passed to React Native's View (ex: style, testID) and custom view props, which are passed to the
// adapter view component in a prop called `proxiedProperties`.
/**
* A map that caches registered native components.
*/
const nativeComponentsCache = new Map();
/**
* Requires a React Native component using the static view config from an Expo module.
*/
function requireNativeComponent(viewName) {
return NativeComponentRegistry.get(viewName, () => {
const viewModuleName = viewName.replace('ViewManagerAdapter_', '');
const expoViewConfig = globalThis.expo?.getViewConfig(viewModuleName);
if (!expoViewConfig) {
console.warn('Unable to get the view config for %s', viewModuleName);
}
return {
uiViewClassName: viewName,
...expoViewConfig,
};
});
}
/**
* Requires a React Native component from cache if possible. This prevents
* "Tried to register two views with the same name" errors on fast refresh, but
* also when there are multiple versions of the same package with native component.
*/
function requireCachedNativeComponent(viewName) {
const cachedNativeComponent = nativeComponentsCache.get(viewName);
if (!cachedNativeComponent) {
const nativeComponent = requireNativeComponent(viewName);
nativeComponentsCache.set(viewName, nativeComponent);
return nativeComponent;
}
return cachedNativeComponent;
}
/**
* A drop-in replacement for `requireNativeComponent`.
*/
export function requireNativeViewManager(viewName) {
const { viewManagersMetadata } = NativeModules.NativeUnimoduleProxy;
const viewManagerConfig = viewManagersMetadata?.[viewName];
if (__DEV__ && !viewManagerConfig) {
const exportedViewManagerNames = Object.keys(viewManagersMetadata).join(', ');
console.warn(`The native view manager required by name (${viewName}) from NativeViewManagerAdapter isn't exported by expo-modules-core. Views of this type may not render correctly. Exported view managers: [${exportedViewManagerNames}].`);
}
// Set up the React Native native component, which is an adapter to the universal module's view
// manager
const reactNativeViewName = `ViewManagerAdapter_${viewName}`;
const ReactNativeComponent = requireCachedNativeComponent(reactNativeViewName);
class NativeComponent extends React.PureComponent {
static displayName = viewName;
// This will be accessed from native when the prototype functions are called,
// in order to find the associated native view.
nativeTag = null;
componentDidMount() {
this.nativeTag = findNodeHandle(this);
}
render() {
return <ReactNativeComponent {...this.props}/>;
}
}
try {
const nativeModule = requireNativeModule(viewName);
const nativeViewPrototype = nativeModule.ViewPrototype;
if (nativeViewPrototype) {
// Assign native view functions to the component prototype so they can be accessed from the ref.
Object.assign(NativeComponent.prototype, nativeViewPrototype);
}
}
catch {
// `requireNativeModule` may throw an error when the native module cannot be found.
// In some tests we don't mock the entire modules, but we do want to mock native views. For now,
// until we still have to support the legacy modules proxy and don't have better ways to mock,
// let's just gracefully skip assigning the prototype functions.
// See: https://github.com/expo/expo/blob/main/packages/expo-modules-core/src/__tests__/NativeViewManagerAdapter-test.native.tsx
}
return NativeComponent;
}
//# sourceMappingURL=NativeViewManagerAdapter.native.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
import { PermissionResponse } from './PermissionsInterface';
type RequestPermissionMethod<Permission extends PermissionResponse> = () => Promise<Permission>;
type GetPermissionMethod<Permission extends PermissionResponse> = () => Promise<Permission>;
interface PermissionHookMethods<Permission extends PermissionResponse, Options = never> {
/** The permission method that requests the user to grant permission. */
requestMethod: (options?: Options) => Promise<Permission>;
/** The permission method that only fetches the current permission status. */
getMethod: (options?: Options) => Promise<Permission>;
}
interface PermissionHookBehavior {
/** If the hook should automatically fetch the current permission status, without asking the user. */
get?: boolean;
/** If the hook should automatically request the user to grant permission. */
request?: boolean;
}
export type PermissionHookOptions<Options extends object> = PermissionHookBehavior & Options;
/**
* Create a new permission hook with the permission methods built-in.
* This can be used to quickly create specific permission hooks in every module.
*/
export declare function createPermissionHook<Permission extends PermissionResponse, Options extends object>(methods: PermissionHookMethods<Permission, Options>): (options?: PermissionHookOptions<Options>) => [Permission | null, RequestPermissionMethod<Permission>, GetPermissionMethod<Permission>];
export {};
//# sourceMappingURL=PermissionsHook.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PermissionsHook.d.ts","sourceRoot":"","sources":["../src/PermissionsHook.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,KAAK,uBAAuB,CAAC,UAAU,SAAS,kBAAkB,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAChG,KAAK,mBAAmB,CAAC,UAAU,SAAS,kBAAkB,IAAI,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAE5F,UAAU,qBAAqB,CAAC,UAAU,SAAS,kBAAkB,EAAE,OAAO,GAAG,KAAK;IACpF,wEAAwE;IACxE,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,6EAA6E;IAC7E,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD;AAED,UAAU,sBAAsB;IAC9B,qGAAqG;IACrG,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,qBAAqB,CAAC,OAAO,SAAS,MAAM,IAAI,sBAAsB,GAAG,OAAO,CAAC;AAkD7F;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,SAAS,kBAAkB,EAAE,OAAO,SAAS,MAAM,EAChG,OAAO,EAAE,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC,cAEjC,sBAAsB,OAAO,CAAC,+FAEjD"}

View File

@@ -0,0 +1,47 @@
// Copyright © 2024 650 Industries.
'use client';
import { useCallback, useEffect, useRef, useState } from 'react';
/**
* Get or request permission for protected functionality within the app.
* It uses separate permission requesters to interact with a single permission.
* By default, the hook will only retrieve the permission status.
*/
function usePermission(methods, options) {
const isMounted = useRef(true);
const [status, setStatus] = useState(null);
const { get = true, request = false, ...permissionOptions } = options || {};
const getPermission = useCallback(async () => {
const response = await methods.getMethod(Object.keys(permissionOptions).length > 0 ? permissionOptions : undefined);
if (isMounted.current)
setStatus(response);
return response;
}, [methods.getMethod]);
const requestPermission = useCallback(async () => {
const response = await methods.requestMethod(Object.keys(permissionOptions).length > 0 ? permissionOptions : undefined);
if (isMounted.current)
setStatus(response);
return response;
}, [methods.requestMethod]);
useEffect(function runMethods() {
if (request)
requestPermission();
if (!request && get)
getPermission();
}, [get, request, requestPermission, getPermission]);
// Workaround for unmounting components receiving state updates
useEffect(function didMount() {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return [status, requestPermission, getPermission];
}
/**
* Create a new permission hook with the permission methods built-in.
* This can be used to quickly create specific permission hooks in every module.
*/
export function createPermissionHook(methods) {
return (options) => usePermission(methods, options);
}
//# sourceMappingURL=PermissionsHook.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,42 @@
export declare enum PermissionStatus {
/**
* User has granted the permission.
*/
GRANTED = "granted",
/**
* User hasn't granted or denied the permission yet.
*/
UNDETERMINED = "undetermined",
/**
* User has denied the permission.
*/
DENIED = "denied"
}
/**
* Permission expiration time. Currently, all permissions are granted permanently.
*/
export type PermissionExpiration = 'never' | number;
/**
* An object obtained by permissions get and request functions.
*/
export interface PermissionResponse {
/**
* Determines the status of the permission.
*/
status: PermissionStatus;
/**
* Determines time when the permission expires.
*/
expires: PermissionExpiration;
/**
* A convenience boolean that indicates if the permission is granted.
*/
granted: boolean;
/**
* Indicates if user can be asked again for specific permission.
* If not, one should be directed to the Settings app
* in order to enable/disable the permission.
*/
canAskAgain: boolean;
}
//# sourceMappingURL=PermissionsInterface.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PermissionsInterface.d.ts","sourceRoot":"","sources":["../src/PermissionsInterface.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,YAAY,iBAAiB;IAC7B;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB"}

View File

@@ -0,0 +1,16 @@
export var PermissionStatus;
(function (PermissionStatus) {
/**
* User has granted the permission.
*/
PermissionStatus["GRANTED"] = "granted";
/**
* User hasn't granted or denied the permission yet.
*/
PermissionStatus["UNDETERMINED"] = "undetermined";
/**
* User has denied the permission.
*/
PermissionStatus["DENIED"] = "denied";
})(PermissionStatus || (PermissionStatus = {}));
//# sourceMappingURL=PermissionsInterface.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PermissionsInterface.js","sourceRoot":"","sources":["../src/PermissionsInterface.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,uCAAmB,CAAA;IACnB;;OAEG;IACH,iDAA6B,CAAA;IAC7B;;OAEG;IACH,qCAAiB,CAAA;AACnB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B","sourcesContent":["export enum PermissionStatus {\n /**\n * User has granted the permission.\n */\n GRANTED = 'granted',\n /**\n * User hasn't granted or denied the permission yet.\n */\n UNDETERMINED = 'undetermined',\n /**\n * User has denied the permission.\n */\n DENIED = 'denied',\n}\n\n/**\n * Permission expiration time. Currently, all permissions are granted permanently.\n */\nexport type PermissionExpiration = 'never' | number;\n\n/**\n * An object obtained by permissions get and request functions.\n */\nexport interface PermissionResponse {\n /**\n * Determines the status of the permission.\n */\n status: PermissionStatus;\n /**\n * Determines time when the permission expires.\n */\n expires: PermissionExpiration;\n /**\n * A convenience boolean that indicates if the permission is granted.\n */\n granted: boolean;\n /**\n * Indicates if user can be asked again for specific permission.\n * If not, one should be directed to the Settings app\n * in order to enable/disable the permission.\n */\n canAskAgain: boolean;\n}\n"]}

View File

@@ -0,0 +1,45 @@
import { PlatformOSType } from 'react-native';
export type PlatformSelectOSType = PlatformOSType | 'native' | 'electron' | 'default';
export type PlatformSelect = <T>(specifics: {
[platform in PlatformSelectOSType]?: T;
}) => T;
declare const Platform: {
/**
* Denotes the currently running platform.
* Can be one of ios, android, web.
*/
OS: "ios" | "android" | "windows" | "macos" | "web";
/**
* Returns the value with the matching platform.
* Object keys can be any of ios, android, native, web, default.
*
* @ios ios, native, default
* @android android, native, default
* @web web, default
*/
select: PlatformSelect;
/**
* Denotes if the DOM API is available in the current environment.
* The DOM is not available in native React runtimes and Node.js.
*/
isDOMAvailable: boolean;
/**
* Denotes if the current environment can attach event listeners
* to the window. This will return false in native React
* runtimes and Node.js.
*/
canUseEventListeners: boolean;
/**
* Denotes if the current environment can inspect properties of the
* screen on which the current window is being rendered. This will
* return false in native React runtimes and Node.js.
*/
canUseViewport: boolean;
/**
* If the JavaScript is being executed in a remote JavaScript environment.
* When `true`, synchronous native invocations cannot be executed.
*/
isAsyncDebugging: boolean;
};
export default Platform;
//# sourceMappingURL=Platform.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,cAAc,EAAE,MAAM,cAAc,CAAC;AAS/E,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAEtF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE;KAAG,QAAQ,IAAI,oBAAoB,CAAC,CAAC,EAAE,CAAC;CAAE,KAAK,CAAC,CAAC;AAE7F,QAAA,MAAM,QAAQ;IACZ;;;OAGG;;IAEH;;;;;;;OAOG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;CAEJ,CAAC;AAEF,eAAe,QAAQ,CAAC"}

View File

@@ -0,0 +1,42 @@
import { Platform as ReactNativePlatform } from 'react-native';
import { isDOMAvailable, canUseEventListeners, canUseViewport, isAsyncDebugging, } from './environment/browser';
const Platform = {
/**
* Denotes the currently running platform.
* Can be one of ios, android, web.
*/
OS: ReactNativePlatform.OS,
/**
* Returns the value with the matching platform.
* Object keys can be any of ios, android, native, web, default.
*
* @ios ios, native, default
* @android android, native, default
* @web web, default
*/
select: ReactNativePlatform.select,
/**
* Denotes if the DOM API is available in the current environment.
* The DOM is not available in native React runtimes and Node.js.
*/
isDOMAvailable,
/**
* Denotes if the current environment can attach event listeners
* to the window. This will return false in native React
* runtimes and Node.js.
*/
canUseEventListeners,
/**
* Denotes if the current environment can inspect properties of the
* screen on which the current window is being rendered. This will
* return false in native React runtimes and Node.js.
*/
canUseViewport,
/**
* If the JavaScript is being executed in a remote JavaScript environment.
* When `true`, synchronous native invocations cannot be executed.
*/
isAsyncDebugging,
};
export default Platform;
//# sourceMappingURL=Platform.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAkB,MAAM,cAAc,CAAC;AAE/E,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAM/B,MAAM,QAAQ,GAAG;IACf;;;OAGG;IACH,EAAE,EAAE,mBAAmB,CAAC,EAAE;IAC1B;;;;;;;OAOG;IACH,MAAM,EAAE,mBAAmB,CAAC,MAAwB;IACpD;;;OAGG;IACH,cAAc;IACd;;;;OAIG;IACH,oBAAoB;IACpB;;;;OAIG;IACH,cAAc;IACd;;;OAGG;IACH,gBAAgB;CACjB,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { Platform as ReactNativePlatform, PlatformOSType } from 'react-native';\n\nimport {\n isDOMAvailable,\n canUseEventListeners,\n canUseViewport,\n isAsyncDebugging,\n} from './environment/browser';\n\nexport type PlatformSelectOSType = PlatformOSType | 'native' | 'electron' | 'default';\n\nexport type PlatformSelect = <T>(specifics: { [platform in PlatformSelectOSType]?: T }) => T;\n\nconst Platform = {\n /**\n * Denotes the currently running platform.\n * Can be one of ios, android, web.\n */\n OS: ReactNativePlatform.OS,\n /**\n * Returns the value with the matching platform.\n * Object keys can be any of ios, android, native, web, default.\n *\n * @ios ios, native, default\n * @android android, native, default\n * @web web, default\n */\n select: ReactNativePlatform.select as PlatformSelect,\n /**\n * Denotes if the DOM API is available in the current environment.\n * The DOM is not available in native React runtimes and Node.js.\n */\n isDOMAvailable,\n /**\n * Denotes if the current environment can attach event listeners\n * to the window. This will return false in native React\n * runtimes and Node.js.\n */\n canUseEventListeners,\n /**\n * Denotes if the current environment can inspect properties of the\n * screen on which the current window is being rendered. This will\n * return false in native React runtimes and Node.js.\n */\n canUseViewport,\n /**\n * If the JavaScript is being executed in a remote JavaScript environment.\n * When `true`, synchronous native invocations cannot be executed.\n */\n isAsyncDebugging,\n};\n\nexport default Platform;\n"]}

View File

@@ -0,0 +1,8 @@
import React from 'react';
/**
* Create a React ref object that is friendly for snapshots.
* It will be represented as `[React.ref]` in snapshots.
* @returns a React ref object.
*/
export declare function createSnapshotFriendlyRef<T>(): React.RefObject<T>;
//# sourceMappingURL=Refs.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Refs.d.ts","sourceRoot":"","sources":["../src/Refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAEjE"}

View File

@@ -0,0 +1,10 @@
import React from 'react';
/**
* Create a React ref object that is friendly for snapshots.
* It will be represented as `[React.ref]` in snapshots.
* @returns a React ref object.
*/
export function createSnapshotFriendlyRef() {
return React.createRef();
}
//# sourceMappingURL=Refs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Refs.js","sourceRoot":"","sources":["../src/Refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,KAAK,CAAC,SAAS,EAAK,CAAC;AAC9B,CAAC","sourcesContent":["import React from 'react';\n\n/**\n * Create a React ref object that is friendly for snapshots.\n * It will be represented as `[React.ref]` in snapshots.\n * @returns a React ref object.\n */\nexport function createSnapshotFriendlyRef<T>(): React.RefObject<T> {\n return React.createRef<T>();\n}\n"]}

View File

@@ -0,0 +1,4 @@
import type { SharedObject } from './ts-declarations/SharedObject';
declare const _default: typeof SharedObject;
export default _default;
//# sourceMappingURL=SharedObject.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SharedObject.d.ts","sourceRoot":"","sources":["../src/SharedObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;;AAInE,wBAAmE"}

View File

@@ -0,0 +1,4 @@
import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';
ensureNativeModulesAreInstalled();
export default globalThis.expo.SharedObject;
//# sourceMappingURL=SharedObject.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SharedObject.js","sourceRoot":"","sources":["../src/SharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAGpF,+BAA+B,EAAE,CAAC;AAElC,eAAe,UAAU,CAAC,IAAI,CAAC,YAAmC,CAAC","sourcesContent":["import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';\nimport type { SharedObject } from './ts-declarations/SharedObject';\n\nensureNativeModulesAreInstalled();\n\nexport default globalThis.expo.SharedObject as typeof SharedObject;\n"]}

View File

@@ -0,0 +1,9 @@
/** A union type for all integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */
export type IntBasedTypedArray = Int8Array | Int16Array | Int32Array;
/** A union type for all unsigned integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */
export type UintBasedTypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
/** A union type for all floating point based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */
export type FloatBasedTypedArray = Float32Array | Float64Array;
/** A [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) describes an array-like view of an underlying binary data buffer. */
export type TypedArray = IntBasedTypedArray | UintBasedTypedArray | FloatBasedTypedArray;
//# sourceMappingURL=TypedArrays.types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TypedArrays.types.d.ts","sourceRoot":"","sources":["../src/TypedArrays.types.ts"],"names":[],"mappings":"AAAA,iLAAiL;AACjL,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,0LAA0L;AAC1L,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,GAAG,WAAW,CAAC;AAE7F,wLAAwL;AACxL,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,YAAY,CAAC;AAE/D,sLAAsL;AACtL,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=TypedArrays.types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TypedArrays.types.js","sourceRoot":"","sources":["../src/TypedArrays.types.ts"],"names":[],"mappings":"","sourcesContent":["/** A union type for all integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */\nexport type IntBasedTypedArray = Int8Array | Int16Array | Int32Array;\n\n/** A union type for all unsigned integer based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */\nexport type UintBasedTypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;\n\n/** A union type for all floating point based [`TypedArray` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#typedarray_objects). */\nexport type FloatBasedTypedArray = Float32Array | Float64Array;\n\n/** A [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) describes an array-like view of an underlying binary data buffer. */\nexport type TypedArray = IntBasedTypedArray | UintBasedTypedArray | FloatBasedTypedArray;\n"]}

View File

@@ -0,0 +1,2 @@
export declare function createWebModule<ModuleType = any>(moduleImplementation: ModuleType): ModuleType;
//# sourceMappingURL=createWebModule.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createWebModule.d.ts","sourceRoot":"","sources":["../src/createWebModule.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,GAAG,GAAG,EAAE,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAE9F"}

View File

@@ -0,0 +1,6 @@
// It is a no-op function that returns the module implementation without importing CoreModule.
// Actual implementation is located in `createWebModule.web.ts`.
export function createWebModule(moduleImplementation) {
return moduleImplementation;
}
//# sourceMappingURL=createWebModule.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createWebModule.js","sourceRoot":"","sources":["../src/createWebModule.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAmB,oBAAgC;IAChF,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["// It is a no-op function that returns the module implementation without importing CoreModule.\n// Actual implementation is located in `createWebModule.web.ts`.\nexport function createWebModule<ModuleType = any>(moduleImplementation: ModuleType): ModuleType {\n return moduleImplementation;\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare function createWebModule<ModuleType = any>(moduleImplementation: ModuleType): ModuleType;
//# sourceMappingURL=createWebModule.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createWebModule.web.d.ts","sourceRoot":"","sources":["../src/createWebModule.web.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,GAAG,GAAG,EAAE,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAG9F"}

View File

@@ -0,0 +1,6 @@
import { NativeModule } from './web/CoreModule';
export function createWebModule(moduleImplementation) {
const module = new NativeModule();
return Object.assign(module, moduleImplementation);
}
//# sourceMappingURL=createWebModule.web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"createWebModule.web.js","sourceRoot":"","sources":["../src/createWebModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,eAAe,CAAmB,oBAAgC;IAChF,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { NativeModule } from './web/CoreModule';\n\nexport function createWebModule<ModuleType = any>(moduleImplementation: ModuleType): ModuleType {\n const module = new NativeModule();\n return Object.assign(module, moduleImplementation);\n}\n"]}

View File

@@ -0,0 +1,6 @@
/**
* Ensures that the native modules are installed in the current runtime.
* Otherwise, it synchronously calls a native function that installs them.
*/
export declare function ensureNativeModulesAreInstalled(): void;
//# sourceMappingURL=ensureNativeModulesAreInstalled.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ensureNativeModulesAreInstalled.d.ts","sourceRoot":"","sources":["../src/ensureNativeModulesAreInstalled.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAiBtD"}

View File

@@ -0,0 +1,26 @@
import { NativeModules, Platform } from 'react-native';
/**
* Ensures that the native modules are installed in the current runtime.
* Otherwise, it synchronously calls a native function that installs them.
*/
export function ensureNativeModulesAreInstalled() {
if (globalThis.expo) {
return;
}
try {
if (Platform.OS === 'web') {
// Requiring web folder sets up the `globalThis.expo` object.
require('./web');
}
else {
// TODO: ExpoModulesCore shouldn't be optional here,
// but to keep backwards compatibility let's just ignore it in SDK 50.
// In most cases the modules were already installed from the native side.
NativeModules.ExpoModulesCore?.installModules();
}
}
catch (error) {
console.error(`Unable to install Expo modules: ${error}`);
}
}
//# sourceMappingURL=ensureNativeModulesAreInstalled.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ensureNativeModulesAreInstalled.js","sourceRoot":"","sources":["../src/ensureNativeModulesAreInstalled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC7C,IAAI,UAAU,CAAC,IAAI,EAAE;QACnB,OAAO;KACR;IACD,IAAI;QACF,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;YACzB,6DAA6D;YAC7D,OAAO,CAAC,OAAO,CAAC,CAAC;SAClB;aAAM;YACL,oDAAoD;YACpD,sEAAsE;YACtE,yEAAyE;YACzE,aAAa,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;SACjD;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;KAC3D;AACH,CAAC","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\n/**\n * Ensures that the native modules are installed in the current runtime.\n * Otherwise, it synchronously calls a native function that installs them.\n */\nexport function ensureNativeModulesAreInstalled(): void {\n if (globalThis.expo) {\n return;\n }\n try {\n if (Platform.OS === 'web') {\n // Requiring web folder sets up the `globalThis.expo` object.\n require('./web');\n } else {\n // TODO: ExpoModulesCore shouldn't be optional here,\n // but to keep backwards compatibility let's just ignore it in SDK 50.\n // In most cases the modules were already installed from the native side.\n NativeModules.ExpoModulesCore?.installModules();\n }\n } catch (error) {\n console.error(`Unable to install Expo modules: ${error}`);\n }\n}\n"]}

View File

@@ -0,0 +1,5 @@
export declare const isDOMAvailable = false;
export declare const canUseEventListeners = false;
export declare const canUseViewport = false;
export declare let isAsyncDebugging: boolean;
//# sourceMappingURL=browser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/environment/browser.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAC1C,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC,eAAO,IAAI,gBAAgB,EAAE,OAAe,CAAC"}

View File

@@ -0,0 +1,12 @@
// In standard node environments there is no DOM API
export const isDOMAvailable = false;
export const canUseEventListeners = false;
export const canUseViewport = false;
export let isAsyncDebugging = false;
if (__DEV__) {
// These native globals are injected by native React runtimes and not standard browsers
// we can use them to determine if the JS is being executed in Chrome.
isAsyncDebugging =
!global.nativeExtensions && !global.nativeCallSyncHook && !global.RN$Bridgeless;
}
//# sourceMappingURL=browser.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/environment/browser.ts"],"names":[],"mappings":"AAEA,oDAAoD;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAEpC,MAAM,CAAC,IAAI,gBAAgB,GAAY,KAAK,CAAC;AAE7C,IAAI,OAAO,EAAE;IACX,uFAAuF;IACvF,sEAAsE;IACtE,gBAAgB;QACd,CAAC,MAAM,CAAC,gBAAgB,IAAI,CAAC,MAAM,CAAC,kBAAkB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;CACnF","sourcesContent":["declare const global: any;\n\n// In standard node environments there is no DOM API\nexport const isDOMAvailable = false;\nexport const canUseEventListeners = false;\nexport const canUseViewport = false;\n\nexport let isAsyncDebugging: boolean = false;\n\nif (__DEV__) {\n // These native globals are injected by native React runtimes and not standard browsers\n // we can use them to determine if the JS is being executed in Chrome.\n isAsyncDebugging =\n !global.nativeExtensions && !global.nativeCallSyncHook && !global.RN$Bridgeless;\n}\n"]}

View File

@@ -0,0 +1,10 @@
declare global {
interface Window {
attachEvent(event: string, listener: EventListener): boolean;
}
}
export declare const isDOMAvailable: boolean;
export declare const canUseEventListeners: boolean;
export declare const canUseViewport: boolean;
export declare const isAsyncDebugging = false;
//# sourceMappingURL=browser.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.web.d.ts","sourceRoot":"","sources":["../../src/environment/browser.web.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC;KAC9D;CACF;AAID,eAAO,MAAM,cAAc,SAAoE,CAAC;AAChG,eAAO,MAAM,oBAAoB,SACoC,CAAC;AACtE,eAAO,MAAM,cAAc,SAAoC,CAAC;AAChE,eAAO,MAAM,gBAAgB,QAAQ,CAAC"}

View File

@@ -0,0 +1,7 @@
// Used for delegating node actions when browser APIs aren't available
// like in SSR websites.
export const isDOMAvailable = typeof window !== 'undefined' && !!window.document?.createElement;
export const canUseEventListeners = isDOMAvailable && !!(window.addEventListener || window.attachEvent);
export const canUseViewport = isDOMAvailable && !!window.screen;
export const isAsyncDebugging = false;
//# sourceMappingURL=browser.web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.web.js","sourceRoot":"","sources":["../../src/environment/browser.web.ts"],"names":[],"mappings":"AAOA,sEAAsE;AACtE,wBAAwB;AACxB,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAC/B,cAAc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC","sourcesContent":["declare global {\n // Add IE-specific interface to Window\n interface Window {\n attachEvent(event: string, listener: EventListener): boolean;\n }\n}\n\n// Used for delegating node actions when browser APIs aren't available\n// like in SSR websites.\nexport const isDOMAvailable = typeof window !== 'undefined' && !!window.document?.createElement;\nexport const canUseEventListeners =\n isDOMAvailable && !!(window.addEventListener || window.attachEvent);\nexport const canUseViewport = isDOMAvailable && !!window.screen;\nexport const isAsyncDebugging = false;\n"]}

View File

@@ -0,0 +1,11 @@
/**
* A general error class that should be used for all errors in Expo modules.
* Guarantees a `code` field that can be used to differentiate between different
* types of errors without further subclassing Error.
*/
export declare class CodedError extends Error {
code: string;
info?: any;
constructor(code: string, message: string);
}
//# sourceMappingURL=CodedError.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CodedError.d.ts","sourceRoot":"","sources":["../../src/errors/CodedError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;gBAEC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI1C"}

View File

@@ -0,0 +1,14 @@
/**
* A general error class that should be used for all errors in Expo modules.
* Guarantees a `code` field that can be used to differentiate between different
* types of errors without further subclassing Error.
*/
export class CodedError extends Error {
code;
info;
constructor(code, message) {
super(message);
this.code = code;
}
}
//# sourceMappingURL=CodedError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CodedError.js","sourceRoot":"","sources":["../../src/errors/CodedError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,IAAI,CAAS;IACb,IAAI,CAAO;IAEX,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF","sourcesContent":["/**\n * A general error class that should be used for all errors in Expo modules.\n * Guarantees a `code` field that can be used to differentiate between different\n * types of errors without further subclassing Error.\n */\nexport class CodedError extends Error {\n code: string;\n info?: any;\n\n constructor(code: string, message: string) {\n super(message);\n this.code = code;\n }\n}\n"]}

View File

@@ -0,0 +1,10 @@
import { CodedError } from './CodedError';
/**
* A class for errors to be thrown when a property is accessed which is
* unavailable, unsupported, or not currently implemented on the running
* platform.
*/
export declare class UnavailabilityError extends CodedError {
constructor(moduleName: string, propertyName: string);
}
//# sourceMappingURL=UnavailabilityError.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"UnavailabilityError.d.ts","sourceRoot":"","sources":["../../src/errors/UnavailabilityError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAMrD"}

View File

@@ -0,0 +1,13 @@
import { CodedError } from './CodedError';
import Platform from '../Platform';
/**
* A class for errors to be thrown when a property is accessed which is
* unavailable, unsupported, or not currently implemented on the running
* platform.
*/
export class UnavailabilityError extends CodedError {
constructor(moduleName, propertyName) {
super('ERR_UNAVAILABLE', `The method or property ${moduleName}.${propertyName} is not available on ${Platform.OS}, are you sure you've linked all the native dependencies properly?`);
}
}
//# sourceMappingURL=UnavailabilityError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"UnavailabilityError.js","sourceRoot":"","sources":["../../src/errors/UnavailabilityError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,UAAkB,EAAE,YAAoB;QAClD,KAAK,CACH,iBAAiB,EACjB,0BAA0B,UAAU,IAAI,YAAY,wBAAwB,QAAQ,CAAC,EAAE,oEAAoE,CAC5J,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { CodedError } from './CodedError';\nimport Platform from '../Platform';\n\n/**\n * A class for errors to be thrown when a property is accessed which is\n * unavailable, unsupported, or not currently implemented on the running\n * platform.\n */\nexport class UnavailabilityError extends CodedError {\n constructor(moduleName: string, propertyName: string) {\n super(\n 'ERR_UNAVAILABLE',\n `The method or property ${moduleName}.${propertyName} is not available on ${Platform.OS}, are you sure you've linked all the native dependencies properly?`\n );\n }\n}\n"]}

View File

@@ -0,0 +1,7 @@
import { DependencyList } from 'react';
import type { SharedObject } from '../ts-declarations/SharedObject';
/**
* Returns a shared object, which is automatically cleaned up when the component is unmounted.
*/
export declare function useReleasingSharedObject<TSharedObject extends SharedObject>(factory: () => TSharedObject, dependencies: DependencyList): TSharedObject;
//# sourceMappingURL=useReleasingSharedObject.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useReleasingSharedObject.d.ts","sourceRoot":"","sources":["../../src/hooks/useReleasingSharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,SAAS,YAAY,EACzE,OAAO,EAAE,MAAM,aAAa,EAC5B,YAAY,EAAE,cAAc,GAC3B,aAAa,CAwCf"}

View File

@@ -0,0 +1,40 @@
import { useRef, useMemo, useEffect } from 'react';
/**
* Returns a shared object, which is automatically cleaned up when the component is unmounted.
*/
export function useReleasingSharedObject(factory, dependencies) {
const objectRef = useRef(null);
const isFastRefresh = useRef(false);
const previousDependencies = useRef(dependencies);
if (objectRef.current == null) {
objectRef.current = factory();
}
const object = useMemo(() => {
let newObject = objectRef.current;
const dependenciesAreEqual = previousDependencies.current?.length === dependencies.length &&
dependencies.every((value, index) => value === previousDependencies.current[index]);
// If the dependencies have changed, release the previous object and create a new one, otherwise this has been called
// because of a fast refresh, and we don't want to release the object.
if (!newObject || !dependenciesAreEqual) {
objectRef.current?.release();
newObject = factory();
objectRef.current = newObject;
previousDependencies.current = dependencies;
}
else {
isFastRefresh.current = true;
}
return newObject;
}, dependencies);
useEffect(() => {
isFastRefresh.current = false;
return () => {
// This will be called on every fast refresh and on unmount, but we only want to release the object on unmount.
if (!isFastRefresh.current && objectRef.current) {
objectRef.current.release();
}
};
}, []);
return object;
}
//# sourceMappingURL=useReleasingSharedObject.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useReleasingSharedObject.js","sourceRoot":"","sources":["../../src/hooks/useReleasingSharedObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAInE;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA4B,EAC5B,YAA4B;IAE5B,MAAM,SAAS,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,oBAAoB,GAAG,MAAM,CAAiB,YAAY,CAAC,CAAC;IAElE,IAAI,SAAS,CAAC,OAAO,IAAI,IAAI,EAAE;QAC7B,SAAS,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC;KAC/B;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;QAClC,MAAM,oBAAoB,GACxB,oBAAoB,CAAC,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC,MAAM;YAC5D,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAEtF,qHAAqH;QACrH,sEAAsE;QACtE,IAAI,CAAC,SAAS,IAAI,CAAC,oBAAoB,EAAE;YACvC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC7B,SAAS,GAAG,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC;YAC9B,oBAAoB,CAAC,OAAO,GAAG,YAAY,CAAC;SAC7C;aAAM;YACL,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;SAC9B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjB,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;QAE9B,OAAO,GAAG,EAAE;YACV,+GAA+G;YAC/G,IAAI,CAAC,aAAa,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;gBAC/C,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;aAC7B;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { DependencyList, useRef, useMemo, useEffect } from 'react';\n\nimport type { SharedObject } from '../ts-declarations/SharedObject';\n\n/**\n * Returns a shared object, which is automatically cleaned up when the component is unmounted.\n */\nexport function useReleasingSharedObject<TSharedObject extends SharedObject>(\n factory: () => TSharedObject,\n dependencies: DependencyList\n): TSharedObject {\n const objectRef = useRef<TSharedObject | null>(null);\n const isFastRefresh = useRef(false);\n const previousDependencies = useRef<DependencyList>(dependencies);\n\n if (objectRef.current == null) {\n objectRef.current = factory();\n }\n\n const object = useMemo(() => {\n let newObject = objectRef.current;\n const dependenciesAreEqual =\n previousDependencies.current?.length === dependencies.length &&\n dependencies.every((value, index) => value === previousDependencies.current[index]);\n\n // If the dependencies have changed, release the previous object and create a new one, otherwise this has been called\n // because of a fast refresh, and we don't want to release the object.\n if (!newObject || !dependenciesAreEqual) {\n objectRef.current?.release();\n newObject = factory();\n objectRef.current = newObject;\n previousDependencies.current = dependencies;\n } else {\n isFastRefresh.current = true;\n }\n return newObject;\n }, dependencies);\n\n useEffect(() => {\n isFastRefresh.current = false;\n\n return () => {\n // This will be called on every fast refresh and on unmount, but we only want to release the object on unmount.\n if (!isFastRefresh.current && objectRef.current) {\n objectRef.current.release();\n }\n };\n }, []);\n\n return object;\n}\n"]}

View File

@@ -0,0 +1,28 @@
import { DeviceEventEmitter } from 'react-native';
import { EventEmitter, Subscription } from './EventEmitter';
import NativeModule from './NativeModule';
import NativeModulesProxy from './NativeModulesProxy';
import { ProxyNativeModule } from './NativeModulesProxy.types';
import { requireNativeViewManager } from './NativeViewManagerAdapter';
import Platform from './Platform';
import SharedObject from './SharedObject';
import { CodedError } from './errors/CodedError';
import { UnavailabilityError } from './errors/UnavailabilityError';
import './sweet/setUpErrorManager.fx';
import './web/index';
export type * from './ts-declarations/global';
export { default as uuid } from './uuid';
export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, requireNativeViewManager, SharedObject, NativeModule, CodedError, UnavailabilityError, };
export * from './requireNativeModule';
export * from './createWebModule';
export * from './TypedArrays.types';
/**
* @deprecated renamed to `DeviceEventEmitter`
*/
export declare const SyntheticPlatformEmitter: import("react-native").DeviceEventEmitterStatic;
export * from './PermissionsInterface';
export * from './PermissionsHook';
export * from './Refs';
export * from './hooks/useReleasingSharedObject';
export * from './reload';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AACtC,OAAO,aAAa,CAAC;AAErB,mBAAmB,0BAA0B,CAAC;AAE9C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EAExB,YAAY,EACZ,YAAY,EAEZ,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,wBAAwB,iDAAqB,CAAC;AAE3D,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,QAAQ,CAAC;AAEvB,cAAc,kCAAkC,CAAC;AACjD,cAAc,UAAU,CAAC"}

View File

@@ -0,0 +1,30 @@
import { DeviceEventEmitter } from 'react-native';
import { EventEmitter } from './EventEmitter';
import NativeModule from './NativeModule';
import NativeModulesProxy from './NativeModulesProxy';
import { requireNativeViewManager } from './NativeViewManagerAdapter';
import Platform from './Platform';
import SharedObject from './SharedObject';
import { CodedError } from './errors/CodedError';
import { UnavailabilityError } from './errors/UnavailabilityError';
import './sweet/setUpErrorManager.fx';
import './web/index';
export { default as uuid } from './uuid';
export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, Platform, requireNativeViewManager,
// Globals
SharedObject, NativeModule,
// Errors
CodedError, UnavailabilityError, };
export * from './requireNativeModule';
export * from './createWebModule';
export * from './TypedArrays.types';
/**
* @deprecated renamed to `DeviceEventEmitter`
*/
export const SyntheticPlatformEmitter = DeviceEventEmitter;
export * from './PermissionsInterface';
export * from './PermissionsHook';
export * from './Refs';
export * from './hooks/useReleasingSharedObject';
export * from './reload';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AACtC,OAAO,aAAa,CAAC;AAIrB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAElB,QAAQ,EAER,wBAAwB;AACxB,UAAU;AACV,YAAY,EACZ,YAAY;AACZ,SAAS;AACT,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,QAAQ,CAAC;AAEvB,cAAc,kCAAkC,CAAC;AACjD,cAAc,UAAU,CAAC","sourcesContent":["import { DeviceEventEmitter } from 'react-native';\n\nimport { EventEmitter, Subscription } from './EventEmitter';\nimport NativeModule from './NativeModule';\nimport NativeModulesProxy from './NativeModulesProxy';\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\nimport { requireNativeViewManager } from './NativeViewManagerAdapter';\nimport Platform from './Platform';\nimport SharedObject from './SharedObject';\nimport { CodedError } from './errors/CodedError';\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\nimport './sweet/setUpErrorManager.fx';\nimport './web/index';\n\nexport type * from './ts-declarations/global';\n\nexport { default as uuid } from './uuid';\n\nexport {\n DeviceEventEmitter,\n EventEmitter,\n NativeModulesProxy,\n ProxyNativeModule,\n Platform,\n Subscription,\n requireNativeViewManager,\n // Globals\n SharedObject,\n NativeModule,\n // Errors\n CodedError,\n UnavailabilityError,\n};\n\nexport * from './requireNativeModule';\nexport * from './createWebModule';\nexport * from './TypedArrays.types';\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const SyntheticPlatformEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n\nexport * from './Refs';\n\nexport * from './hooks/useReleasingSharedObject';\nexport * from './reload';\n"]}

View File

@@ -0,0 +1,12 @@
/**
* Reloads the app.
*
* This function works for both release and debug builds.
*
* Unlike [`Updates.reloadAsync()`](https://docs.expo.dev/versions/latest/sdk/updates/#updatesreloadasync),
* this function does not use a new update even if one is available. It only reloads the app using the same JavaScript bundle that is currently running.
*
* @param reason The reason for reloading the app. This is used only for some platforms.
*/
export declare function reloadAppAsync(reason?: string): Promise<void>;
//# sourceMappingURL=reload.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../src/reload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,MAAM,GAAE,MAAgC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5F"}

View File

@@ -0,0 +1,14 @@
/**
* Reloads the app.
*
* This function works for both release and debug builds.
*
* Unlike [`Updates.reloadAsync()`](https://docs.expo.dev/versions/latest/sdk/updates/#updatesreloadasync),
* this function does not use a new update even if one is available. It only reloads the app using the same JavaScript bundle that is currently running.
*
* @param reason The reason for reloading the app. This is used only for some platforms.
*/
export async function reloadAppAsync(reason = 'Reloaded from JS call') {
await globalThis.expo?.reloadAppAsync(reason);
}
//# sourceMappingURL=reload.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../src/reload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAiB,uBAAuB;IAC3E,MAAM,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/**\n * Reloads the app.\n *\n * This function works for both release and debug builds.\n *\n * Unlike [`Updates.reloadAsync()`](https://docs.expo.dev/versions/latest/sdk/updates/#updatesreloadasync),\n * this function does not use a new update even if one is available. It only reloads the app using the same JavaScript bundle that is currently running.\n *\n * @param reason The reason for reloading the app. This is used only for some platforms.\n */\nexport async function reloadAppAsync(reason: string = 'Reloaded from JS call'): Promise<void> {\n await globalThis.expo?.reloadAppAsync(reason);\n}\n"]}

View File

@@ -0,0 +1,19 @@
/**
* Imports the native module registered with given name. In the first place it tries to load
* the module installed through the JSI host object and then falls back to the bridge proxy module.
* Notice that the modules loaded from the proxy may not support some features like synchronous functions.
*
* @param moduleName Name of the requested native module.
* @returns Object representing the native module.
* @throws Error when there is no native module with given name.
*/
export declare function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType;
/**
* Imports the native module registered with the given name. The same as `requireNativeModule`,
* but returns `null` when the module cannot be found instead of throwing an error.
*
* @param moduleName Name of the requested native module.
* @returns Object representing the native module or `null` when it cannot be found.
*/
export declare function requireOptionalNativeModule<ModuleType = any>(moduleName: string): ModuleType | null;
//# sourceMappingURL=requireNativeModule.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"requireNativeModule.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAOpF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,GAAG,GAAG,EAC1D,UAAU,EAAE,MAAM,GACjB,UAAU,GAAG,IAAI,CAInB"}

View File

@@ -0,0 +1,30 @@
import NativeModulesProxy from './NativeModulesProxy';
import { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';
/**
* Imports the native module registered with given name. In the first place it tries to load
* the module installed through the JSI host object and then falls back to the bridge proxy module.
* Notice that the modules loaded from the proxy may not support some features like synchronous functions.
*
* @param moduleName Name of the requested native module.
* @returns Object representing the native module.
* @throws Error when there is no native module with given name.
*/
export function requireNativeModule(moduleName) {
const nativeModule = requireOptionalNativeModule(moduleName);
if (!nativeModule) {
throw new Error(`Cannot find native module '${moduleName}'`);
}
return nativeModule;
}
/**
* Imports the native module registered with the given name. The same as `requireNativeModule`,
* but returns `null` when the module cannot be found instead of throwing an error.
*
* @param moduleName Name of the requested native module.
* @returns Object representing the native module or `null` when it cannot be found.
*/
export function requireOptionalNativeModule(moduleName) {
ensureNativeModulesAreInstalled();
return globalThis.expo?.modules?.[moduleName] ?? NativeModulesProxy[moduleName] ?? null;
}
//# sourceMappingURL=requireNativeModule.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"requireNativeModule.js","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAmB,UAAkB;IACtE,MAAM,YAAY,GAAG,2BAA2B,CAAa,UAAU,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,GAAG,CAAC,CAAC;KAC9D;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAAkB;IAElB,+BAA+B,EAAE,CAAC;IAElC,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,kBAAkB,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;AAC1F,CAAC","sourcesContent":["import NativeModulesProxy from './NativeModulesProxy';\nimport { ensureNativeModulesAreInstalled } from './ensureNativeModulesAreInstalled';\n\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType {\n const nativeModule = requireOptionalNativeModule<ModuleType>(moduleName);\n\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n\n/**\n * Imports the native module registered with the given name. The same as `requireNativeModule`,\n * but returns `null` when the module cannot be found instead of throwing an error.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module or `null` when it cannot be found.\n */\nexport function requireOptionalNativeModule<ModuleType = any>(\n moduleName: string\n): ModuleType | null {\n ensureNativeModulesAreInstalled();\n\n return globalThis.expo?.modules?.[moduleName] ?? NativeModulesProxy[moduleName] ?? null;\n}\n"]}

View File

@@ -0,0 +1,3 @@
export declare function requireNativeModule(moduleName: string): void;
export declare function requireOptionalNativeModule(): null;
//# sourceMappingURL=requireNativeModule.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"requireNativeModule.web.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.web.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,QAErD;AAED,wBAAgB,2BAA2B,SAE1C"}

View File

@@ -0,0 +1,7 @@
export function requireNativeModule(moduleName) {
throw new Error(`Cannot find native module '${moduleName}'`);
}
export function requireOptionalNativeModule() {
return null;
}
//# sourceMappingURL=requireNativeModule.web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"requireNativeModule.web.js","sourceRoot":"","sources":["../src/requireNativeModule.web.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["export function requireNativeModule(moduleName: string) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n}\n\nexport function requireOptionalNativeModule() {\n return null;\n}\n"]}

Some files were not shown because too many files have changed in this diff Show More