From de787bf5a6d51837b2e30b32eec726fd5bc55901 Mon Sep 17 00:00:00 2001 From: keplyx Date: Tue, 4 Feb 2020 19:42:40 +0100 Subject: [PATCH] Changed screen transition animations --- navigation/DrawerNavigator.js | 40 +++++++++++++++++++++++--------- navigation/MainTabNavigator.js | 10 ++++---- screens/PlanningDisplayScreen.js | 2 +- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/navigation/DrawerNavigator.js b/navigation/DrawerNavigator.js index 31a489e..ba16eef 100644 --- a/navigation/DrawerNavigator.js +++ b/navigation/DrawerNavigator.js @@ -33,22 +33,40 @@ const AboutStack = createStackNavigator({ }, }); + +// Create a stack to use animations +function createDrawerStackWithInitialRoute(initialRoute: string) { + return createStackNavigator({ + Main: createMaterialBottomTabNavigatorWithInitialRoute(initialRoute), + SettingsScreen: {screen: SettingsScreen}, + AboutScreen: AboutStack, + SelfMenuScreen: {screen: SelfMenuScreen}, + TutorInsaScreen: {screen: TutorInsaScreen}, + AmicaleScreen: {screen: AmicaleScreen}, + WiketudScreen: {screen: WiketudScreen}, + ElusEtudScreen: {screen: ElusEtudScreen}, + BlueMindScreen: {screen: BlueMindScreen}, + EntScreen: {screen: EntScreen}, + AvailableRoomScreen: {screen: AvailableRoomScreen}, + }, + { + initialRouteName: "Main", + mode: 'card', + headerMode: "none", + defaultNavigationOptions: { + gestureEnabled: true, + cardOverlayEnabled: true, + ...TransitionPresets.SlideFromRightIOS, + }, + }); +} + /** * Creates the drawer navigation stack */ function createDrawerNavigatorWithInitialRoute(initialRoute: string) { return createDrawerNavigator({ - Main: createMaterialBottomTabNavigatorWithInitialRoute(initialRoute), - SettingsScreen: {screen: SettingsScreen}, - AboutScreen: AboutStack, - SelfMenuScreen: {screen: SelfMenuScreen}, - TutorInsaScreen: {screen: TutorInsaScreen}, - AmicaleScreen: {screen: AmicaleScreen}, - WiketudScreen: {screen: WiketudScreen}, - ElusEtudScreen: {screen: ElusEtudScreen}, - BlueMindScreen: {screen: BlueMindScreen}, - EntScreen: {screen: EntScreen}, - AvailableRoomScreen: {screen: AvailableRoomScreen}, + Main: createDrawerStackWithInitialRoute(initialRoute), }, { contentComponent: Sidebar, initialRouteName: 'Main', diff --git a/navigation/MainTabNavigator.js b/navigation/MainTabNavigator.js index 965b21b..1d0e556 100644 --- a/navigation/MainTabNavigator.js +++ b/navigation/MainTabNavigator.js @@ -27,8 +27,8 @@ const ProximoStack = createStackNavigator({ ProximoListScreen: {screen: ProximoListScreen}, ProximoAboutScreen: { screen: ProximoAboutScreen, - navigationOptions: ({ navigation }) => ({ - ...TransitionPresets.ModalPresentationIOS, + navigationOptions: () => ({ + ...TransitionPresets.ModalSlideFromBottomIOS, }), }, }, @@ -54,7 +54,7 @@ const ProxiwashStack = createStackNavigator({ defaultNavigationOptions: { gestureEnabled: true, cardOverlayEnabled: true, - ...TransitionPresets.ModalPresentationIOS, + ...TransitionPresets.ModalSlideFromBottomIOS, }, }); @@ -69,7 +69,7 @@ const PlanningStack = createStackNavigator({ defaultNavigationOptions: { gestureEnabled: true, cardOverlayEnabled: true, - ...TransitionPresets.ModalPresentationIOS, + ...TransitionPresets.ModalSlideFromBottomIOS, }, }); @@ -84,7 +84,7 @@ const HomeStack = createStackNavigator({ defaultNavigationOptions: { gestureEnabled: true, cardOverlayEnabled: true, - ...TransitionPresets.ModalPresentationIOS, + ...TransitionPresets.ModalSlideFromBottomIOS, }, }); diff --git a/screens/PlanningDisplayScreen.js b/screens/PlanningDisplayScreen.js index bd75d36..10a611d 100644 --- a/screens/PlanningDisplayScreen.js +++ b/screens/PlanningDisplayScreen.js @@ -30,7 +30,7 @@ export default class PlanningDisplayScreen extends React.Component {