Skip to content

Commit

Permalink
refactor: rename shifting animation to shift
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Mar 8, 2024
1 parent 41e512e commit 0e5b108
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion example/src/Screens/BottomTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const AlbumsScreen = () => {

const Tab = createBottomTabNavigator<BottomTabParams>();

const animations = ['none', 'fade', 'shifting'] as const;
const animations = ['none', 'fade', 'shift'] as const;

export function BottomTabs() {
const { showActionSheetWithOptions } = useActionSheet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function forFade({
/**
* Animation where the screens slightly shift to left/right
*/
export function forShifting({
export function forShift({
current,
}: BottomTabSceneInterpolationProps): BottomTabSceneInterpolatedStyle {
return {
Expand Down
10 changes: 5 additions & 5 deletions packages/bottom-tabs/src/TransitionConfigs/TransitionPresets.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { BottomTabTransitionPreset } from '../types';
import { forFade, forShifting } from './SceneStyleInterpolators';
import { CrossFadeSpec, ShiftingSpec } from './TransitionSpecs';
import { forFade, forShift } from './SceneStyleInterpolators';
import { CrossFadeSpec, ShiftSpec } from './TransitionSpecs';

export const FadeTransition: BottomTabTransitionPreset = {
transitionSpec: CrossFadeSpec,
sceneStyleInterpolator: forFade,
};

export const ShiftingTransition: BottomTabTransitionPreset = {
transitionSpec: ShiftingSpec,
sceneStyleInterpolator: forShifting,
export const ShiftTransition: BottomTabTransitionPreset = {
transitionSpec: ShiftSpec,
sceneStyleInterpolator: forShift,
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const CrossFadeSpec: TransitionSpec = {
},
};

export const ShiftingSpec: TransitionSpec = {
export const ShiftSpec: TransitionSpec = {
animation: 'timing',
config: {
duration: 150,
Expand Down
4 changes: 2 additions & 2 deletions packages/bottom-tabs/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export type TabBarVisibilityAnimationConfig =
| TimingKeyboardAnimationConfig
| SpringKeyboardAnimationConfig;

export type TabAnimationName = 'none' | 'fade' | 'shifting';
export type TabAnimationName = 'none' | 'fade' | 'shift';

export type BottomTabNavigationOptions = HeaderOptions & {
/**
Expand Down Expand Up @@ -270,7 +270,7 @@ export type BottomTabNavigationOptions = HeaderOptions & {
* Supported values:
* - 'none': don't animate the screen (default)
* - 'fade': cross-fade the screens.
* - 'shifting': shift the screens slightly shift to left/right.
* - 'shift': shift the screens slightly shift to left/right.
*/
animation?: TabAnimationName;

Expand Down
4 changes: 2 additions & 2 deletions packages/bottom-tabs/src/views/BottomTabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SafeAreaInsetsContext } from 'react-native-safe-area-context';

import {
FadeTransition,
ShiftingTransition,
ShiftTransition,
} from '../TransitionConfigs/TransitionPresets';
import type {
BottomTabBarProps,
Expand Down Expand Up @@ -44,7 +44,7 @@ const STATE_ON_TOP = 2;

const NAMED_TRANSITIONS_PRESETS = {
fade: FadeTransition,
shifting: ShiftingTransition,
shift: ShiftTransition,
none: {
sceneStyleInterpolator: undefined,
transitionSpec: {
Expand Down

0 comments on commit 0e5b108

Please sign in to comment.