From 53b76c9f4ef7073c0707eb5b0cae60b0fccd81f1 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 18 Oct 2024 10:36:46 +0200 Subject: [PATCH] fix comments --- .../TabSelector/getBackground/types.ts | 35 +++++++++++++++++- .../TabSelector/getOpacity/types.ts | 37 +++++++++++++++++-- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/src/components/TabSelector/getBackground/types.ts b/src/components/TabSelector/getBackground/types.ts index 5fc368eda253..f66ee37e9b73 100644 --- a/src/components/TabSelector/getBackground/types.ts +++ b/src/components/TabSelector/getBackground/types.ts @@ -1,15 +1,46 @@ import type {Animated} from 'react-native'; import type {ThemeColors} from '@styles/theme/types'; +/** + * Configuration for the getBackgroundColor function. + */ type GetBackgroudColorConfig = { + /** + * The number of routes. + */ routesLength: number; + + /** + * The index of the current tab. + */ tabIndex: number; + + /** + * The indices of the affected tabs. + */ affectedTabs: number[]; + + /** + * The theme colors. + */ theme: ThemeColors; - position?: Animated.AnimatedInterpolation; - isActive?: boolean; + + /** + * The animated position interpolation. + */ + position: Animated.AnimatedInterpolation; + + /** + * Whether the tab is active. + */ + isActive: boolean; }; +/** + * Function to get the background color. + * @param args - The configuration for the background color. + * @returns The interpolated background color or a string. + */ type GetBackgroudColor = (args: GetBackgroudColorConfig) => Animated.AnimatedInterpolation | string; export default GetBackgroudColor; diff --git a/src/components/TabSelector/getOpacity/types.ts b/src/components/TabSelector/getOpacity/types.ts index 5f4a881c3ef5..46e4568b2783 100644 --- a/src/components/TabSelector/getOpacity/types.ts +++ b/src/components/TabSelector/getOpacity/types.ts @@ -1,14 +1,45 @@ import type {Animated} from 'react-native'; +/** + * Configuration for the getOpacity function. + */ type GetOpacityConfig = { + /** + * The number of routes in the tab bar. + */ routesLength: number; + + /** + * The index of the tab. + */ tabIndex: number; + + /** + * Whether we are calculating the opacity for the active tab. + */ active: boolean; + + /** + * The indexes of the tabs that are affected by the animation. + */ affectedTabs: number[]; - position?: Animated.AnimatedInterpolation; - isActive?: boolean; + + /** + * Scene's position, value which we would like to interpolate. + */ + position: Animated.AnimatedInterpolation; + + /** + * Whether the tab is active. + */ + isActive: boolean; }; -type GetOpacity = (args: GetOpacityConfig) => 1 | 0 | Animated.AnimatedInterpolation | undefined; +/** + * Function to get the opacity. + * @param args - The configuration for the opacity. + * @returns The interpolated opacity or a fixed value (1 or 0). + */ +type GetOpacity = (args: GetOpacityConfig) => 1 | 0 | Animated.AnimatedInterpolation; export default GetOpacity;