- 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
101 lines
2.8 KiB
JavaScript
101 lines
2.8 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
import type {EndCallback} from '../animations/Animation';
|
|
import type AnimatedValue from './AnimatedValue';
|
|
|
|
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
|
import AnimatedNode from './AnimatedNode';
|
|
|
|
export default class AnimatedTracking extends AnimatedNode {
|
|
_value: AnimatedValue;
|
|
_parent: AnimatedNode;
|
|
_callback: ?EndCallback;
|
|
_animationConfig: Object;
|
|
_animationClass: any;
|
|
_useNativeDriver: boolean;
|
|
|
|
constructor(
|
|
value: AnimatedValue,
|
|
parent: AnimatedNode,
|
|
animationClass: any,
|
|
animationConfig: Object,
|
|
callback?: ?EndCallback,
|
|
) {
|
|
super();
|
|
this._value = value;
|
|
this._parent = parent;
|
|
this._animationClass = animationClass;
|
|
this._animationConfig = animationConfig;
|
|
this._useNativeDriver =
|
|
NativeAnimatedHelper.shouldUseNativeDriver(animationConfig);
|
|
this._callback = callback;
|
|
this.__attach();
|
|
}
|
|
|
|
__makeNative(platformConfig: ?PlatformConfig) {
|
|
this.__isNative = true;
|
|
this._parent.__makeNative(platformConfig);
|
|
super.__makeNative(platformConfig);
|
|
this._value.__makeNative(platformConfig);
|
|
}
|
|
|
|
__getValue(): Object {
|
|
return this._parent.__getValue();
|
|
}
|
|
|
|
__attach(): void {
|
|
this._parent.__addChild(this);
|
|
if (this._useNativeDriver) {
|
|
// when the tracking starts we need to convert this node to a "native node"
|
|
// so that the parent node will be made "native" too. This is necessary as
|
|
// if we don't do this `update` method will get called. At that point it
|
|
// may be too late as it would mean the JS driver has already started
|
|
// updating node values
|
|
let {platformConfig} = this._animationConfig;
|
|
this.__makeNative(platformConfig);
|
|
}
|
|
}
|
|
|
|
__detach(): void {
|
|
this._parent.__removeChild(this);
|
|
super.__detach();
|
|
}
|
|
|
|
update(): void {
|
|
this._value.animate(
|
|
new this._animationClass({
|
|
...this._animationConfig,
|
|
toValue: (this._animationConfig.toValue: any).__getValue(),
|
|
}),
|
|
this._callback,
|
|
);
|
|
}
|
|
|
|
__getNativeConfig(): any {
|
|
const animation = new this._animationClass({
|
|
...this._animationConfig,
|
|
// remove toValue from the config as it's a ref to Animated.Value
|
|
toValue: undefined,
|
|
});
|
|
const animationConfig = animation.__getNativeAnimationConfig();
|
|
return {
|
|
type: 'tracking',
|
|
animationId: NativeAnimatedHelper.generateNewAnimationId(),
|
|
animationConfig,
|
|
toValue: this._parent.__getNativeTag(),
|
|
value: this._value.__getNativeTag(),
|
|
};
|
|
}
|
|
}
|