diff --git a/build/rnpm.js b/build/rnpm.js
index 9c42b9b..b8e4831 100644
--- a/build/rnpm.js
+++ b/build/rnpm.js
@@ -1501,9 +1501,9 @@
};
}
- // common durations of animation
var OPEN_ANIM_DURATION = 225;
var CLOSE_ANIM_DURATION = 195;
+ var USE_NATIVE_DRIVER = reactNative.Platform.OS !== "web";
var Backdrop =
/*#__PURE__*/
@@ -1535,7 +1535,7 @@
reactNative.Animated.timing(_this2.fadeAnim, {
duration: OPEN_ANIM_DURATION,
toValue: 1,
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start(resolve);
});
}
@@ -1548,7 +1548,7 @@
reactNative.Animated.timing(_this3.fadeAnim, {
duration: CLOSE_ANIM_DURATION,
toValue: 0,
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start(resolve);
});
}
@@ -2464,7 +2464,7 @@
duration: OPEN_ANIM_DURATION,
toValue: 1,
easing: reactNative.Easing.out(reactNative.Easing.cubic),
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start();
}
}, {
@@ -2477,7 +2477,7 @@
duration: CLOSE_ANIM_DURATION,
toValue: 0,
easing: reactNative.Easing.in(reactNative.Easing.cubic),
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start(resolve);
});
}
@@ -2926,7 +2926,7 @@
duration: OPEN_ANIM_DURATION,
toValue: 1,
easing: reactNative.Easing.out(reactNative.Easing.cubic),
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start();
}
}, {
@@ -2939,7 +2939,7 @@
duration: CLOSE_ANIM_DURATION,
toValue: 0,
easing: reactNative.Easing.in(reactNative.Easing.cubic),
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start(resolve);
});
}
@@ -3249,7 +3249,7 @@
duration: OPEN_ANIM_DURATION,
toValue: 1,
easing: reactNative.Easing.out(reactNative.Easing.cubic),
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start();
}
}, {
@@ -3262,7 +3262,7 @@
duration: CLOSE_ANIM_DURATION,
toValue: 0,
easing: reactNative.Easing.in(reactNative.Easing.cubic),
- useNativeDriver: true
+ useNativeDriver: USE_NATIVE_DRIVER
}).start(resolve);
});
}
diff --git a/build/rnpm.js.map b/build/rnpm.js.map
index 3b557ba..5aa50f0 100644
--- a/build/rnpm.js.map
+++ b/build/rnpm.js.map
@@ -1 +1 @@
-{"version":3,"file":"rnpm.js","sources":["../src/polyfills.js","../src/helpers.js","../node_modules/react-is/cjs/react-is.development.js","../node_modules/react-is/index.js","../node_modules/object-assign/index.js","../node_modules/prop-types/lib/ReactPropTypesSecret.js","../node_modules/prop-types/checkPropTypes.js","../node_modules/prop-types/factoryWithTypeCheckers.js","../node_modules/prop-types/index.js","../src/with-context.js","../src/menuRegistry.js","../src/constants.js","../src/Backdrop.js","../src/logger.js","../src/MenuPlaceholder.js","../src/renderers/MenuOutside.js","../src/MenuProvider.js","../src/MenuOptions.js","../src/MenuTrigger.js","../src/renderers/ContextMenu.js","../src/Menu.js","../src/MenuOption.js","../src/renderers/NotAnimatedContextMenu.js","../src/renderers/SlideInMenu.js","../src/renderers/Popover.js","../src/index.js"],"sourcesContent":["// platform select polyfil for older RN versions\nimport { Platform } from 'react-native';\n\nif (!Platform.select) {\n Platform.select = (obj) => obj[Platform.OS];\n}\n","import React from 'react';\nimport { Platform, TouchableHighlight, TouchableNativeFeedback } from 'react-native';\n\n/**\n * Promisifies measure's callback function and returns layout object.\n */\nexport const measure = ref => new Promise((resolve) => {\n ref.measure((x, y, width, height, pageX, pageY) => {\n resolve({\n x: pageX, y: pageY,\n width, height,\n })\n });\n});\n\n/**\n * Create unique menu name across all menu instances.\n */\nexport const makeName = (function() {\n let nextID = 1;\n return () => `menu-${nextID++}`;\n})();\n\n/**\n * Create touchable component based on passed parameter and platform.\n * It also returns default props for specific touchable types.\n */\nexport function makeTouchable(TouchableComponent) {\n const Touchable = TouchableComponent || Platform.select({\n android: TouchableNativeFeedback,\n ios: TouchableHighlight,\n default: TouchableHighlight,\n });\n let defaultTouchableProps = {};\n if (Touchable === TouchableHighlight) {\n defaultTouchableProps = { underlayColor: 'rgba(0, 0, 0, 0.1)' };\n }\n return { Touchable, defaultTouchableProps };\n}\n\nfunction includes(arr, value) {\n return arr.indexOf(value) > -1;\n}\n\n/**\nLog object - prepares object for logging by stripping all \"private\" or excluding fields\n*/\nexport function lo(object, ...excluding) {\n const exc = Array.from(excluding);\n function isObject(obj) {\n return obj === Object(obj);\n }\n function withoutPrivate(obj) {\n if (!isObject(obj)) return obj;\n const res = {};\n for (var property in obj) {\n if (obj.hasOwnProperty(property)) {\n if (!property.startsWith('_') && !includes(exc, property)) {\n res[property] = withoutPrivate(obj[property]);\n }\n }\n }\n return res;\n }\n return withoutPrivate(object);\n}\n\n/**\nConverts iterator to array\n*/\nexport function iterator2array(it) {\n // workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127\n const arr = [];\n for (let next = it.next(); !next.done; next = it.next()) {\n arr.push(next.value);\n }\n return arr;\n}\n\n/**\n * Higher order component to deprecate usage of component.\n * message - deprecate warning message\n * methods - array of method names to be delegated to deprecated component\n */\nexport function deprecatedComponent(message, methods = []) {\n return function deprecatedComponentHOC(Component) {\n return class DeprecatedComponent extends React.Component {\n constructor(...args) {\n super(...args);\n methods.forEach(name => {\n // delegate methods to the component\n this[name] = (...args) => this.ref && this.ref[name](...args)\n });\n }\n\n render() {\n return \n }\n\n onRef = ref => this.ref = ref;\n\n componentDidMount() {\n console.warn(message);\n }\n }\n }\n}\n","/** @license React v16.8.3\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\n\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' ||\n // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);\n}\n\n/**\n * Forked from fbjs/warning:\n * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js\n *\n * Only change is we use console.warn instead of console.error,\n * and do nothing when 'console' is not supported.\n * This really simplifies the code.\n * ---\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar lowPriorityWarning = function () {};\n\n{\n var printWarning = function (format) {\n for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n var argIndex = 0;\n var message = 'Warning: ' + format.replace(/%s/g, function () {\n return args[argIndex++];\n });\n if (typeof console !== 'undefined') {\n console.warn(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n\n lowPriorityWarning = function (condition, format) {\n if (format === undefined) {\n throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');\n }\n if (!condition) {\n for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n args[_key2 - 2] = arguments[_key2];\n }\n\n printWarning.apply(undefined, [format].concat(args));\n }\n };\n}\n\nvar lowPriorityWarning$1 = lowPriorityWarning;\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n default:\n return $$typeof;\n }\n }\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n}\n\n// AsyncMode is deprecated along with isAsyncMode\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\n\nvar hasWarnedAboutDeprecatedIsAsyncMode = false;\n\n// AsyncMode should be deprecated\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true;\n lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.typeOf = typeOf;\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isValidElementType = isValidElementType;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n var loggedTypeFailures = {};\n var has = Function.call.bind(Object.prototype.hasOwnProperty);\n\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\n/**\n * Assert that the values match with the type specs.\n * Error messages are memorized and will only be shown once.\n *\n * @param {object} typeSpecs Map of name to a ReactPropType\n * @param {object} values Runtime values that need to be type-checked\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @param {string} componentName Name of the component for error messages.\n * @param {?Function} getStack Returns the component stack.\n * @private\n */\nfunction checkPropTypes(typeSpecs, values, location, componentName, getStack) {\n if (process.env.NODE_ENV !== 'production') {\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error;\n // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error(\n (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'\n );\n err.name = 'Invariant Violation';\n throw err;\n }\n error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);\n } catch (ex) {\n error = ex;\n }\n if (error && !(error instanceof Error)) {\n printWarning(\n (componentName || 'React class') + ': type specification of ' +\n location + ' `' + typeSpecName + '` is invalid; the type checker ' +\n 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +\n 'You may have forgotten to pass an argument to the type checker ' +\n 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +\n 'shape all require an argument).'\n );\n }\n if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error.message] = true;\n\n var stack = getStack ? getStack() : '';\n\n printWarning(\n 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')\n );\n }\n }\n }\n }\n}\n\n/**\n * Resets warning cache when testing.\n *\n * @private\n */\ncheckPropTypes.resetWarningCache = function() {\n if (process.env.NODE_ENV !== 'production') {\n loggedTypeFailures = {};\n }\n}\n\nmodule.exports = checkPropTypes;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactIs = require('react-is');\nvar assign = require('object-assign');\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\nvar checkPropTypes = require('./checkPropTypes');\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (process.env.NODE_ENV !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (process.env.NODE_ENV !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","import React from \"react\";\n\nexport function withContext(Context, propName = \"context\") {\n return function wrap(Component) {\n class EnhanceContext extends React.Component {\n render() {\n const { forwardedRef, ...rest } = this.props;\n\n return (\n \n {value => {\n const custom = {\n [propName]: value,\n ref: forwardedRef,\n };\n return ;\n }}\n \n );\n }\n }\n\n const name = Component.displayName || Component.name || \"Component\";\n const consumerName =\n Context.Consumer.displayName ||\n Context.Consumer.name ||\n \"Context.Consumer\";\n\n function enhanceForwardRef(props, ref) {\n return ;\n }\n\n enhanceForwardRef.displayName = `enhanceContext-${consumerName}(${name})`;\n\n const FC = React.forwardRef(enhanceForwardRef);\n FC.defaultProps = Component.defaultProps;\n FC.propTypes = Component.propTypes;\n return FC\n };\n}\n","import { iterator2array } from './helpers';\n\n/**\n * Registry to subscribe, unsubscribe and update data of menus.\n *\n * menu data: {\n * instance: react instance\n * triggerLayout: Object - layout of menu trigger if known\n * optionsLayout: Object - layout of menu options if known\n * optionsCustomStyles: Object - custom styles of options\n * }\n*/\nexport default function makeMenuRegistry(menus = new Map()) {\n\n /**\n * Subscribes menu instance.\n */\n function subscribe(instance) {\n const name = instance.getName()\n if (menus.get(name)) {\n console.warn(`incorrect usage of popup menu - menu with name ${name} already exists`);\n }\n menus.set(name, { name, instance });\n }\n\n /**\n * Unsubscribes menu instance.\n */\n function unsubscribe(instance) {\n menus.delete(instance.getName());\n }\n\n /**\n * Updates layout infomration.\n */\n function updateLayoutInfo(name, layouts = {}) {\n if (!menus.has(name)) {\n return;\n }\n const menu = Object.assign({}, menus.get(name));\n if (layouts.hasOwnProperty('triggerLayout')) {\n menu.triggerLayout = layouts.triggerLayout;\n }\n if (layouts.hasOwnProperty('optionsLayout')) {\n menu.optionsLayout = layouts.optionsLayout;\n }\n menus.set(name, menu);\n }\n\n function setOptionsCustomStyles(name, optionsCustomStyles) {\n if (!menus.has(name)) {\n return;\n }\n const menu = { ...menus.get(name), optionsCustomStyles };\n menus.set(name, menu);\n }\n\n /**\n * Get `menu data` by name.\n */\n function getMenu(name) {\n return menus.get(name);\n }\n\n /**\n * Returns all subscribed menus as array of `menu data`\n */\n function getAll() {\n return iterator2array(menus.values());\n }\n\n return { subscribe, unsubscribe, updateLayoutInfo, getMenu, getAll, setOptionsCustomStyles };\n}\n","// common durations of animation\nexport const OPEN_ANIM_DURATION = 225;\nexport const CLOSE_ANIM_DURATION = 195;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { View, StyleSheet, TouchableWithoutFeedback, Animated } from 'react-native';\nimport { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from './constants';\n\nclass Backdrop extends Component {\n\n constructor(...args) {\n super(...args);\n this.fadeAnim = new Animated.Value(0.001);\n }\n\n open() {\n return new Promise(resolve => {\n Animated.timing(this.fadeAnim, {\n duration: OPEN_ANIM_DURATION,\n toValue: 1,\n useNativeDriver: true,\n }).start(resolve);\n });\n }\n\n close() {\n return new Promise(resolve => {\n Animated.timing(this.fadeAnim, {\n duration: CLOSE_ANIM_DURATION,\n toValue: 0,\n useNativeDriver: true,\n }).start(resolve);\n });\n }\n\n render() {\n const { onPress, style } = this.props;\n return (\n \n \n \n \n \n );\n }\n\n}\n\nBackdrop.propTypes = {\n onPress: PropTypes.func.isRequired,\n};\n\nconst styles = StyleSheet.create({\n fullscreen: {\n opacity: 0,\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n },\n});\n\nexport default Backdrop;\n","\nexport const CFG = {\n debug: false,\n}\n/**\n * Debug logger depending on `Menu.debug` static porperty.\n */\nexport const debug = (...args) => {\n CFG.debug && console.log('react-native-popup-menu', ...args);\n};\n","import React, { Component } from 'react';\nimport { View, StyleSheet } from 'react-native';\nimport Backdrop from './Backdrop';\nimport { debug } from './logger.js';\n\nexport default class MenuPlaceholder extends Component {\n constructor(props) {\n super(props)\n this.state = {};\n }\n\n shouldComponentUpdate() {\n // don't terminate closing animation\n return !this.props.ctx._isMenuClosing;\n }\n\n render() {\n const { ctx, backdropStyles } = this.props;\n const shouldRenderMenu = ctx.isMenuOpen() && ctx._isInitialized();\n debug('MenuPlaceholder should render', shouldRenderMenu);\n if (!shouldRenderMenu) {\n return null;\n }\n return (\n \n \n {\n ctx._makeOptions()\n }\n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n placeholder: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n overflow: 'hidden',\n },\n});\n","import React from 'react';\nimport { View, StyleSheet } from 'react-native';\n\nexport const computePosition = ({ windowLayout }) => ({\n top: windowLayout.height,\n left: windowLayout.width,\n});\n\n\nconst MenuOutside = props => {\n const { style, children, layouts, ...other } = props;\n const position = computePosition(layouts);\n return (\n \n {children}\n \n );\n};\n\nconst styles = StyleSheet.create({\n options: {\n position: 'absolute',\n },\n});\n\nexport default MenuOutside;\n","import React, { Component, createContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { View, BackHandler, SafeAreaView, StyleSheet } from 'react-native';\n\nimport { withContext } from './with-context';\nimport makeMenuRegistry from './menuRegistry';\nimport MenuPlaceholder from './MenuPlaceholder';\nimport { measure } from './helpers';\nimport { debug } from './logger.js';\nimport MenuOutside from './renderers/MenuOutside';\n\nconst defaultOptionsContainerRenderer = options => options;\nconst layoutsEqual = (a, b) => (\n a === b || (a && b && a.width === b.width && a.height === b.height)\n);\n\nconst isFunctional = Component => !Component.prototype.render;\n\nif (!React.forwardRef) {\n throw new Error('This version of popup-menu requires RN 0.55+. Check our compatibility table.')\n}\nexport const PopupMenuContext = createContext({})\nexport const withCtx = withContext(PopupMenuContext, \"ctx\");\n\n// count of MenuProvider instances\nlet instanceCount = 0;\n\nexport default class MenuProvider extends Component {\n\n constructor(props) {\n super(props);\n this._menuRegistry = makeMenuRegistry();\n this._isMenuClosing = false;\n const menuActions = {\n openMenu: name => this.openMenu(name),\n closeMenu: () => this.closeMenu(),\n toggleMenu: name => this.toggleMenu(name),\n isMenuOpen: () => this.isMenuOpen(),\n _getOpenedMenu: () => this._getOpenedMenu(),\n _notify: force => this._notify(force),\n };\n this.menuCtx = { menuRegistry: this._menuRegistry, menuActions }\n }\n\n _handleBackButton = () => {\n const { backHandler } = this.props;\n debug('_handleBackButton called', backHandler);\n\n // Default handler if true is passed\n if (backHandler === true) {\n if (this.isMenuOpen()) {\n this.closeMenu();\n return true;\n }\n }\n\n // Custom handler called with MenuProvider instance id function is passed\n if (typeof backHandler === 'function') {\n return backHandler(this);\n }\n\n return false;\n }\n\n componentDidMount() {\n if (BackHandler) {\n BackHandler.addEventListener('hardwareBackPress', this._handleBackButton);\n } else {\n const { backHandler } = this.props;\n if (backHandler === true || typeof backHandler === 'function') {\n console.warn('backHandler prop cannot be used if BackHandler is not present (RN >= 0.44 required)');\n }\n }\n const { customStyles, skipInstanceCheck } = this.props;\n if (customStyles.menuContextWrapper) {\n console.warn('menuContextWrapper custom style is deprecated and it might be removed in future releases, use menuProviderWrapper instead.');\n }\n if (!skipInstanceCheck) {\n instanceCount++;\n }\n if (instanceCount > 1) {\n console.warn('In most cases you should not have more MenuProviders in your app (see API documentation). In other cases use skipInstanceCheck prop.');\n }\n }\n\n componentWillUnmount() {\n debug('unmounting menu provider')\n if (BackHandler) {\n BackHandler.removeEventListener('hardwareBackPress', this._handleBackButton);\n }\n const { skipInstanceCheck } = this.props;\n if (!skipInstanceCheck) {\n instanceCount--;\n }\n }\n\n isMenuOpen() {\n return !!this._getOpenedMenu();\n }\n\n openMenu(name) {\n const menu = this._menuRegistry.getMenu(name);\n if (!menu) {\n console.warn(`menu with name ${name} does not exist`);\n return Promise.resolve();\n }\n debug('open menu', name);\n menu.instance._setOpened(true);\n return this._notify();\n }\n\n closeMenu() { // has no effect on controlled menus\n debug('close menu');\n this._menuRegistry.getAll()\n .filter(menu => menu.instance._getOpened())\n .forEach(menu => menu.instance._setOpened(false));\n return this._notify();\n }\n\n _invalidateTriggerLayouts() {\n // invalidate layouts for closed menus,\n // both controlled and uncontrolled menus\n this._menuRegistry.getAll()\n .filter(menu => !menu.instance._isOpen())\n .forEach(menu => {\n this._menuRegistry.updateLayoutInfo(menu.name, { triggerLayout: undefined });\n });\n }\n\n _beforeClose(menu) {\n debug('before close', menu.name);\n const hideMenu = (this.optionsRef\n && this.optionsRef.close\n && this.optionsRef.close()) || Promise.resolve();\n const hideBackdrop = this.backdropRef && this.backdropRef.close();\n this._invalidateTriggerLayouts();\n this._isMenuClosing = true;\n return Promise.all([hideMenu, hideBackdrop])\n .then(() => {\n this._isMenuClosing = false;\n })\n .catch(err => {\n this._isMenuClosing = false;\n throw err;\n })\n }\n\n toggleMenu(name) {\n const menu = this._menuRegistry.getMenu(name);\n if (!menu) {\n console.warn(`menu with name ${name} does not exist`);\n return Promise.resolve();\n }\n debug('toggle menu', name);\n if (menu.instance._getOpened()) {\n return this.closeMenu();\n } else {\n return this.openMenu(name);\n }\n }\n\n _notify(forceUpdate) {\n const NULL = {};\n const prev = this.openedMenu || NULL;\n const next = this._menuRegistry.getAll().find(menu => menu.instance._isOpen()) || NULL;\n // set newly opened menu before any callbacks are called\n this.openedMenu = next === NULL ? undefined : next;\n if (!forceUpdate && !this._isRenderNeeded(prev, next)) {\n return Promise.resolve();\n }\n debug('notify: next menu:', next.name, ' prev menu:', prev.name);\n let afterSetState = undefined;\n let beforeSetState = () => Promise.resolve();\n if (prev.name !== next.name) {\n if (prev !== NULL && !prev.instance._isOpen()) {\n beforeSetState = () => this._beforeClose(prev)\n .then(() => prev.instance.props.onClose());\n }\n if (next !== NULL) {\n next.instance.props.onOpen();\n afterSetState = () => this._initOpen(next);\n }\n }\n return beforeSetState().then(() => {\n if (!this._placeholderRef) {\n debug('setState ignored - maybe the context was unmounted')\n return\n }\n this._placeholderRef.setState({ openedMenuName: this.openedMenu && this.openedMenu.name }, afterSetState);\n debug('notify ended');\n });\n }\n\n /**\n Compares states of opened menu to determine if rerender is needed.\n */\n _isRenderNeeded(prev, next) {\n if (prev === next) {\n debug('_isRenderNeeded: skipping - no change');\n return false;\n }\n if (prev.name !== next.name) {\n return true;\n }\n const { triggerLayout, optionsLayout } = next;\n if (!triggerLayout || !optionsLayout) {\n debug('_isRenderNeeded: skipping - no trigger or options layout');\n return false;\n }\n return true;\n }\n\n render() {\n const { style, customStyles } = this.props;\n debug('render menu', this.isMenuOpen(), this._ownLayout);\n return (\n \n \n \n { this.props.children }\n \n \n \n \n \n \n \n );\n }\n\n onBackdropRef = r => {\n this.backdropRef = r;\n }\n\n onOptionsRef = r => {\n this.optionsRef = r;\n }\n\n _onPlaceholderRef = r => this._placeholderRef = r;\n\n _getOpenedMenu() {\n const name = this._placeholderRef && this._placeholderRef.state.openedMenuName;\n const menu = name ? this._menuRegistry.getMenu(name) : undefined;\n debug('_getOpenedMenu', name, !!menu)\n return menu\n }\n\n _onBackdropPress = () => {\n debug('on backdrop press');\n const menu = this._getOpenedMenu();\n if (menu) {\n menu.instance.props.onBackdropPress();\n }\n this.closeMenu();\n }\n\n _isInitialized() {\n return !!this._ownLayout;\n }\n\n _initOpen(menu) {\n debug('opening', menu.name);\n const trigger = menu.instance._getTrigger();\n measure(trigger).then(triggerLayout => {\n debug('got trigger measurements', triggerLayout);\n this._menuRegistry.updateLayoutInfo(menu.name, { triggerLayout });\n this.backdropRef && this.backdropRef.open()\n this._notify();\n });\n }\n\n _onOptionsLayout(e, name, isOutside) {\n const optionsLayout = e.nativeEvent.layout;\n optionsLayout.isOutside = isOutside;\n debug('got options layout', optionsLayout);\n this._menuRegistry.updateLayoutInfo(name, { optionsLayout });\n this._notify();\n }\n\n _makeOptions() {\n const { instance, triggerLayout, optionsLayout } = this._getOpenedMenu();\n const options = instance._getOptions();\n const { renderer, rendererProps } = instance.props;\n const windowLayout = this._ownLayout;\n const safeAreaLayout = this._safeAreaLayout;\n const { optionsContainerStyle, renderOptionsContainer, customStyles } = options.props;\n const optionsRenderer = renderOptionsContainer || defaultOptionsContainerRenderer;\n const isOutside = !triggerLayout || !optionsLayout;\n const onLayout = e => this._onOptionsLayout(e, instance.getName(), isOutside);\n const style = [optionsContainerStyle, customStyles.optionsContainer];\n const layouts = { windowLayout, triggerLayout, optionsLayout, safeAreaLayout };\n const props = { ...rendererProps, style, onLayout, layouts };\n const optionsType = isOutside ? MenuOutside : renderer;\n if (!isFunctional(optionsType)) {\n props.ref = this.onOptionsRef;\n }\n return React.createElement(optionsType, props, optionsRenderer(options));\n }\n\n _onLayout = ({ nativeEvent: { layout } }) => {\n if (layoutsEqual(this._ownLayout, layout)) {\n return;\n }\n this._ownLayout = layout;\n debug('context layout has changed', this._ownLayout);\n if (!this.isMenuOpen()) {\n return;\n }\n const { instance } = this._getOpenedMenu();\n const trigger = instance._getTrigger();\n measure(trigger).then(triggerLayout => {\n debug('got trigger measurements after context layout change', triggerLayout);\n this._menuRegistry.updateLayoutInfo(instance.getName(), { triggerLayout });\n // force update as own layout has changed\n this._notify(true);\n });\n }\n\n _onSafeAreaLayout = ({ nativeEvent: { layout } }) => {\n if (layoutsEqual(this._safeAreaLayout, layout)) {\n return;\n }\n this._safeAreaLayout = layout;\n debug('safeArea layout has changed', this._safeAreaLayout);\n if (!this.isMenuOpen()) {\n return;\n }\n this._notify(true);\n }\n\n}\n\nMenuProvider.propTypes = {\n customStyles: PropTypes.object,\n backHandler: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),\n skipInstanceCheck: PropTypes.bool,\n}\n\nMenuProvider.defaultProps = {\n customStyles: {},\n backHandler: false,\n skipInstanceCheck: false,\n};\n\nconst styles = StyleSheet.create({\n flex1: {\n flex: 1,\n },\n safeArea: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { View } from 'react-native';\nimport { withCtx } from './MenuProvider';\n\nexport class MenuOptions extends React.Component {\n\n updateCustomStyles(_props) {\n const { customStyles } = _props\n const menu = this.props.ctx.menuActions._getOpenedMenu()\n // FIXME react 16.3 workaround for ControlledExample!\n if (!menu) return\n const menuName = menu.instance.getName()\n this.props.ctx.menuRegistry.setOptionsCustomStyles(menuName, customStyles)\n }\n\n componentDidMount() {\n this.updateCustomStyles(this.props)\n }\n\n componentDidUpdate() {\n this.updateCustomStyles(this.props)\n }\n\n render() {\n const { customStyles, style, children } = this.props\n return (\n \n {children}\n \n )\n }\n}\n\nMenuOptions.propTypes = {\n customStyles: PropTypes.object,\n renderOptionsContainer: PropTypes.func,\n optionsContainerStyle: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array,\n ]),\n};\n\nMenuOptions.defaultProps = {\n customStyles: {},\n};\n\nexport default withCtx(MenuOptions);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { View, Text } from 'react-native';\nimport { debug } from './logger.js';\nimport { makeTouchable } from './helpers';\nimport { withCtx } from './MenuProvider';\n\nexport class MenuTrigger extends Component {\n\n _onPress() {\n debug('trigger onPress');\n this.props.onPress && this.props.onPress();\n this.props.ctx.menuActions.openMenu(this.props.menuName);\n }\n\n render() {\n const { disabled, onRef, text, children, style, customStyles, menuName, triggerOnLongPress, ...other } = this.props;\n const onPress = () => !disabled && this._onPress();\n const { Touchable, defaultTouchableProps } = makeTouchable(customStyles.TriggerTouchableComponent);\n return (\n \n \n \n {text ? {text} : children}\n \n \n \n );\n }\n\n}\n\nMenuTrigger.propTypes = {\n disabled: PropTypes.bool,\n text: PropTypes.string,\n onPress: PropTypes.func,\n customStyles: PropTypes.object,\n triggerOnLongPress: PropTypes.bool,\n};\n\nMenuTrigger.defaultProps = {\n disabled: false,\n customStyles: {},\n};\n\nexport default withCtx(MenuTrigger)\n","import React from 'react';\nimport { I18nManager, Animated, Easing, StyleSheet, PixelRatio } from 'react-native';\nimport { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from '../constants';\n\nconst axisPosition = (oDim, wDim, tPos, tDim) => {\n // if options are bigger than window dimension, then render at 0\n if (oDim > wDim) {\n return 0;\n }\n // render at trigger position if possible\n if (tPos + oDim <= wDim) {\n return tPos;\n }\n // aligned to the trigger from the bottom (right)\n if (tPos + tDim - oDim >= 0) {\n return tPos + tDim - oDim;\n }\n // compute center position\n let pos = Math.round(tPos + (tDim / 2) - (oDim / 2));\n // check top boundary\n if (pos < 0) {\n return 0;\n }\n // check bottom boundary\n if (pos + oDim > wDim) {\n return wDim - oDim;\n }\n // if everything ok, render in center position\n return pos;\n};\n\nfunction fit(pos, len, minPos, maxPos) {\n if (pos === undefined) {\n return undefined;\n }\n if (pos + len > maxPos) {\n pos = maxPos - len;\n }\n if (pos < minPos) {\n pos = minPos;\n }\n return pos;\n}\n// fits options (position) into safeArea\nexport const fitPositionIntoSafeArea = (position, layouts) => {\n const { windowLayout, safeAreaLayout, optionsLayout } = layouts;\n if (!safeAreaLayout) {\n return position;\n }\n const { x: saX, y: saY, height: saHeight, width: saWidth } = safeAreaLayout;\n const { height: oHeight, width: oWidth } = optionsLayout;\n const { width: wWidth } = windowLayout;\n let { top, left, right } = position;\n top = fit(top, oHeight, saY, saY + saHeight);\n left = fit(left, oWidth, saX, saX + saWidth)\n right = fit(right, oWidth, wWidth - saX - saWidth, saX)\n return { top, left, right };\n}\n\nexport const computePosition = (layouts, isRTL) => {\n const { windowLayout, triggerLayout, optionsLayout } = layouts;\n const { x: wX, y: wY, width: wWidth, height: wHeight } = windowLayout;\n const { x: tX, y: tY, height: tHeight, width: tWidth } = triggerLayout;\n const { height: oHeight, width: oWidth } = optionsLayout;\n const top = axisPosition(oHeight, wHeight, tY - wY, tHeight);\n const left = axisPosition(oWidth, wWidth, tX - wX, tWidth);\n const start = isRTL ? 'right' : 'left';\n const position = { top, [start]: left };\n return fitPositionIntoSafeArea(position, layouts);\n};\n\nexport default class ContextMenu extends React.Component {\n\n constructor(props) {\n super(props);\n this.state = {\n scaleAnim: new Animated.Value(0.1),\n };\n }\n\n componentDidMount() {\n Animated.timing(this.state.scaleAnim, {\n duration: OPEN_ANIM_DURATION,\n toValue: 1,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }\n\n close() {\n return new Promise(resolve => {\n Animated.timing(this.state.scaleAnim, {\n duration: CLOSE_ANIM_DURATION,\n toValue: 0,\n easing: Easing.in(Easing.cubic),\n useNativeDriver: true,\n }).start(resolve);\n });\n }\n\n render() {\n const { style, children, layouts, ...other } = this.props;\n const animation = {\n transform: [ { scale: this.state.scaleAnim } ],\n opacity: this.state.scaleAnim,\n };\n const position = computePosition(layouts, I18nManager.isRTL);\n return (\n \n {children}\n \n );\n }\n\n}\n\n// public exports\nContextMenu.computePosition = computePosition;\nContextMenu.fitPositionIntoSafeArea = fitPositionIntoSafeArea;\n\nexport const styles = StyleSheet.create({\n options: {\n position: 'absolute',\n borderRadius: 2,\n backgroundColor: 'white',\n width: PixelRatio.roundToNearestPixel(200),\n\n // Shadow only works on iOS.\n shadowColor: 'black',\n shadowOpacity: 0.3,\n shadowOffset: { width: 3, height: 3 },\n shadowRadius: 4,\n\n // This will elevate the view on Android, causing shadow to be drawn.\n elevation: 5,\n },\n});\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { View } from 'react-native';\nimport MenuOptions from './MenuOptions';\nimport MenuTrigger from './MenuTrigger';\nimport ContextMenu from './renderers/ContextMenu';\nimport { makeName } from './helpers';\nimport { debug, CFG } from './logger';\nimport { withCtx } from './MenuProvider';\n\nconst isRegularComponent = c => c.type !== MenuOptions && c.type !== MenuTrigger;\nconst isTrigger = c => c.type === MenuTrigger;\nconst isMenuOptions = c => c.type === MenuOptions;\n\nexport class Menu extends Component {\n\n constructor(props) {\n super(props);\n this._name = this.props.name || makeName();\n this._forceClose = false;\n const { ctx } = props;\n if(!(ctx && ctx.menuActions)) {\n throw new Error(\"Menu component must be ancestor of MenuProvider\");\n }\n }\n\n componentDidMount() {\n if (!this._validateChildren()) {\n return;\n }\n debug('subscribing menu', this._name);\n this.props.ctx.menuRegistry.subscribe(this);\n this.props.ctx.menuActions._notify();\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.name !== prevProps.name) {\n console.warn('Menu name cannot be changed');\n }\n // force update if menu is opened as its content might have changed\n const force = this._isOpen();\n debug('component did update', this._name, force);\n this.props.ctx.menuActions._notify(force);\n }\n\n componentWillUnmount() {\n debug('unsubscribing menu', this._name);\n if (this._isOpen()) {\n this._forceClose = true;\n this.props.ctx.menuActions._notify();\n }\n this.props.ctx.menuRegistry.unsubscribe(this);\n }\n\n open() {\n return this.props.ctx.menuActions.openMenu(this._name);\n }\n\n close() {\n return this.props.ctx.menuActions.closeMenu();\n }\n\n getName() {\n return this._name;\n }\n\n render() {\n const { style } = this.props;\n const children = this._reduceChildren();\n return (\n \n {children}\n \n );\n }\n\n _reduceChildren() {\n return React.Children.toArray(this.props.children).reduce((r, child) => {\n if (isTrigger(child)) {\n r.push(React.cloneElement(child, {\n key: null,\n menuName: this._name,\n onRef: (t => this._trigger = t),\n }));\n }\n if (isRegularComponent(child)) {\n r.push(child);\n }\n return r;\n }, []);\n }\n\n _isOpen() {\n if (this._forceClose) {\n return false;\n }\n return this.props.hasOwnProperty('opened') ? this.props.opened : this._opened;\n }\n\n _getTrigger() {\n return this._trigger;\n }\n\n _getOptions() {\n return React.Children.toArray(this.props.children).find(isMenuOptions);\n }\n\n _getOpened() {\n return this._opened;\n }\n\n _setOpened(opened) {\n this._opened = opened;\n }\n\n _validateChildren() {\n const children = React.Children.toArray(this.props.children);\n const options = children.find(isMenuOptions);\n if (!options) {\n console.warn('Menu has to contain MenuOptions component');\n }\n const trigger = children.find(isTrigger);\n if (!trigger) {\n console.warn('Menu has to contain MenuTrigger component');\n }\n return options && trigger;\n }\n\n}\n\nMenu.propTypes = {\n name: PropTypes.string,\n renderer: PropTypes.func,\n rendererProps: PropTypes.object,\n onSelect: PropTypes.func,\n onOpen: PropTypes.func,\n onClose: PropTypes.func,\n opened: PropTypes.bool,\n onBackdropPress: PropTypes.func,\n};\n\nMenu.defaultProps = {\n renderer: ContextMenu,\n rendererProps: {},\n onSelect: () => {},\n onOpen: () => {},\n onClose: () => {},\n onBackdropPress: () => {},\n};\n\nconst MenuExternal = withCtx(Menu);\nObject.defineProperty(MenuExternal, 'debug', \n { \n get: function() { return CFG.debug }, \n set: function(val) { CFG.debug = val }, \n });\nMenuExternal.setDefaultRenderer = (renderer) => {\n Menu.defaultProps.renderer = renderer;\n}\nMenuExternal.setDefaultRendererProps = (rendererProps) => {\n Menu.defaultProps.rendererProps = rendererProps;\n}\nexport default MenuExternal;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { View, StyleSheet, Text } from 'react-native';\nimport { debug } from './logger';\nimport { makeTouchable } from './helpers';\nimport { withCtx } from './MenuProvider';\n\n\nexport class MenuOption extends Component {\n\n _onSelect() {\n const { value } = this.props;\n const onSelect = this.props.onSelect || this._getMenusOnSelect()\n const shouldClose = onSelect(value) !== false;\n debug('select option', value, shouldClose);\n if (shouldClose) {\n this.props.ctx.menuActions.closeMenu();\n }\n }\n\n _getMenusOnSelect() {\n const menu = this.props.ctx.menuActions._getOpenedMenu();\n return menu.instance.props.onSelect;\n }\n\n _getCustomStyles() {\n // FIXME react 16.3 workaround for ControlledExample!\n const menu = this.props.ctx.menuActions._getOpenedMenu() || {}\n const { optionsCustomStyles } = menu;\n return {\n ...optionsCustomStyles,\n ...this.props.customStyles,\n }\n }\n\n render() {\n const { text, disabled, disableTouchable, children, style } = this.props;\n const customStyles = this._getCustomStyles()\n if (text && React.Children.count(children) > 0) {\n console.warn(\"MenuOption: Please don't use text property together with explicit children. Children are ignored.\");\n }\n if (disabled) {\n const disabledStyles = [defaultStyles.optionTextDisabled, customStyles.optionText];\n return (\n \n {text ? {text} : children}\n \n );\n }\n const rendered = (\n \n {text ? {text} : children}\n \n );\n if (disableTouchable) {\n return rendered;\n }\n else {\n const { Touchable, defaultTouchableProps } = makeTouchable(customStyles.OptionTouchableComponent);\n return (\n this._onSelect()}\n {...defaultTouchableProps}\n {...customStyles.optionTouchable}\n >\n {rendered}\n \n );\n }\n }\n}\n\nMenuOption.propTypes = {\n disabled: PropTypes.bool,\n disableTouchable: PropTypes.bool,\n onSelect: PropTypes.func,\n text: PropTypes.string,\n value: PropTypes.any,\n customStyles: PropTypes.object,\n};\n\nMenuOption.defaultProps = {\n disabled: false,\n disableTouchable: false,\n customStyles: {},\n};\n\nconst defaultStyles = StyleSheet.create({\n option: {\n padding: 5,\n backgroundColor: 'transparent',\n },\n optionTextDisabled: {\n color: '#ccc',\n },\n});\n\nexport default withCtx(MenuOption);\n","import React from 'react';\nimport { View } from 'react-native';\n\nimport { computePosition, styles } from './ContextMenu';\n\n/**\nSimplified version of ContextMenu without animation.\n*/\nexport default class NotAnimatedContextMenu extends React.Component {\n\n render() {\n const { style, children, layouts, ...other } = this.props;\n const position = computePosition(layouts);\n return (\n \n {children}\n \n );\n }\n\n}\n","import React from 'react';\nimport { Animated, StyleSheet, Easing } from 'react-native';\nimport { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from '../constants';\n\nexport const computePosition = (layouts) => {\n const { windowLayout, optionsLayout } = layouts\n const { height: wHeight } = windowLayout;\n const { height: oHeight } = optionsLayout;\n const top = wHeight - oHeight;\n const left = 0, right = 0;\n const position = { top, left, right };\n // TODO what is the best way to handle safeArea?\n // most likely some extra paddings inside SlideInMenu \n return position;\n}\n\nexport default class SlideInMenu extends React.Component {\n\n constructor(props) {\n super(props);\n this.state = {\n slide: new Animated.Value(0),\n };\n }\n\n componentDidMount() {\n Animated.timing(this.state.slide, {\n duration: OPEN_ANIM_DURATION,\n toValue: 1,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }\n\n close() {\n return new Promise(resolve => {\n Animated.timing(this.state.slide, {\n duration: CLOSE_ANIM_DURATION,\n toValue: 0,\n easing: Easing.in(Easing.cubic),\n useNativeDriver: true,\n }).start(resolve);\n });\n }\n\n render() {\n const { style, children, layouts, ...other } = this.props;\n const { height: oHeight } = layouts.optionsLayout;\n const animation = {\n transform: [{\n translateY: this.state.slide.interpolate({\n inputRange: [0, 1],\n outputRange: [oHeight, 0],\n }),\n }],\n };\n const position = computePosition(layouts);\n return (\n \n {children}\n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n options: {\n position: 'absolute',\n backgroundColor: 'white',\n\n // Shadow only works on iOS.\n shadowColor: 'black',\n shadowOpacity: 0.3,\n shadowOffset: { width: 3, height: 3 },\n shadowRadius: 4,\n\n // This will elevate the view on Android, causing shadow to be drawn.\n elevation: 5,\n },\n});\n","import { I18nManager, Animated, Easing, StyleSheet, View } from 'react-native';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from '../constants.js';\n\nconst popoverPadding = 7;\nconst anchorSize = 15;\nconst anchorHyp = Math.sqrt(anchorSize*anchorSize + anchorSize*anchorSize);\nconst anchorOffset = (anchorHyp + anchorSize) / 2 - popoverPadding;\n\n// left/top placement\nfunction axisNegativeSideProperties({ oDim, tPos }) {\n return { position: tPos - oDim };\n}\n\n// right/bottom placement\nfunction axisPositiveSideProperties({ tPos, tDim }) {\n // substract also anchor placeholder from the beginning\n return { position: tPos + tDim - anchorSize };\n}\n\n// computes offsets (off screen overlap) of popover when trying to align it to the center\nfunction centeringProperties({ oDim, wDim, tPos, tDim }) {\n const center = Math.round(tPos + (tDim / 2));\n const leftOffset = (oDim / 2) - center;\n const rightOffset = center + (oDim / 2) - wDim;\n return { center, leftOffset, rightOffset };\n}\n\n/**\n * Computes position and offset of popover when trying to align it to the triger center.\n * It consideres window boundaries.\n * Returns object with keys:\n * - position: Absolute position - top/left,\n * - offset: window overlapping size if window boundaries were not considered\n */\nfunction axisCenteredPositionProperties(options) {\n const { oDim, wDim } = options;\n const { center, leftOffset, rightOffset } = centeringProperties(options);\n if (leftOffset > 0 || rightOffset > 0) {\n // right/bottom position is better\n if (leftOffset < rightOffset) {\n return { offset: rightOffset, position: wDim - oDim };\n }\n // left/top position is better\n if (rightOffset < leftOffset) {\n return { offset: -leftOffset, position: 0 };\n }\n }\n // centered position\n return { offset: 0, position: center - oDim / 2 };\n}\n\n/* Evaluate centering placement */\nfunction getCenteringPrice(options) {\n const { leftOffset, rightOffset } = centeringProperties(options);\n // TODO: currently shifted popovers have higher price,\n // popover shift could be taken into account with the same price\n return Math.max(0, leftOffset) + Math.max(0, rightOffset);\n}\n\n/* Evaluate top placement */\nfunction getTopPrice(hOptions, vOptions) {\n const centerOffset = getCenteringPrice(vOptions)\n const sideOffset = Math.max(0, hOptions.oDim - hOptions.tPos)\n return centerOffset + sideOffset\n}\n\n/* Evaluate bottom placement */\nfunction getBottomPrice(hOptions, vOptions) {\n const centerOffset = getCenteringPrice(vOptions)\n const sideOffset = Math.max(0, hOptions.tPos + hOptions.tDim + hOptions.oDim - hOptions.wDim)\n return centerOffset + sideOffset\n}\n\n/* Evaluate left placement */\nfunction getLeftPrice(hOptions, vOptions) {\n const centerOffset = getCenteringPrice(hOptions)\n const sideOffset = Math.max(0, vOptions.oDim - vOptions.tPos)\n return centerOffset + sideOffset\n}\n\n/* Evaluate right placement */\nfunction getRightPrice(hOptions, vOptions) {\n const centerOffset = getCenteringPrice(hOptions)\n const sideOffset = Math.max(0, vOptions.tPos + vOptions.tDim + vOptions.oDim - vOptions.wDim)\n return centerOffset + sideOffset\n}\n\nfunction getStartPosKey(isRTL) {\n return isRTL ? 'right' : 'left';\n}\n\nfunction topProperties(hOptions, vOptions, isRTL) {\n const centered = axisCenteredPositionProperties(vOptions);\n const side = axisNegativeSideProperties(hOptions);\n return {\n position: {\n top: side.position,\n [getStartPosKey(isRTL)]: centered.position,\n },\n offset: centered.offset,\n placement: 'top',\n };\n}\n\nfunction bottomProperties(hOptions, vOptions, isRTL) {\n const centered = axisCenteredPositionProperties(vOptions);\n const side = axisPositiveSideProperties(hOptions);\n return {\n position: {\n top: side.position,\n [getStartPosKey(isRTL)]: centered.position,\n },\n offset: centered.offset,\n placement: 'bottom',\n };\n}\n\nfunction rightProperties(hOptions, vOptions, isRTL) {\n const centered = axisCenteredPositionProperties(hOptions);\n const side = axisPositiveSideProperties(vOptions);\n return {\n position: {\n top: centered.position,\n [getStartPosKey(isRTL)]: side.position,\n },\n offset: centered.offset,\n placement: 'right',\n };\n}\n\nfunction leftProperties(hOptions, vOptions, isRTL) {\n const centered = axisCenteredPositionProperties(hOptions);\n const side = axisNegativeSideProperties(vOptions);\n return {\n position: {\n top: centered.position,\n [getStartPosKey(isRTL)]: side.position,\n },\n offset: centered.offset,\n placement: 'left',\n };\n}\n\n// maps placement to function which computes correct properties\nconst propertiesByPlacement = {\n top: topProperties,\n bottom: bottomProperties,\n left: leftProperties,\n right: rightProperties,\n};\n\n/**\n * Computes properties needed for drawing popover.\n * Returns object with keys:\n * - position: