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

Optionally disable the menu opening animiation #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 15 additions & 5 deletions src/menu/makeMenuContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ module.exports = (React, ReactNative, { constants, model, styles }) => {

const makeOptions = (options, { top, right }) => {
const { optionsContainerStyle, renderOptionsContainer = defaultOptionsContainerRenderer} = options.props;
return (
<AnimatedOptionsContainer style={[ styles.optionsContainer, optionsContainerStyle, { top, right }]}>
{ renderOptionsContainer(options) }
</AnimatedOptionsContainer>
);
if(options.animate) {
return (
<AnimatedOptionsContainer style={[ styles.optionsContainer, optionsContainerStyle, { top, right }]}>
{ renderOptionsContainer(options) }
</AnimatedOptionsContainer>
);
}
else {
return (
<View style={[ styles.optionsContainer, optionsContainerStyle, { top, right }]}>
{ renderOptionsContainer(options) }
</View>
);
}
};

const NULL_HOOKS = {
Expand Down Expand Up @@ -156,6 +165,7 @@ module.exports = (React, ReactNative, { constants, model, styles }) => {
const { w: ownWidth, px: ownPX, py: ownPY } = this._ownMeasurements;
const optionsTop = menuPY - ownPY;
const optionsRight = ownWidth + ownPX - menuPX - menuWidth;
options['animate'] = 'animate' in this.props ? this.props.animate : true;
return makeOptions(options, { top: optionsTop, right: optionsRight });
},

Expand Down