- 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
88 lines
2.5 KiB
TypeScript
88 lines
2.5 KiB
TypeScript
'use strict';
|
|
import { PropsAllowlists } from './propsAllowlists';
|
|
import { jsiConfigureProps } from './reanimated2/core';
|
|
function assertNoOverlapInLists() {
|
|
for (const key in PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST) {
|
|
if (key in PropsAllowlists.UI_THREAD_PROPS_WHITELIST) {
|
|
throw new Error(
|
|
`[Reanimated] Property \`${key}\` was whitelisted both as UI and native prop. Please remove it from one of the lists.`
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
export function configureProps(): void {
|
|
assertNoOverlapInLists();
|
|
jsiConfigureProps(
|
|
Object.keys(PropsAllowlists.UI_THREAD_PROPS_WHITELIST),
|
|
Object.keys(PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST)
|
|
);
|
|
}
|
|
|
|
export function addWhitelistedNativeProps(
|
|
props: Record<string, boolean>
|
|
): void {
|
|
const oldSize = Object.keys(
|
|
PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST
|
|
).length;
|
|
PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST = {
|
|
...PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST,
|
|
...props,
|
|
};
|
|
if (
|
|
oldSize !==
|
|
Object.keys(PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST).length
|
|
) {
|
|
configureProps();
|
|
}
|
|
}
|
|
|
|
export function addWhitelistedUIProps(props: Record<string, boolean>): void {
|
|
const oldSize = Object.keys(PropsAllowlists.UI_THREAD_PROPS_WHITELIST).length;
|
|
PropsAllowlists.UI_THREAD_PROPS_WHITELIST = {
|
|
...PropsAllowlists.UI_THREAD_PROPS_WHITELIST,
|
|
...props,
|
|
};
|
|
if (
|
|
oldSize !== Object.keys(PropsAllowlists.UI_THREAD_PROPS_WHITELIST).length
|
|
) {
|
|
configureProps();
|
|
}
|
|
}
|
|
|
|
const PROCESSED_VIEW_NAMES = new Set();
|
|
|
|
export interface ViewConfig {
|
|
uiViewClassName: string;
|
|
validAttributes: Record<string, unknown>;
|
|
}
|
|
/**
|
|
* updates UI props whitelist for given view host instance
|
|
* this will work just once for every view name
|
|
*/
|
|
|
|
export function adaptViewConfig(viewConfig: ViewConfig): void {
|
|
const viewName = viewConfig.uiViewClassName;
|
|
const props = viewConfig.validAttributes;
|
|
|
|
// update whitelist of UI props for this view name only once
|
|
if (!PROCESSED_VIEW_NAMES.has(viewName)) {
|
|
const propsToAdd: Record<string, boolean> = {};
|
|
Object.keys(props).forEach((key) => {
|
|
// we don't want to add native props as they affect layout
|
|
// we also skip props which repeat here
|
|
if (
|
|
!(key in PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST) &&
|
|
!(key in PropsAllowlists.UI_THREAD_PROPS_WHITELIST)
|
|
) {
|
|
propsToAdd[key] = true;
|
|
}
|
|
});
|
|
addWhitelistedUIProps(propsToAdd);
|
|
|
|
PROCESSED_VIEW_NAMES.add(viewName);
|
|
}
|
|
}
|
|
|
|
configureProps();
|