Skip to content

Commit

Permalink
fix: refactor types
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Oct 9, 2024
1 parent 3bc381c commit 707e207
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import Animations from '..';
import type NoneTransitionNavigationOptions from './types';

const none: NativeStackNavigationOptions = {animation: Animations.NONE, gestureEnabled: false};
const none: NoneTransitionNavigationOptions = {animation: Animations.NONE, gestureEnabled: false} satisfies NativeStackNavigationOptions;

export default none;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {StackNavigationOptions} from '@react-navigation/stack';
import type NoneTransitionNavigationOptions from './types';

const none: StackNavigationOptions = {animationEnabled: false, gestureEnabled: false};
const none: NoneTransitionNavigationOptions = {animationEnabled: false, gestureEnabled: false} satisfies StackNavigationOptions;

export default none;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types';

type NoneTransitionNavigationOptions = PlatformSpecificNavigationOptions;

export default NoneTransitionNavigationOptions;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import Animations from '..';
import type SlideFromBottomTransitionNavigationOptions from './types';

const slideFromBottom: NativeStackNavigationOptions = {animation: Animations.SLIDE_FROM_BOTTOM};
const slideFromBottom: SlideFromBottomTransitionNavigationOptions = {animation: Animations.SLIDE_FROM_BOTTOM} satisfies NativeStackNavigationOptions;

export default slideFromBottom;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {StackNavigationOptions} from '@react-navigation/stack';
import GestureDirection from '@libs/Navigation/PlatformStackNavigation/navigationOptions/gestureDirection';
import type SlideFromBottomTransitionNavigationOptions from './types';

const slideFromBottom: StackNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.VERTICAL};
const slideFromBottom: SlideFromBottomTransitionNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.VERTICAL} satisfies StackNavigationOptions;

export default slideFromBottom;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types';

type SlideFromBottomTransitionNavigationOptions = PlatformSpecificNavigationOptions;

export default SlideFromBottomTransitionNavigationOptions;
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import Animations from '..';
import type SlideFromLeftTransitionNavigationOptions from './types';

// `slide_from_right` is resolved to `default` transition on iOS, but this transition causes issues on iOS
const slideFromLeft: NativeStackNavigationOptions = {animation: Animations.IOS_FROM_LEFT};
const slideFromLeft: SlideFromLeftTransitionNavigationOptions = {animation: Animations.IOS_FROM_LEFT} satisfies NativeStackNavigationOptions;

export default slideFromLeft;
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import Animations from '..';
import type SlideFromLeftTransitionNavigationOptions from './types';

// default transition is causing weird keyboard appearance: - https://github.com/Expensify/App/issues/37257
// so we are using `slide_from_left` which is similar to default and not causing keyboard transition issues
const slideFromLeft: NativeStackNavigationOptions = {animation: Animations.SLIDE_FROM_LEFT};
const slideFromLeft: SlideFromLeftTransitionNavigationOptions = {animation: Animations.SLIDE_FROM_LEFT} satisfies NativeStackNavigationOptions;

export default slideFromLeft;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {StackNavigationOptions} from '@react-navigation/stack';
import GestureDirection from '@libs/Navigation/PlatformStackNavigation/navigationOptions/gestureDirection';
import type SlideFromLeftTransitionNavigationOptions from './types';

const slideFromLeft: StackNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.HORIZONTAL_INVERTED};
const slideFromLeft: SlideFromLeftTransitionNavigationOptions = {animationEnabled: true, gestureDirection: GestureDirection.HORIZONTAL_INVERTED} satisfies StackNavigationOptions;

export default slideFromLeft;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types';

type SlideFromLeftTransitionNavigationOptions = PlatformSpecificNavigationOptions;

export default SlideFromLeftTransitionNavigationOptions;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import Animations from '..';
import type SlideFromRightTransitionNavigationOptions from './types';

const transition: NativeStackNavigationOptions = {animation: Animations.IOS_FROM_RIGHT};
const transition: SlideFromRightTransitionNavigationOptions = {animation: Animations.IOS_FROM_RIGHT} satisfies NativeStackNavigationOptions;

export default transition;
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import Animations from '..';
import type SlideFromRightTransitionNavigationOptions from './types';

// default transition is causing weird keyboard appearance: - https://github.com/Expensify/App/issues/37257
// so we are using `simple_push` which is similar to default and not causing keyboard transition issues
const transition: NativeStackNavigationOptions = {animation: Animations.SIMPLE_PUSH};
const transition: SlideFromRightTransitionNavigationOptions = {animation: Animations.SIMPLE_PUSH} satisfies NativeStackNavigationOptions;

export default transition;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {StackNavigationOptions} from '@react-navigation/stack';
import type SlideFromRightTransitionNavigationOptions from './types';

const slideFromRight: StackNavigationOptions = {animationEnabled: true, gestureDirection: 'horizontal'};
const slideFromRight: SlideFromRightTransitionNavigationOptions = {animationEnabled: true, gestureDirection: 'horizontal'} satisfies StackNavigationOptions;

export default slideFromRight;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {PlatformSpecificNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types';

type SlideFromRightTransitionNavigationOptions = PlatformSpecificNavigationOptions;

export default SlideFromRightTransitionNavigationOptions;

0 comments on commit 707e207

Please sign in to comment.