diff --git a/build/rnpm.js b/build/rnpm.js
index 1111c2d..a85cba5 100644
--- a/build/rnpm.js
+++ b/build/rnpm.js
@@ -14,32 +14,6 @@
};
}
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
-
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- enumerableOnly && (symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- })), keys.push.apply(keys, symbols);
- }
-
- return keys;
- }
-
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
-
- return target;
- }
-
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
@@ -59,9 +33,6 @@
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
return Constructor;
}
@@ -81,7 +52,7 @@
}
function _extends() {
- _extends = Object.assign ? Object.assign.bind() : function (target) {
+ _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
@@ -94,9 +65,29 @@
return target;
};
+
return _extends.apply(this, arguments);
}
+ function _objectSpread(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+ var ownKeys = Object.keys(source);
+
+ if (typeof Object.getOwnPropertySymbols === 'function') {
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
+ }));
+ }
+
+ ownKeys.forEach(function (key) {
+ _defineProperty(target, key, source[key]);
+ });
+ }
+
+ return target;
+ }
+
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
@@ -109,38 +100,23 @@
configurable: true
}
});
- Object.defineProperty(subClass, "prototype", {
- writable: false
- });
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
- return _setPrototypeOf(o, p);
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
- if (Reflect.construct.sham) return false;
- if (typeof Proxy === "function") return true;
-
- try {
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
+ return _setPrototypeOf(o, p);
}
function _objectWithoutPropertiesLoose(source, excluded) {
@@ -190,32 +166,11 @@
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
-
- return function _createSuperInternal() {
- var Super = _getPrototypeOf(Derived),
- result;
-
- if (hasNativeReflectConstruct) {
- var NewTarget = _getPrototypeOf(this).constructor;
-
- result = Reflect.construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
-
- return _possibleConstructorReturn(this, result);
- };
- }
-
/**
* Promisifies measure's callback function and returns layout object.
*/
@@ -294,12 +249,16 @@
function deprecatedComponent(message) {
var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
return function deprecatedComponentHOC(Component) {
- return /*#__PURE__*/function (_React$Component) {
- _inherits(DeprecatedComponent, _React$Component);
+ var _temp;
- var _super = _createSuper(DeprecatedComponent);
+ return _temp =
+ /*#__PURE__*/
+ function (_React$Component) {
+ _inherits(DeprecatedComponent, _React$Component);
function DeprecatedComponent() {
+ var _getPrototypeOf2;
+
var _this;
_classCallCheck(this, DeprecatedComponent);
@@ -308,9 +267,9 @@
args[_key2] = arguments[_key2];
}
- _this = _super.call.apply(_super, [this].concat(args));
+ _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DeprecatedComponent)).call.apply(_getPrototypeOf2, [this].concat(args)));
- _defineProperty(_assertThisInitialized(_this), "onRef", function (ref) {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onRef", function (ref) {
return _this.ref = ref;
});
@@ -328,7 +287,7 @@
_createClass(DeprecatedComponent, [{
key: "render",
value: function render() {
- return /*#__PURE__*/React__default.createElement(Component, _extends({}, this.props, {
+ return React__default.createElement(Component, _extends({}, this.props, {
ref: this.onRef
}));
}
@@ -340,7 +299,7 @@
}]);
return DeprecatedComponent;
- }(React__default.Component);
+ }(React__default.Component), _temp;
};
}
@@ -348,214 +307,6 @@
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
- var reactIs_development = createCommonjsModule(function (module, exports) {
-
-
-
- {
- (function() {
-
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
- // nor polyfill, then a plain number is used for performance.
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
- // (unstable) APIs that have been removed. Can we remove the symbols?
-
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
-
- function isValidElementType(type) {
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
- }
-
- function typeOf(object) {
- if (typeof object === 'object' && object !== null) {
- var $$typeof = object.$$typeof;
-
- switch ($$typeof) {
- case REACT_ELEMENT_TYPE:
- var type = object.type;
-
- switch (type) {
- case REACT_ASYNC_MODE_TYPE:
- case REACT_CONCURRENT_MODE_TYPE:
- case REACT_FRAGMENT_TYPE:
- case REACT_PROFILER_TYPE:
- case REACT_STRICT_MODE_TYPE:
- case REACT_SUSPENSE_TYPE:
- return type;
-
- default:
- var $$typeofType = type && type.$$typeof;
-
- switch ($$typeofType) {
- case REACT_CONTEXT_TYPE:
- case REACT_FORWARD_REF_TYPE:
- case REACT_LAZY_TYPE:
- case REACT_MEMO_TYPE:
- case REACT_PROVIDER_TYPE:
- return $$typeofType;
-
- default:
- return $$typeof;
- }
-
- }
-
- case REACT_PORTAL_TYPE:
- return $$typeof;
- }
- }
-
- return undefined;
- } // AsyncMode is deprecated along with isAsyncMode
-
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
- var ContextConsumer = REACT_CONTEXT_TYPE;
- var ContextProvider = REACT_PROVIDER_TYPE;
- var Element = REACT_ELEMENT_TYPE;
- var ForwardRef = REACT_FORWARD_REF_TYPE;
- var Fragment = REACT_FRAGMENT_TYPE;
- var Lazy = REACT_LAZY_TYPE;
- var Memo = REACT_MEMO_TYPE;
- var Portal = REACT_PORTAL_TYPE;
- var Profiler = REACT_PROFILER_TYPE;
- var StrictMode = REACT_STRICT_MODE_TYPE;
- var Suspense = REACT_SUSPENSE_TYPE;
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
-
- function isAsyncMode(object) {
- {
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
-
- console['warn']('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.');
- }
- }
-
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
- }
- function isConcurrentMode(object) {
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
- }
- function isContextConsumer(object) {
- return typeOf(object) === REACT_CONTEXT_TYPE;
- }
- function isContextProvider(object) {
- return typeOf(object) === REACT_PROVIDER_TYPE;
- }
- function isElement(object) {
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
- }
- function isForwardRef(object) {
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
- }
- function isFragment(object) {
- return typeOf(object) === REACT_FRAGMENT_TYPE;
- }
- function isLazy(object) {
- return typeOf(object) === REACT_LAZY_TYPE;
- }
- function isMemo(object) {
- return typeOf(object) === REACT_MEMO_TYPE;
- }
- function isPortal(object) {
- return typeOf(object) === REACT_PORTAL_TYPE;
- }
- function isProfiler(object) {
- return typeOf(object) === REACT_PROFILER_TYPE;
- }
- function isStrictMode(object) {
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
- }
- function isSuspense(object) {
- return typeOf(object) === REACT_SUSPENSE_TYPE;
- }
-
- exports.AsyncMode = AsyncMode;
- exports.ConcurrentMode = ConcurrentMode;
- exports.ContextConsumer = ContextConsumer;
- exports.ContextProvider = ContextProvider;
- exports.Element = Element;
- exports.ForwardRef = ForwardRef;
- exports.Fragment = Fragment;
- exports.Lazy = Lazy;
- exports.Memo = Memo;
- exports.Portal = Portal;
- exports.Profiler = Profiler;
- exports.StrictMode = StrictMode;
- exports.Suspense = Suspense;
- exports.isAsyncMode = isAsyncMode;
- exports.isConcurrentMode = isConcurrentMode;
- exports.isContextConsumer = isContextConsumer;
- exports.isContextProvider = isContextProvider;
- exports.isElement = isElement;
- exports.isForwardRef = isForwardRef;
- exports.isFragment = isFragment;
- exports.isLazy = isLazy;
- exports.isMemo = isMemo;
- exports.isPortal = isPortal;
- exports.isProfiler = isProfiler;
- exports.isStrictMode = isStrictMode;
- exports.isSuspense = isSuspense;
- exports.isValidElementType = isValidElementType;
- exports.typeOf = typeOf;
- })();
- }
- });
- var reactIs_development_1 = reactIs_development.AsyncMode;
- var reactIs_development_2 = reactIs_development.ConcurrentMode;
- var reactIs_development_3 = reactIs_development.ContextConsumer;
- var reactIs_development_4 = reactIs_development.ContextProvider;
- var reactIs_development_5 = reactIs_development.Element;
- var reactIs_development_6 = reactIs_development.ForwardRef;
- var reactIs_development_7 = reactIs_development.Fragment;
- var reactIs_development_8 = reactIs_development.Lazy;
- var reactIs_development_9 = reactIs_development.Memo;
- var reactIs_development_10 = reactIs_development.Portal;
- var reactIs_development_11 = reactIs_development.Profiler;
- var reactIs_development_12 = reactIs_development.StrictMode;
- var reactIs_development_13 = reactIs_development.Suspense;
- var reactIs_development_14 = reactIs_development.isAsyncMode;
- var reactIs_development_15 = reactIs_development.isConcurrentMode;
- var reactIs_development_16 = reactIs_development.isContextConsumer;
- var reactIs_development_17 = reactIs_development.isContextProvider;
- var reactIs_development_18 = reactIs_development.isElement;
- var reactIs_development_19 = reactIs_development.isForwardRef;
- var reactIs_development_20 = reactIs_development.isFragment;
- var reactIs_development_21 = reactIs_development.isLazy;
- var reactIs_development_22 = reactIs_development.isMemo;
- var reactIs_development_23 = reactIs_development.isPortal;
- var reactIs_development_24 = reactIs_development.isProfiler;
- var reactIs_development_25 = reactIs_development.isStrictMode;
- var reactIs_development_26 = reactIs_development.isSuspense;
- var reactIs_development_27 = reactIs_development.isValidElementType;
- var reactIs_development_28 = reactIs_development.typeOf;
-
- var reactIs = createCommonjsModule(function (module) {
-
- {
- module.exports = reactIs_development;
- }
- });
-
/*
object-assign
(c) Sindre Sorhus
@@ -656,14 +407,11 @@
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
-
var printWarning = function() {};
{
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
var loggedTypeFailures = {};
- var has$1 = has;
printWarning = function(text) {
var message = 'Warning: ' + text;
@@ -675,7 +423,7 @@
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
- } catch (x) { /**/ }
+ } catch (x) {}
};
}
@@ -693,7 +441,7 @@
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
{
for (var typeSpecName in typeSpecs) {
- if (has$1(typeSpecs, typeSpecName)) {
+ if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
@@ -704,8 +452,7 @@
if (typeof typeSpecs[typeSpecName] !== 'function') {
var err = Error(
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
);
err.name = 'Invariant Violation';
throw err;
@@ -723,6 +470,7 @@
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
'shape all require an argument).'
);
+
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
@@ -740,17 +488,6 @@
}
}
- /**
- * Resets warning cache when testing.
- *
- * @private
- */
- checkPropTypes.resetWarningCache = function() {
- {
- loggedTypeFailures = {};
- }
- };
-
var checkPropTypes_1 = checkPropTypes;
var printWarning$1 = function() {};
@@ -853,7 +590,6 @@
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
- bigint: createPrimitiveTypeChecker('bigint'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
@@ -864,7 +600,6 @@
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
- elementType: createElementTypeTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
@@ -899,9 +634,8 @@
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
- function PropTypeError(message, data) {
+ function PropTypeError(message) {
this.message = message;
- this.data = data && typeof data === 'object' ? data: {};
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
@@ -936,7 +670,7 @@
) {
printWarning$1(
'You are manually calling a React.PropTypes validation ' +
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
@@ -975,10 +709,7 @@
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
- return new PropTypeError(
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
- {expectedType: expectedType}
- );
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
@@ -1022,18 +753,6 @@
return createChainableTypeChecker(validate);
}
- function createElementTypeTypeChecker() {
- function validate(props, propName, componentName, location, propFullName) {
- var propValue = props[propName];
- if (!reactIs.isValidElementType(propValue)) {
- var propType = getPropType(propValue);
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
- }
- return null;
- }
- return createChainableTypeChecker(validate);
- }
-
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
@@ -1048,16 +767,7 @@
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
- {
- if (arguments.length > 1) {
- printWarning$1(
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
- );
- } else {
- printWarning$1('Invalid argument supplied to oneOf, expected an array.');
- }
- }
+ printWarning$1('Invalid argument supplied to oneOf, expected an instance of array.');
return emptyFunctionThatReturnsNull;
}
@@ -1069,14 +779,8 @@
}
}
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
- var type = getPreciseType(value);
- if (type === 'symbol') {
- return String(value);
- }
- return value;
- });
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
+ var valuesString = JSON.stringify(expectedValues);
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
@@ -1092,7 +796,7 @@
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
- if (has(propValue, key)) {
+ if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error instanceof Error) {
return error;
@@ -1122,19 +826,14 @@
}
function validate(props, propName, componentName, location, propFullName) {
- var expectedTypes = [];
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
- if (checkerResult == null) {
+ if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
return null;
}
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
- expectedTypes.push(checkerResult.data.expectedType);
- }
}
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
+
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
@@ -1149,13 +848,6 @@
return createChainableTypeChecker(validate);
}
- function invalidValidatorError(componentName, location, propFullName, key, type) {
- return new PropTypeError(
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
- );
- }
-
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
@@ -1165,8 +857,8 @@
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
- if (typeof checker !== 'function') {
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
+ if (!checker) {
+ continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
if (error) {
@@ -1185,18 +877,16 @@
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
- // We need to check all keys in case some are required but missing from props.
+ // We need to check all keys in case some are required but missing from
+ // props.
var allKeys = objectAssign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
- if (has(shapeTypes, key) && typeof checker !== 'function') {
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
- }
if (!checker) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
@@ -1263,11 +953,6 @@
return true;
}
- // falsy value can't be a Symbol
- if (!propValue) {
- return false;
- }
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
@@ -1342,7 +1027,6 @@
}
ReactPropTypes.checkPropTypes = checkPropTypes_1;
- ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
@@ -1357,28 +1041,36 @@
*/
{
- var ReactIs = reactIs;
+ var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
+ Symbol.for &&
+ Symbol.for('react.element')) ||
+ 0xeac7;
+
+ var isValidElement = function(object) {
+ return typeof object === 'object' &&
+ object !== null &&
+ object.$$typeof === REACT_ELEMENT_TYPE;
+ };
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
- module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
+ module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
}
});
- var _excluded = ["forwardedRef"];
function withContext(Context) {
var propName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "context";
return function wrap(Component) {
- var EnhanceContext = /*#__PURE__*/function (_React$Component) {
+ var EnhanceContext =
+ /*#__PURE__*/
+ function (_React$Component) {
_inherits(EnhanceContext, _React$Component);
- var _super = _createSuper(EnhanceContext);
-
function EnhanceContext() {
_classCallCheck(this, EnhanceContext);
- return _super.apply(this, arguments);
+ return _possibleConstructorReturn(this, _getPrototypeOf(EnhanceContext).apply(this, arguments));
}
_createClass(EnhanceContext, [{
@@ -1386,13 +1078,13 @@
value: function render() {
var _this$props = this.props,
forwardedRef = _this$props.forwardedRef,
- rest = _objectWithoutProperties(_this$props, _excluded);
+ rest = _objectWithoutProperties(_this$props, ["forwardedRef"]);
- return /*#__PURE__*/React__default.createElement(Context.Consumer, null, function (value) {
+ return React__default.createElement(Context.Consumer, null, function (value) {
var _custom;
var custom = (_custom = {}, _defineProperty(_custom, propName, value), _defineProperty(_custom, "ref", forwardedRef), _custom);
- return /*#__PURE__*/React__default.createElement(Component, _extends({}, custom, rest));
+ return React__default.createElement(Component, _extends({}, custom, rest));
});
}
}]);
@@ -1404,7 +1096,7 @@
var consumerName = Context.Consumer.displayName || Context.Consumer.name || "Context.Consumer";
function enhanceForwardRef(props, ref) {
- return /*#__PURE__*/React__default.createElement(EnhanceContext, _extends({}, props, {
+ return React__default.createElement(EnhanceContext, _extends({}, props, {
forwardedRef: ref
}));
}
@@ -1484,7 +1176,7 @@
return;
}
- var menu = _objectSpread2(_objectSpread2({}, menus.get(name)), {}, {
+ var menu = _objectSpread({}, menus.get(name), {
optionsCustomStyles: optionsCustomStyles
});
@@ -1521,12 +1213,14 @@
var CLOSE_ANIM_DURATION = 195;
var USE_NATIVE_DRIVER = reactNative.Platform.OS !== "web";
- var Backdrop = /*#__PURE__*/function (_Component) {
+ var Backdrop =
+ /*#__PURE__*/
+ function (_Component) {
_inherits(Backdrop, _Component);
- var _super = _createSuper(Backdrop);
-
function Backdrop() {
+ var _getPrototypeOf2;
+
var _this;
_classCallCheck(this, Backdrop);
@@ -1535,7 +1229,7 @@
args[_key] = arguments[_key];
}
- _this = _super.call.apply(_super, [this].concat(args));
+ _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Backdrop)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this.fadeAnim = new reactNative.Animated.Value(0.001);
return _this;
}
@@ -1572,13 +1266,13 @@
var _this$props = this.props,
onPress = _this$props.onPress,
style = _this$props.style;
- return /*#__PURE__*/React__default.createElement(reactNative.TouchableWithoutFeedback, {
+ return React__default.createElement(reactNative.TouchableWithoutFeedback, {
onPress: onPress
- }, /*#__PURE__*/React__default.createElement(reactNative.Animated.View, {
+ }, React__default.createElement(reactNative.Animated.View, {
style: [styles.fullscreen, {
opacity: this.fadeAnim
}]
- }, /*#__PURE__*/React__default.createElement(reactNative.View, {
+ }, React__default.createElement(reactNative.View, {
style: [styles.fullscreen, style]
})));
}
@@ -1603,11 +1297,11 @@
var CFG = {
debug: false
- };
- /**
- * Debug logger depending on `Menu.debug` static porperty.
- */
+ /**
+ * Debug logger depending on `Menu.debug` static porperty.
+ */
+ };
var debug = function debug() {
var _console;
@@ -1618,17 +1312,17 @@
CFG.debug && (_console = console).log.apply(_console, ['react-native-popup-menu'].concat(args));
};
- var MenuPlaceholder = /*#__PURE__*/function (_Component) {
+ var MenuPlaceholder =
+ /*#__PURE__*/
+ function (_Component) {
_inherits(MenuPlaceholder, _Component);
- var _super = _createSuper(MenuPlaceholder);
-
function MenuPlaceholder(props) {
var _this;
_classCallCheck(this, MenuPlaceholder);
- _this = _super.call(this, props);
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(MenuPlaceholder).call(this, props));
_this.state = {};
return _this;
}
@@ -1654,9 +1348,9 @@
return null;
}
- return /*#__PURE__*/React__default.createElement(reactNative.View, {
+ return React__default.createElement(reactNative.View, {
style: styles$1.placeholder
- }, /*#__PURE__*/React__default.createElement(Backdrop, {
+ }, React__default.createElement(Backdrop, {
onPress: ctx._onBackdropPress,
style: backdropStyles,
ref: ctx.onBackdropRef
@@ -1677,7 +1371,6 @@
}
});
- var _excluded$1 = ["style", "children", "layouts"];
var computePosition = function computePosition(_ref) {
var windowLayout = _ref.windowLayout;
return {
@@ -1690,10 +1383,10 @@
var style = props.style,
children = props.children,
layouts = props.layouts,
- other = _objectWithoutProperties(props, _excluded$1);
+ other = _objectWithoutProperties(props, ["style", "children", "layouts"]);
var position = computePosition(layouts);
- return /*#__PURE__*/React__default.createElement(reactNative.View, _extends({}, other, {
+ return React__default.createElement(reactNative.View, _extends({}, other, {
style: [styles$2.options, style, position],
collapsable: false
}), children);
@@ -1722,19 +1415,19 @@
var instanceCount = 0;
- var MenuProvider = /*#__PURE__*/function (_Component) {
+ var MenuProvider =
+ /*#__PURE__*/
+ function (_Component) {
_inherits(MenuProvider, _Component);
- var _super = _createSuper(MenuProvider);
-
function MenuProvider(props) {
var _this;
_classCallCheck(this, MenuProvider);
- _this = _super.call(this, props);
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(MenuProvider).call(this, props));
- _defineProperty(_assertThisInitialized(_this), "_handleBackButton", function () {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_handleBackButton", function () {
var backHandler = _this.props.backHandler;
debug('_handleBackButton called', backHandler); // Default handler if true is passed
@@ -1748,25 +1441,25 @@
if (typeof backHandler === 'function') {
- return backHandler(_assertThisInitialized(_this));
+ return backHandler(_assertThisInitialized(_assertThisInitialized(_this)));
}
return false;
});
- _defineProperty(_assertThisInitialized(_this), "onBackdropRef", function (r) {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onBackdropRef", function (r) {
_this.backdropRef = r;
});
- _defineProperty(_assertThisInitialized(_this), "onOptionsRef", function (r) {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onOptionsRef", function (r) {
_this.optionsRef = r;
});
- _defineProperty(_assertThisInitialized(_this), "_onPlaceholderRef", function (r) {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_onPlaceholderRef", function (r) {
return _this._placeholderRef = r;
});
- _defineProperty(_assertThisInitialized(_this), "_onBackdropPress", function () {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_onBackdropPress", function () {
debug('on backdrop press');
var menu = _this._getOpenedMenu();
@@ -1778,7 +1471,7 @@
_this.closeMenu();
});
- _defineProperty(_assertThisInitialized(_this), "_onLayout", function (_ref) {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_onLayout", function (_ref) {
var layout = _ref.nativeEvent.layout;
if (layoutsEqual(_this._ownLayout, layout)) {
@@ -1809,7 +1502,7 @@
});
});
- _defineProperty(_assertThisInitialized(_this), "_onSafeAreaLayout", function (_ref2) {
+ _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_onSafeAreaLayout", function (_ref2) {
var layout = _ref2.nativeEvent.layout;
if (layoutsEqual(_this._safeAreaLayout, layout)) {
@@ -2072,22 +1765,22 @@
style = _this$props2.style,
customStyles = _this$props2.customStyles;
debug('render menu', this.isMenuOpen(), this._ownLayout);
- return /*#__PURE__*/React__default.createElement(PopupMenuContext.Provider, {
+ return React__default.createElement(PopupMenuContext.Provider, {
value: this.menuCtx
- }, /*#__PURE__*/React__default.createElement(reactNative.View, {
+ }, React__default.createElement(reactNative.View, {
style: styles$3.flex1,
onLayout: this._onLayout
- }, /*#__PURE__*/React__default.createElement(reactNative.View, {
+ }, React__default.createElement(reactNative.View, {
style: [styles$3.flex1, customStyles.menuContextWrapper, customStyles.menuProviderWrapper, style]
- }, this.props.children), /*#__PURE__*/React__default.createElement(reactNative.SafeAreaView, {
+ }, this.props.children), React__default.createElement(reactNative.SafeAreaView, {
style: styles$3.safeArea,
pointerEvents: "box-none"
- }, /*#__PURE__*/React__default.createElement(reactNative.View, {
+ }, React__default.createElement(reactNative.View, {
style: styles$3.flex1,
collapsable: false,
pointerEvents: "box-none",
onLayout: this._onSafeAreaLayout
- }), /*#__PURE__*/React__default.createElement(MenuPlaceholder, {
+ }), React__default.createElement(MenuPlaceholder, {
ctx: this,
backdropStyles: customStyles.backdrop,
ref: this._onPlaceholderRef
@@ -2176,7 +1869,7 @@
safeAreaLayout: safeAreaLayout
};
- var props = _objectSpread2(_objectSpread2({}, rendererProps), {}, {
+ var props = _objectSpread({}, rendererProps, {
style: style,
onLayout: onLayout,
layouts: layouts
@@ -2217,15 +1910,15 @@
}
});
- var MenuOptions = /*#__PURE__*/function (_React$Component) {
+ var MenuOptions =
+ /*#__PURE__*/
+ function (_React$Component) {
_inherits(MenuOptions, _React$Component);
- var _super = _createSuper(MenuOptions);
-
function MenuOptions() {
_classCallCheck(this, MenuOptions);
- return _super.apply(this, arguments);
+ return _possibleConstructorReturn(this, _getPrototypeOf(MenuOptions).apply(this, arguments));
}
_createClass(MenuOptions, [{
@@ -2257,7 +1950,7 @@
customStyles = _this$props.customStyles,
style = _this$props.style,
children = _this$props.children;
- return /*#__PURE__*/React__default.createElement(reactNative.View, {
+ return React__default.createElement(reactNative.View, {
style: [customStyles.optionsWrapper, style]
}, children);
}
@@ -2275,16 +1968,15 @@
};
var MenuOptions$1 = withCtx(MenuOptions);
- var _excluded$2 = ["disabled", "onRef", "text", "children", "style", "customStyles", "menuName", "triggerOnLongPress", "onAlternativeAction", "testID"];
- var MenuTrigger = /*#__PURE__*/function (_Component) {
+ var MenuTrigger =
+ /*#__PURE__*/
+ function (_Component) {
_inherits(MenuTrigger, _Component);
- var _super = _createSuper(MenuTrigger);
-
function MenuTrigger() {
_classCallCheck(this, MenuTrigger);
- return _super.apply(this, arguments);
+ return _possibleConstructorReturn(this, _getPrototypeOf(MenuTrigger).apply(this, arguments));
}
_createClass(MenuTrigger, [{
@@ -2310,7 +2002,7 @@
triggerOnLongPress = _this$props.triggerOnLongPress,
onAlternativeAction = _this$props.onAlternativeAction,
testID = _this$props.testID,
- other = _objectWithoutProperties(_this$props, _excluded$2);
+ other = _objectWithoutProperties(_this$props, ["disabled", "onRef", "text", "children", "style", "customStyles", "menuName", "triggerOnLongPress", "onAlternativeAction", "testID"]);
var onPress = function onPress() {
return !disabled && _this._onPress();
@@ -2320,17 +2012,17 @@
Touchable = _makeTouchable.Touchable,
defaultTouchableProps = _makeTouchable.defaultTouchableProps;
- return /*#__PURE__*/React__default.createElement(reactNative.View, {
+ return React__default.createElement(reactNative.View, {
ref: onRef,
collapsable: false,
style: customStyles.triggerOuterWrapper
- }, /*#__PURE__*/React__default.createElement(Touchable, _extends({
+ }, React__default.createElement(Touchable, _extends({
testID: testID,
onPress: triggerOnLongPress ? onAlternativeAction : onPress,
onLongPress: triggerOnLongPress ? onPress : onAlternativeAction
- }, defaultTouchableProps, customStyles.triggerTouchable), /*#__PURE__*/React__default.createElement(reactNative.View, _extends({}, other, {
+ }, defaultTouchableProps, customStyles.triggerTouchable), React__default.createElement(reactNative.View, _extends({}, other, {
style: [customStyles.triggerWrapper, style]
- }), text ? /*#__PURE__*/React__default.createElement(reactNative.Text, {
+ }), text ? React__default.createElement(reactNative.Text, {
style: customStyles.triggerText
}, text) : children)));
}
@@ -2354,8 +2046,6 @@
};
var MenuTrigger$1 = withCtx(MenuTrigger);
- var _excluded$3 = ["style", "children", "layouts"];
-
var axisPosition = function axisPosition(oDim, wDim, tPos, tDim) {
// if options are bigger than window dimension, then render at 0
if (oDim > wDim) {
@@ -2458,17 +2148,17 @@
return fitPositionIntoSafeArea(position, layouts);
};
- var ContextMenu = /*#__PURE__*/function (_React$Component) {
+ var ContextMenu =
+ /*#__PURE__*/
+ function (_React$Component) {
_inherits(ContextMenu, _React$Component);
- var _super = _createSuper(ContextMenu);
-
function ContextMenu(props) {
var _this;
_classCallCheck(this, ContextMenu);
- _this = _super.call(this, props);
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(ContextMenu).call(this, props));
_this.state = {
scaleAnim: new reactNative.Animated.Value(0.1)
};
@@ -2506,7 +2196,7 @@
style = _this$props.style,
children = _this$props.children,
layouts = _this$props.layouts,
- other = _objectWithoutProperties(_this$props, _excluded$3);
+ other = _objectWithoutProperties(_this$props, ["style", "children", "layouts"]);
var animation = {
transform: [{
@@ -2515,9 +2205,11 @@
opacity: this.state.scaleAnim
};
var position = computePosition$1(layouts, reactNative.I18nManager.isRTL);
- return /*#__PURE__*/React__default.createElement(reactNative.Animated.View, _extends({}, other, {
- style: [styles$4.options, style, animation, position]
- }), children);
+ return React__default.createElement(reactNative.Animated.View, {
+ style: [styles$4.options, animation, position]
+ }, React__default.createElement(reactNative.View, _extends({}, other, {
+ style: [styles$4.options, style]
+ }), children));
}
}]);
@@ -2530,7 +2222,6 @@
position: 'absolute',
borderRadius: 2,
backgroundColor: 'white',
- width: reactNative.PixelRatio.roundToNearestPixel(200),
// Shadow only works on iOS.
shadowColor: 'black',
shadowOpacity: 0.3,
@@ -2556,17 +2247,17 @@
return c.type === MenuOptions$1;
};
- var Menu = /*#__PURE__*/function (_Component) {
+ var Menu =
+ /*#__PURE__*/
+ function (_Component) {
_inherits(Menu, _Component);
- var _super = _createSuper(Menu);
-
function Menu(props) {
var _this;
_classCallCheck(this, Menu);
- _this = _super.call(this, props);
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(Menu).call(this, props));
_this._name = _this.props.name || makeName();
_this._forceClose = false;
var ctx = props.ctx;
@@ -2647,7 +2338,7 @@
var children = this._reduceChildren();
- return /*#__PURE__*/React__default.createElement(reactNative.View, {
+ return React__default.createElement(reactNative.View, {
style: style
}, children);
}
@@ -2752,15 +2443,15 @@
Menu.defaultProps.rendererProps = rendererProps;
};
- var MenuOption = /*#__PURE__*/function (_Component) {
+ var MenuOption =
+ /*#__PURE__*/
+ function (_Component) {
_inherits(MenuOption, _Component);
- var _super = _createSuper(MenuOption);
-
function MenuOption() {
_classCallCheck(this, MenuOption);
- return _super.apply(this, arguments);
+ return _possibleConstructorReturn(this, _getPrototypeOf(MenuOption).apply(this, arguments));
}
_createClass(MenuOption, [{
@@ -2790,7 +2481,7 @@
// FIXME react 16.3 workaround for ControlledExample!
var menu = this.props.ctx.menuActions._getOpenedMenu() || {};
var optionsCustomStyles = menu.optionsCustomStyles;
- return _objectSpread2(_objectSpread2({}, optionsCustomStyles), this.props.customStyles);
+ return _objectSpread({}, optionsCustomStyles, this.props.customStyles);
}
}, {
key: "render",
@@ -2813,16 +2504,16 @@
if (disabled) {
var disabledStyles = [defaultStyles.optionTextDisabled, customStyles.optionText];
- return /*#__PURE__*/React__default.createElement(reactNative.View, {
+ return React__default.createElement(reactNative.View, {
style: [defaultStyles.option, customStyles.optionWrapper, style]
- }, text ? /*#__PURE__*/React__default.createElement(reactNative.Text, {
+ }, text ? React__default.createElement(reactNative.Text, {
style: disabledStyles
}, text) : children);
}
- var rendered = /*#__PURE__*/React__default.createElement(reactNative.View, {
+ var rendered = React__default.createElement(reactNative.View, {
style: [defaultStyles.option, customStyles.optionWrapper, style]
- }, text ? /*#__PURE__*/React__default.createElement(reactNative.Text, {
+ }, text ? React__default.createElement(reactNative.Text, {
style: customStyles.optionText
}, text) : children);
@@ -2833,7 +2524,7 @@
Touchable = _makeTouchable.Touchable,
defaultTouchableProps = _makeTouchable.defaultTouchableProps;
- return /*#__PURE__*/React__default.createElement(Touchable, _extends({
+ return React__default.createElement(Touchable, _extends({
testID: testID,
onPress: function onPress() {
return _this._onSelect();
@@ -2871,20 +2562,19 @@
});
var MenuOption$1 = withCtx(MenuOption);
- var _excluded$4 = ["style", "children", "layouts"];
/**
Simplified version of ContextMenu without animation.
*/
- var NotAnimatedContextMenu = /*#__PURE__*/function (_React$Component) {
+ var NotAnimatedContextMenu =
+ /*#__PURE__*/
+ function (_React$Component) {
_inherits(NotAnimatedContextMenu, _React$Component);
- var _super = _createSuper(NotAnimatedContextMenu);
-
function NotAnimatedContextMenu() {
_classCallCheck(this, NotAnimatedContextMenu);
- return _super.apply(this, arguments);
+ return _possibleConstructorReturn(this, _getPrototypeOf(NotAnimatedContextMenu).apply(this, arguments));
}
_createClass(NotAnimatedContextMenu, [{
@@ -2894,10 +2584,10 @@
style = _this$props.style,
children = _this$props.children,
layouts = _this$props.layouts,
- other = _objectWithoutProperties(_this$props, _excluded$4);
+ other = _objectWithoutProperties(_this$props, ["style", "children", "layouts"]);
var position = computePosition$1(layouts, reactNative.I18nManager.isRTL);
- return /*#__PURE__*/React__default.createElement(reactNative.View, _extends({}, other, {
+ return React__default.createElement(reactNative.View, _extends({}, other, {
style: [styles$4.options, style, position]
}), children);
}
@@ -2906,7 +2596,6 @@
return NotAnimatedContextMenu;
}(React__default.Component);
- var _excluded$5 = ["style", "children", "layouts"];
var computePosition$2 = function computePosition(layouts) {
var windowLayout = layouts.windowLayout,
optionsLayout = layouts.optionsLayout;
@@ -2925,17 +2614,17 @@
return position;
};
- var SlideInMenu = /*#__PURE__*/function (_React$Component) {
+ var SlideInMenu =
+ /*#__PURE__*/
+ function (_React$Component) {
_inherits(SlideInMenu, _React$Component);
- var _super = _createSuper(SlideInMenu);
-
function SlideInMenu(props) {
var _this;
_classCallCheck(this, SlideInMenu);
- _this = _super.call(this, props);
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(SlideInMenu).call(this, props));
_this.state = {
slide: new reactNative.Animated.Value(0)
};
@@ -2973,7 +2662,7 @@
style = _this$props.style,
children = _this$props.children,
layouts = _this$props.layouts,
- other = _objectWithoutProperties(_this$props, _excluded$5);
+ other = _objectWithoutProperties(_this$props, ["style", "children", "layouts"]);
var oHeight = layouts.optionsLayout.height;
var animation = {
@@ -2985,7 +2674,7 @@
}]
};
var position = computePosition$2(layouts);
- return /*#__PURE__*/React__default.createElement(reactNative.Animated.View, _extends({
+ return React__default.createElement(reactNative.Animated.View, _extends({
style: [styles$5.options, style, animation, position]
}, other), children);
}
@@ -3010,7 +2699,6 @@
}
});
- var _excluded$6 = ["style", "children", "layouts", "anchorStyle", "preferredPlacement", "openAnimationDuration", "closeAnimationDuration", "placement"];
var popoverPadding = 7;
var anchorSize = 15;
var anchorHyp = Math.sqrt(anchorSize * anchorSize + anchorSize * anchorSize);
@@ -3249,17 +2937,17 @@
return propertiesByPlacement[bestPlacement](hOptions, vOptions, isRTL);
}
- var Popover = /*#__PURE__*/function (_React$Component) {
+ var Popover =
+ /*#__PURE__*/
+ function (_React$Component) {
_inherits(Popover, _React$Component);
- var _super = _createSuper(Popover);
-
function Popover(props) {
var _this;
_classCallCheck(this, Popover);
- _this = _super.call(this, props);
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(Popover).call(this, props));
_this.state = {
scaleAnim: new reactNative.Animated.Value(0.1)
};
@@ -3302,7 +2990,7 @@
openAnimationDuration = _this$props.openAnimationDuration,
closeAnimationDuration = _this$props.closeAnimationDuration,
userPlacement = _this$props.placement,
- other = _objectWithoutProperties(_this$props, _excluded$6);
+ other = _objectWithoutProperties(_this$props, ["style", "children", "layouts", "anchorStyle", "preferredPlacement", "openAnimationDuration", "closeAnimationDuration", "placement"]);
var isRTL = reactNative.I18nManager.isRTL;
var animation = {
@@ -3317,19 +3005,19 @@
placement = _computeProperties.placement,
offset = _computeProperties.offset;
- return /*#__PURE__*/React__default.createElement(reactNative.Animated.View, {
+ return React__default.createElement(reactNative.Animated.View, {
style: [styles$6.animated, animation, position, getContainerStyle({
placement: placement,
isRTL: isRTL
})],
pointerEvents: "box-none"
- }, /*#__PURE__*/React__default.createElement(reactNative.View, {
+ }, React__default.createElement(reactNative.View, {
style: [styles$6.anchor, dynamicAnchorStyle({
placement: placement,
offset: offset,
isRTL: isRTL
}), anchorStyle]
- }), /*#__PURE__*/React__default.createElement(reactNative.View, _extends({}, other, {
+ }), React__default.createElement(reactNative.View, _extends({}, other, {
style: [styles$6.options, style]
}), children));
}
diff --git a/build/rnpm.js.map b/build/rnpm.js.map
index 7c1c56f..c65ab60 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/lib/has.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/** checks if component is class component */\nexport function isClassComponent(component) {\n return component.prototype && !!component.prototype.render;\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.13.1\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\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;\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; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\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_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // 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 || type === REACT_SUSPENSE_LIST_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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\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\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_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\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;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('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\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.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.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;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\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","module.exports = Function.call.bind(Object.prototype.hasOwnProperty);\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 = require('./lib/has');\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 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'\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 has = require('./lib/has');\nvar checkPropTypes = require('./checkPropTypes');\n\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 bigint: createPrimitiveTypeChecker('bigint'),\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, data) {\n this.message = message;\n this.data = data && typeof data === 'object' ? data: {};\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(\n 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),\n {expectedType: expectedType}\n );\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 var expectedTypes = [];\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);\n if (checkerResult == null) {\n return null;\n }\n if (checkerResult.data && has(checkerResult.data, 'expectedType')) {\n expectedTypes.push(checkerResult.data.expectedType);\n }\n }\n var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));\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 invalidValidatorError(componentName, location, propFullName, key, type) {\n return new PropTypeError(\n (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'\n );\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 (typeof checker !== 'function') {\n return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));\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 props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (has(shapeTypes, key) && typeof checker !== 'function') {\n return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));\n }\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","import { Platform } from 'react-native';\n\n// common durations of animation\nexport const OPEN_ANIM_DURATION = 225;\nexport const CLOSE_ANIM_DURATION = 195;\n\nexport const USE_NATIVE_DRIVER = (Platform.OS !== \"web\");\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, USE_NATIVE_DRIVER } 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: USE_NATIVE_DRIVER,\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: USE_NATIVE_DRIVER,\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, isClassComponent } 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\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 this._isBackHandlerRegistered = 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 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 (this._isBackHandlerRegistered) {\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 if (!this._isBackHandlerRegistered) {\n // delay menu registration until the menu is really opened (and thus this back handler will be called \"sooner\")\n // too soon registration can cause another back handlers (e.g. react navigation) to be called instead of our back handler\n BackHandler.addEventListener('hardwareBackPress', this._handleBackButton);\n this._isBackHandlerRegistered = true;\n }\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 (isClassComponent(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, \n triggerOnLongPress, onAlternativeAction, testID, ...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 onAlternativeAction: PropTypes.func,\n customStyles: PropTypes.object,\n triggerOnLongPress: PropTypes.bool,\n testID: PropTypes.string,\n};\n\nMenuTrigger.defaultProps = {\n disabled: false,\n customStyles: {},\n testID: undefined,\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, USE_NATIVE_DRIVER } 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: USE_NATIVE_DRIVER,\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: USE_NATIVE_DRIVER,\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 isOpen() {\n if (this._forceClose) {\n return false;\n }\n return this.props.hasOwnProperty('opened') ? this.props.opened : this._opened;\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 _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, testID } = 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 testID: PropTypes.string,\n};\n\nMenuOption.defaultProps = {\n disabled: false,\n disableTouchable: false,\n customStyles: {},\n testID: undefined,\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 { I18nManager, 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, I18nManager.isRTL);\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, USE_NATIVE_DRIVER } 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: USE_NATIVE_DRIVER,\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: USE_NATIVE_DRIVER,\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, USE_NATIVE_DRIVER } 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: