Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix Modal animations" #2663

Merged
merged 1 commit into from
May 3, 2021
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
15 changes: 2 additions & 13 deletions src/components/OptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import _ from 'underscore';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import {withNavigation} from '@react-navigation/compat';
import TextInputWithFocusStyles from './TextInputWithFocusStyles';
import OptionsList from './OptionsList';
import styles from '../styles/styles';
Expand Down Expand Up @@ -60,10 +59,6 @@ const propTypes = {

// Whether to show the title tooltip
showTitleTooltip: PropTypes.bool,

// The ref to the search input
// eslint-disable-next-line react/forbid-prop-types
navigation: PropTypes.object.isRequired,
};

const defaultProps = {
Expand Down Expand Up @@ -92,13 +87,7 @@ class OptionsSelector extends Component {
}

componentDidMount() {
this.unsubscribeTransitionEnd = this.props.navigation.addListener('transitionEnd', () => {
this.textInput.focus();
});
}

componentWillUnmount() {
this.unsubscribeTransitionEnd();
this.textInput.focus();
}

/**
Expand Down Expand Up @@ -215,4 +204,4 @@ class OptionsSelector extends Component {

OptionsSelector.defaultProps = defaultProps;
OptionsSelector.propTypes = propTypes;
export default withNavigation(OptionsSelector);
export default OptionsSelector;
2 changes: 1 addition & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class AuthScreens extends React.Component {
const modalScreenOptions = {
headerShown: false,
cardStyle: getNavigationModalCardStyle(this.props.isSmallScreenWidth),
cardStyleInterpolator: (...props) => modalCardStyleInterpolator(this.props.isSmallScreenWidth, ...props),
cardStyleInterpolator: modalCardStyleInterpolator,
animationEnabled: true,
gestureDirection: 'horizontal',
cardOverlayEnabled: true,
Expand Down
18 changes: 7 additions & 11 deletions src/libs/Navigation/AppNavigator/modalCardStyleInterpolator.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import {Animated} from 'react-native';
import variables from '../../../styles/variables';

export default (
isSmallScreen,
{
current: {progress},
inverted,
layouts: {
screen,
},
export default ({
current: {progress},
inverted,
layouts: {
screen,
},
) => {
}) => {
const translateX = Animated.multiply(progress.interpolate({
inputRange: [0, 1],
outputRange: [isSmallScreen ? screen.width : variables.sideBarWidth, 0],
outputRange: [screen.width, 0],
extrapolate: 'clamp',
}), inverted);

Expand Down
3 changes: 0 additions & 3 deletions src/pages/home/report/EmojiPickerMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ class EmojiPickerMenu extends Component {
renderItem={this.renderItem}
keyExtractor={item => `emoji_picker_${item.code}`}
numColumns={this.numColumns}
removeClippedSubviews
maxToRenderPerBatch={this.numColumns}
windowSize={3}
style={styles.emojiPickerList}
extraData={this.state.filteredEmojis}
stickyHeaderIndices={this.state.headerIndices}
Expand Down
3 changes: 0 additions & 3 deletions src/pages/home/report/EmojiPickerMenu/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ class EmojiPickerMenu extends Component {
renderItem={this.renderItem}
keyExtractor={item => (`emoji_picker_${item.code}`)}
numColumns={this.numColumns}
removeClippedSubviews
maxToRenderPerBatch={this.numColumns}
windowSize={3}
style={styles.emojiPickerList}
stickyHeaderIndices={this.unfilteredHeaderIndices}
/>
Expand Down
21 changes: 6 additions & 15 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,6 @@ class ReportActionCompose extends React.Component {
}
}

componentWillUnmount() {
if (this.emojiFocusInteractionHandle) {
this.emojiFocusInteractionHandle.cancel();
}
if (this.textInputFocusInteractionHandle) {
this.textInputFocusInteractionHandle.cancel();
}
}

/**
* Updates the Highlight state of the composer
*
Expand Down Expand Up @@ -180,7 +171,7 @@ class ReportActionCompose extends React.Component {
if (this.textInput) {
// There could be other animations running while we trigger manual focus.
// This prevents focus from making those animations janky.
this.textInputFocusInteractionHandle = InteractionManager.runAfterInteractions(() => {
InteractionManager.runAfterInteractions(() => {
this.textInput.focus();
});
}
Expand Down Expand Up @@ -268,11 +259,9 @@ class ReportActionCompose extends React.Component {
* Focus the search input in the emoji picker.
*/
focusEmojiSearchInput() {
this.emojiFocusInteractionHandle = InteractionManager.runAfterInteractions(() => {
if (this.emojiSearchInput && !this.props.isSmallScreenWidth) {
this.emojiSearchInput.focus();
}
});
if (this.emojiSearchInput) {
this.emojiSearchInput.focus();
}
}

/**
Expand Down Expand Up @@ -427,6 +416,8 @@ class ReportActionCompose extends React.Component {
onClose={this.hideEmojiPicker}
onModalShow={this.focusEmojiSearchInput}
hideModalContentWhileAnimating
animationInTiming={1}
animationOutTiming={1}
anchorPosition={{
top: this.state.emojiPopoverAnchorPosition.vertical - CONST.EMOJI_PICKER_SIZE,
left: this.state.emojiPopoverAnchorPosition.horizontal - CONST.EMOJI_PICKER_SIZE,
Expand Down