Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Oct 18, 2024
1 parent fba2945 commit 53b76c9
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 5 deletions.
35 changes: 33 additions & 2 deletions src/components/TabSelector/getBackground/types.ts
Original file line number Diff line number Diff line change
@@ -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<number>;
isActive?: boolean;

/**
* The animated position interpolation.
*/
position: Animated.AnimatedInterpolation<number>;

/**
* 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> | string;

export default GetBackgroudColor;
37 changes: 34 additions & 3 deletions src/components/TabSelector/getOpacity/types.ts
Original file line number Diff line number Diff line change
@@ -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<number>;
isActive?: boolean;

/**
* Scene's position, value which we would like to interpolate.
*/
position: Animated.AnimatedInterpolation<number>;

/**
* Whether the tab is active.
*/
isActive: boolean;
};

type GetOpacity = (args: GetOpacityConfig) => 1 | 0 | Animated.AnimatedInterpolation<number> | 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<number>;

export default GetOpacity;

0 comments on commit 53b76c9

Please sign in to comment.