Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ function RigthModalNavigator() {
<Stack.Screen
name="NewGroup"
component={ModalStackNavigators.NewGroupModalStackNavigator}
options={{
// Disable animation for this screen because it causes an animation glitch when using shortcuts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a link to a video with the glitch? I think it'd be nice to add it here so we have a reference in case we wanna fix it later on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

animationEnabled: false,
}}
/>
<Stack.Screen
name="Search"
component={ModalStackNavigators.SearchModalStackNavigator}
options={{
// Disable animation for this screen because it causes an animation glitch when using shortcuts
animationEnabled: false,
}}
/>
<Stack.Screen
name="Details"
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/RHPScreenOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from '../../../styles/styles';

const RHPScreenOptions = {
headerShown: false,
animationEnabled: false,
animationEnabled: true,
gestureDirection: 'horizontal',
cardStyle: styles.navigationScreenCardStyle,
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS,
Expand Down
13 changes: 3 additions & 10 deletions src/libs/Navigation/linkTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@ import getStateFromPath from './getStateFromPath';
*
* @param {Object} action action generated by getActionFromState
* @param {Object} state The root state
* @returns {{minimalAction: Object, targetName: String}} minimal action is the action that we should dispatch and targetName is the name of the target navigator.
* targetName name is necessary to determine if we are going to use REPLACE for navigating between RHP flows.
* @returns {Object} minimalAction minimal action is the action that we should dispatch
*/
function getMinimalAction(action, state) {
let currentAction = action;
let currentState = state;
let currentTargetKey = null;
let targetName = null;

while (currentState.routes[currentState.index].name === currentAction.payload.name) {
if (!currentState.routes[currentState.index].state) {
break;
}

targetName = currentState.routes[currentState.index].name;
currentState = currentState.routes[currentState.index].state;

currentTargetKey = currentState.key;
Expand All @@ -40,7 +37,7 @@ function getMinimalAction(action, state) {
target: currentTargetKey,
};
}
return {minimalAction: currentAction, targetName};
return currentAction;
}

export default function linkTo(navigation, path, type) {
Expand Down Expand Up @@ -79,12 +76,8 @@ export default function linkTo(navigation, path, type) {
}

if (action.payload.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR) {
const {minimalAction, targetName} = getMinimalAction(action, navigation.getRootState());
const minimalAction = getMinimalAction(action, navigation.getRootState());
if (minimalAction) {
// If the target name is RHP that means this action is responsible for changing flow within the RHP e.g. from settings to search. In that case we want to use REPLACE.
if (targetName === NAVIGATORS.RIGHT_MODAL_NAVIGATOR) {
minimalAction.type = 'REPLACE';
}
root.dispatch(minimalAction);
return;
}
Expand Down