From 156b349c4334ca940c270498408c7b08728d456d Mon Sep 17 00:00:00 2001 From: Nate Collings Date: Sun, 2 Oct 2016 14:31:46 -0600 Subject: [PATCH] Optionally disable the menu opening animiation Animations seem to often be really screwed up on Android with react-native currently, and I've experienced the same thing with react-native-menu. The menu will 'flicker' briefly when opened. This is a temporary workaround that just disabled the animations if you setup a MenuContext like this: --- src/menu/makeMenuContext.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/menu/makeMenuContext.js b/src/menu/makeMenuContext.js index c2d7e60..1802629 100644 --- a/src/menu/makeMenuContext.js +++ b/src/menu/makeMenuContext.js @@ -30,11 +30,20 @@ module.exports = (React, ReactNative, { constants, model, styles }) => { const makeOptions = (options, { top, right }) => { const { optionsContainerStyle, renderOptionsContainer = defaultOptionsContainerRenderer} = options.props; - return ( - - { renderOptionsContainer(options) } - - ); + if(options.animate) { + return ( + + { renderOptionsContainer(options) } + + ); + } + else { + return ( + + { renderOptionsContainer(options) } + + ); + } }; const NULL_HOOKS = { @@ -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 }); },