- 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
82 lines
3.6 KiB
JavaScript
82 lines
3.6 KiB
JavaScript
'use strict';
|
|
|
|
import { shouldBeUseWeb } from './PlatformChecker';
|
|
import { isWorkletFunction } from './commonTypes';
|
|
function valueUnpacker(objectToUnpack, category, remoteFunctionName) {
|
|
'worklet';
|
|
|
|
let workletsCache = global.__workletsCache;
|
|
let handleCache = global.__handleCache;
|
|
if (workletsCache === undefined) {
|
|
// init
|
|
workletsCache = global.__workletsCache = new Map();
|
|
handleCache = global.__handleCache = new WeakMap();
|
|
}
|
|
const workletHash = objectToUnpack.__workletHash;
|
|
if (workletHash !== undefined) {
|
|
let workletFun = workletsCache.get(workletHash);
|
|
if (workletFun === undefined) {
|
|
const initData = objectToUnpack.__initData;
|
|
if (global.evalWithSourceMap) {
|
|
// if the runtime (hermes only for now) supports loading source maps
|
|
// we want to use the proper filename for the location as it guarantees
|
|
// that debugger understands and loads the source code of the file where
|
|
// the worklet is defined.
|
|
workletFun = global.evalWithSourceMap('(' + initData.code + '\n)', initData.location, initData.sourceMap);
|
|
} else if (global.evalWithSourceUrl) {
|
|
// if the runtime doesn't support loading source maps, in dev mode we
|
|
// can pass source url when evaluating the worklet. Now, instead of using
|
|
// the actual file location we use worklet hash, as it the allows us to
|
|
// properly symbolicate traces (see errors.ts for details)
|
|
workletFun = global.evalWithSourceUrl('(' + initData.code + '\n)', `worklet_${workletHash}`);
|
|
} else {
|
|
// in release we use the regular eval to save on JSI calls
|
|
// eslint-disable-next-line no-eval
|
|
workletFun = eval('(' + initData.code + '\n)');
|
|
}
|
|
workletsCache.set(workletHash, workletFun);
|
|
}
|
|
const functionInstance = workletFun.bind(objectToUnpack);
|
|
objectToUnpack._recur = functionInstance;
|
|
return functionInstance;
|
|
} else if (objectToUnpack.__init !== undefined) {
|
|
let value = handleCache.get(objectToUnpack);
|
|
if (value === undefined) {
|
|
value = objectToUnpack.__init();
|
|
handleCache.set(objectToUnpack, value);
|
|
}
|
|
return value;
|
|
} else if (category === 'RemoteFunction') {
|
|
const fun = () => {
|
|
const label = remoteFunctionName ? `function \`${remoteFunctionName}\`` : 'anonymous function';
|
|
throw new Error(`[Reanimated] Tried to synchronously call a non-worklet ${label} on the UI thread.
|
|
See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#tried-to-synchronously-call-a-non-worklet-function-on-the-ui-thread for more details.`);
|
|
};
|
|
fun.__remoteFunction = objectToUnpack;
|
|
return fun;
|
|
} else {
|
|
throw new Error(`[Reanimated] Data type in category "${category}" not recognized by value unpacker: "${_toString(objectToUnpack)}".`);
|
|
}
|
|
}
|
|
if (__DEV__ && !shouldBeUseWeb()) {
|
|
const testWorklet = () => {
|
|
'worklet';
|
|
};
|
|
if (!isWorkletFunction(testWorklet)) {
|
|
throw new Error(`[Reanimated] Failed to create a worklet. See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#failed-to-create-a-worklet for more details.`);
|
|
}
|
|
if (!isWorkletFunction(valueUnpacker)) {
|
|
throw new Error('[Reanimated] `valueUnpacker` is not a worklet');
|
|
}
|
|
const closure = valueUnpacker.__closure;
|
|
if (closure === undefined) {
|
|
throw new Error('[Reanimated] `valueUnpacker` closure is undefined');
|
|
}
|
|
if (Object.keys(closure).length !== 0) {
|
|
throw new Error('[Reanimated] `valueUnpacker` must have empty closure');
|
|
}
|
|
}
|
|
export function getValueUnpackerCode() {
|
|
return valueUnpacker.__initData.code;
|
|
}
|
|
//# sourceMappingURL=valueUnpacker.js.map
|