- 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
90 lines
4.4 KiB
JavaScript
90 lines
4.4 KiB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
|
|
import * as React from 'react';
|
|
import { ScrollView as RNScrollView, Switch as RNSwitch, TextInput as RNTextInput, DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList, RefreshControl as RNRefreshControl } from 'react-native';
|
|
import createNativeWrapper from '../handlers/createNativeWrapper';
|
|
import { nativeViewProps } from '../handlers/NativeViewGestureHandler';
|
|
import { toArray } from '../utils';
|
|
export const RefreshControl = createNativeWrapper(RNRefreshControl, {
|
|
disallowInterruption: true,
|
|
shouldCancelWhenOutside: false
|
|
}); // eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
|
|
const GHScrollView = createNativeWrapper(RNScrollView, {
|
|
disallowInterruption: true,
|
|
shouldCancelWhenOutside: false
|
|
});
|
|
export const ScrollView = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
const refreshControlGestureRef = React.useRef(null);
|
|
const {
|
|
refreshControl,
|
|
waitFor,
|
|
...rest
|
|
} = props;
|
|
return /*#__PURE__*/React.createElement(GHScrollView, _extends({}, rest, {
|
|
// @ts-ignore `ref` exists on `GHScrollView`
|
|
ref: ref,
|
|
waitFor: [...toArray(waitFor !== null && waitFor !== void 0 ? waitFor : []), refreshControlGestureRef] // @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
|
,
|
|
refreshControl: refreshControl ? /*#__PURE__*/React.cloneElement(refreshControl, {
|
|
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
|
ref: refreshControlGestureRef
|
|
}) : undefined
|
|
}));
|
|
}); // backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
|
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
|
|
export const Switch = createNativeWrapper(RNSwitch, {
|
|
shouldCancelWhenOutside: false,
|
|
shouldActivateOnStart: true,
|
|
disallowInterruption: true
|
|
}); // eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
|
|
export const TextInput = createNativeWrapper(RNTextInput); // eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
|
|
export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {
|
|
disallowInterruption: true
|
|
}); // eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
|
|
export const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
const refreshControlGestureRef = React.useRef(null);
|
|
const {
|
|
waitFor,
|
|
refreshControl,
|
|
...rest
|
|
} = props;
|
|
const flatListProps = {};
|
|
const scrollViewProps = {};
|
|
|
|
for (const [propName, value] of Object.entries(rest)) {
|
|
// https://github.com/microsoft/TypeScript/issues/26255
|
|
if (nativeViewProps.includes(propName)) {
|
|
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
scrollViewProps[propName] = value;
|
|
} else {
|
|
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
flatListProps[propName] = value;
|
|
}
|
|
}
|
|
|
|
return (
|
|
/*#__PURE__*/
|
|
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
|
React.createElement(RNFlatList, _extends({
|
|
ref: ref
|
|
}, flatListProps, {
|
|
renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, _extends({}, scrollProps, scrollViewProps, {
|
|
waitFor: [...toArray(waitFor !== null && waitFor !== void 0 ? waitFor : []), refreshControlGestureRef]
|
|
})) // @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
|
,
|
|
refreshControl: refreshControl ? /*#__PURE__*/React.cloneElement(refreshControl, {
|
|
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
|
ref: refreshControlGestureRef
|
|
}) : undefined
|
|
}))
|
|
);
|
|
}); // eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
//# sourceMappingURL=GestureComponents.js.map
|