- 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
67 lines
3.0 KiB
JavaScript
67 lines
3.0 KiB
JavaScript
'use strict';
|
|
|
|
export function valueSetter(mutable, value, forceUpdate = false) {
|
|
'worklet';
|
|
|
|
const previousAnimation = mutable._animation;
|
|
if (previousAnimation) {
|
|
previousAnimation.cancelled = true;
|
|
mutable._animation = null;
|
|
}
|
|
if (typeof value === 'function' || value !== null && typeof value === 'object' &&
|
|
// TODO TYPESCRIPT fix this after fixing AnimationObject type
|
|
value.onFrame !== undefined) {
|
|
const animation = typeof value === 'function' ?
|
|
// TODO TYPESCRIPT fix this after fixing AnimationObject type
|
|
value() :
|
|
// TODO TYPESCRIPT fix this after fixing AnimationObject type
|
|
value;
|
|
// prevent setting again to the same value
|
|
// and triggering the mappers that treat this value as an input
|
|
// this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)
|
|
// built in animations that are not higher order(withTiming, withSpring) hold target value in .current
|
|
if (mutable._value === animation.current && !animation.isHigherOrder && !forceUpdate) {
|
|
animation.callback && animation.callback(true);
|
|
return;
|
|
}
|
|
// animated set
|
|
const initializeAnimation = timestamp => {
|
|
animation.onStart(animation, mutable.value, timestamp, previousAnimation);
|
|
};
|
|
const currentTimestamp = global.__frameTimestamp || global._getAnimationTimestamp();
|
|
initializeAnimation(currentTimestamp);
|
|
const step = newTimestamp => {
|
|
// Function `requestAnimationFrame` adds callback to an array, all the callbacks are flushed with function `__flushAnimationFrame`
|
|
// Usually we flush them inside function `nativeRequestAnimationFrame` and then the given timestamp is the timestamp of end of the current frame.
|
|
// However function `__flushAnimationFrame` may also be called inside `registerEventHandler` - then we get actual timestamp which is earlier than the end of the frame.
|
|
|
|
const timestamp = newTimestamp < (animation.timestamp || 0) ? animation.timestamp : newTimestamp;
|
|
if (animation.cancelled) {
|
|
animation.callback && animation.callback(false /* finished */);
|
|
return;
|
|
}
|
|
const finished = animation.onFrame(animation, timestamp);
|
|
animation.finished = true;
|
|
animation.timestamp = timestamp;
|
|
// TODO TYPESCRIPT
|
|
// For now I'll assume that `animation.current` is always defined
|
|
// but actually need to dive into animations to understand it
|
|
mutable._value = animation.current;
|
|
if (finished) {
|
|
animation.callback && animation.callback(true /* finished */);
|
|
} else {
|
|
requestAnimationFrame(step);
|
|
}
|
|
};
|
|
mutable._animation = animation;
|
|
step(currentTimestamp);
|
|
} else {
|
|
// prevent setting again to the same value
|
|
// and triggering the mappers that treat this value as an input
|
|
if (mutable._value === value && !forceUpdate) {
|
|
return;
|
|
}
|
|
mutable._value = value;
|
|
}
|
|
}
|
|
//# sourceMappingURL=valueSetter.js.map
|