UNPKG

rn-web-cli

Version:

React Native for Web

1 lines 5.06 kB
{"version":3,"sources":["node_modules\\react-dom\\lib\\ReactOwner.js"],"names":["_prodInvariant","require","invariant","isValidOwner","object","attachRef","detachRef","ReactOwner","addComponentAsRefTo","component","ref","owner","process","env","NODE_ENV","removeComponentAsRefFrom","ownerPublicInstance","getPublicInstance","refs","module","exports"],"mappings":";;;;;;;;;;;AAWA;;AAEA,GAAIA,gBAAiBC,QAAQ,sBAAR,CAArB;;AAEA,GAAIC,WAAYD,QAAQ,oBAAR,CAAhB;;;;;;;AAOA,QAASE,aAAT,CAAsBC,MAAtB,CAA8B;AAC5B,MAAO,CAAC,EAAEA,QAAU,MAAOA,QAAOC,SAAd,GAA4B,UAAtC,EAAoD,MAAOD,QAAOE,SAAd,GAA4B,UAAlF,CAAR;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCD,GAAIC,YAAa;;;;;;;;;;AAUfC,oBAAqB,6BAAUC,SAAV,CAAqBC,GAArB,CAA0BC,KAA1B,CAAiC;AACpD,CAACR,aAAaQ,KAAb,CAAD,CAAuBC,QAAQC,GAAR,CAAYC,QAAZ,GAAyB,YAAzB,CAAwCZ,UAAU,KAAV,CAAiB,kQAAjB,CAAxC,CAA+TF,eAAe,KAAf,CAAtV,CAA8W,IAAK,EAAnX;AACAW,MAAMN,SAAN,CAAgBK,GAAhB,CAAqBD,SAArB;AACD,CAbc;;;;;;;;;;;AAwBfM,yBAA0B,kCAAUN,SAAV,CAAqBC,GAArB,CAA0BC,KAA1B,CAAiC;AACzD,CAACR,aAAaQ,KAAb,CAAD,CAAuBC,QAAQC,GAAR,CAAYC,QAAZ,GAAyB,YAAzB,CAAwCZ,UAAU,KAAV,CAAiB,yQAAjB,CAAxC,CAAsUF,eAAe,KAAf,CAA7V,CAAqX,IAAK,EAA1X;AACA,GAAIgB,qBAAsBL,MAAMM,iBAAN,EAA1B;;;AAGA,GAAID,qBAAuBA,oBAAoBE,IAApB,CAAyBR,GAAzB,IAAkCD,UAAUQ,iBAAV,EAA7D,CAA4F;AAC1FN,MAAML,SAAN,CAAgBI,GAAhB;AACD;AACF,CAhCc,CAAjB;;;AAmCAS,OAAOC,OAAP,CAAiBb,UAAjB","file":"ReactOwner.js","sourceRoot":"D:/Work/Office/react-native-on-web/cli/tmpl/project","sourcesContent":["/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * \n */\n\n'use strict';\n\nvar _prodInvariant = require('./reactProdInvariant');\n\nvar invariant = require('fbjs/lib/invariant');\n\n/**\n * @param {?object} object\n * @return {boolean} True if `object` is a valid owner.\n * @final\n */\nfunction isValidOwner(object) {\n return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');\n}\n\n/**\n * ReactOwners are capable of storing references to owned components.\n *\n * All components are capable of //being// referenced by owner components, but\n * only ReactOwner components are capable of //referencing// owned components.\n * The named reference is known as a \"ref\".\n *\n * Refs are available when mounted and updated during reconciliation.\n *\n * var MyComponent = React.createClass({\n * render: function() {\n * return (\n * <div onClick={this.handleClick}>\n * <CustomComponent ref=\"custom\" />\n * </div>\n * );\n * },\n * handleClick: function() {\n * this.refs.custom.handleClick();\n * },\n * componentDidMount: function() {\n * this.refs.custom.initialize();\n * }\n * });\n *\n * Refs should rarely be used. When refs are used, they should only be done to\n * control data that is not handled by React's data flow.\n *\n * @class ReactOwner\n */\nvar ReactOwner = {\n /**\n * Adds a component by ref to an owner component.\n *\n * @param {ReactComponent} component Component to reference.\n * @param {string} ref Name by which to refer to the component.\n * @param {ReactOwner} owner Component on which to record the ref.\n * @final\n * @internal\n */\n addComponentAsRefTo: function (component, ref, owner) {\n !isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0;\n owner.attachRef(ref, component);\n },\n\n /**\n * Removes a component by ref from an owner component.\n *\n * @param {ReactComponent} component Component to dereference.\n * @param {string} ref Name of the ref to remove.\n * @param {ReactOwner} owner Component on which the ref is recorded.\n * @final\n * @internal\n */\n removeComponentAsRefFrom: function (component, ref, owner) {\n !isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0;\n var ownerPublicInstance = owner.getPublicInstance();\n // Check that `component`'s owner is still alive and that `component` is still the current ref\n // because we do not want to detach the ref if another component stole it.\n if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {\n owner.detachRef(ref);\n }\n }\n};\n\nmodule.exports = ReactOwner;"]}