react 15.0.0 → 15.0.2-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule createReactNativeComponentClass
10
+ *
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ var ReactNativeBaseComponent = require('./ReactNativeBaseComponent');
16
+
17
+ // See also ReactNativeBaseComponent
18
+
19
+
20
+ /**
21
+ * @param {string} config iOS View configuration.
22
+ * @private
23
+ */
24
+ var createReactNativeComponentClass = function (viewConfig) {
25
+ var Constructor = function (element) {
26
+ this._currentElement = element;
27
+ this._topLevelWrapper = null;
28
+ this._nativeParent = null;
29
+ this._nativeContainerInfo = null;
30
+ this._rootNodeID = null;
31
+ this._renderedChildren = null;
32
+ };
33
+ Constructor.displayName = viewConfig.uiViewClassName;
34
+ Constructor.viewConfig = viewConfig;
35
+ Constructor.propTypes = viewConfig.propTypes;
36
+ Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
37
+ Constructor.prototype.constructor = Constructor;
38
+
39
+ return Constructor;
40
+ };
41
+
42
+ module.exports = createReactNativeComponentClass;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule findNodeHandle
10
+ *
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ var ReactCurrentOwner = require('./ReactCurrentOwner');
16
+ var ReactInstanceMap = require('./ReactInstanceMap');
17
+
18
+ var invariant = require('fbjs/lib/invariant');
19
+ var warning = require('fbjs/lib/warning');
20
+
21
+ /**
22
+ * ReactNative vs ReactWeb
23
+ * -----------------------
24
+ * React treats some pieces of data opaquely. This means that the information
25
+ * is first class (it can be passed around), but cannot be inspected. This
26
+ * allows us to build infrastructure that reasons about resources, without
27
+ * making assumptions about the nature of those resources, and this allows that
28
+ * infra to be shared across multiple platforms, where the resources are very
29
+ * different. General infra (such as `ReactMultiChild`) reasons opaquely about
30
+ * the data, but platform specific code (such as `ReactNativeBaseComponent`) can
31
+ * make assumptions about the data.
32
+ *
33
+ *
34
+ * `rootNodeID`, uniquely identifies a position in the generated native view
35
+ * tree. Many layers of composite components (created with `React.createClass`)
36
+ * can all share the same `rootNodeID`.
37
+ *
38
+ * `nodeHandle`: A sufficiently unambiguous way to refer to a lower level
39
+ * resource (dom node, native view etc). The `rootNodeID` is sufficient for web
40
+ * `nodeHandle`s, because the position in a tree is always enough to uniquely
41
+ * identify a DOM node (we never have nodes in some bank outside of the
42
+ * document). The same would be true for `ReactNative`, but we must maintain a
43
+ * mapping that we can send efficiently serializable
44
+ * strings across native boundaries.
45
+ *
46
+ * Opaque name TodaysWebReact FutureWebWorkerReact ReactNative
47
+ * ----------------------------------------------------------------------------
48
+ * nodeHandle N/A rootNodeID tag
49
+ */
50
+
51
+ function findNodeHandle(componentOrHandle) {
52
+ if (process.env.NODE_ENV !== 'production') {
53
+ var owner = ReactCurrentOwner.current;
54
+ if (owner !== null) {
55
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findNodeHandle inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
56
+ owner._warnedAboutRefsInRender = true;
57
+ }
58
+ }
59
+ if (componentOrHandle == null) {
60
+ return null;
61
+ }
62
+ if (typeof componentOrHandle === 'number') {
63
+ // Already a node handle
64
+ return componentOrHandle;
65
+ }
66
+
67
+ var component = componentOrHandle;
68
+
69
+ // TODO (balpert): Wrap iOS native components in a composite wrapper, then
70
+ // ReactInstanceMap.get here will always succeed for mounted components
71
+ var internalInstance = ReactInstanceMap.get(component);
72
+ if (internalInstance) {
73
+ return internalInstance.getNativeNode();
74
+ } else {
75
+ var rootNodeID = component._rootNodeID;
76
+ if (rootNodeID) {
77
+ return rootNodeID;
78
+ } else {
79
+ !(
80
+ // Native
81
+ typeof component === 'object' && '_rootNodeID' in component ||
82
+ // Composite
83
+ component.render != null && typeof component.render === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findNodeHandle(...): Argument is not a component ' + '(type: %s, keys: %s)', typeof component, Object.keys(component)) : invariant(false) : void 0;
84
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findNodeHandle(...): Unable to find node handle for unmounted ' + 'component.') : invariant(false) : void 0;
85
+ }
86
+ }
87
+ }
88
+
89
+ module.exports = findNodeHandle;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react",
3
3
  "description": "React is a JavaScript library for building user interfaces.",
4
- "version": "15.0.0",
4
+ "version": "15.0.2-alpha.3",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var ReactUpdates = require('./ReactUpdates');
4
-
5
- // TODO: In React Native, ReactTestUtils depends on ./ReactDOM (for
6
- // renderIntoDocument, which should never be called) and Relay depends on
7
- // react-dom (for batching). Once those are fixed, nothing in RN should import
8
- // this module and this file can go away.
9
-
10
- module.exports = {
11
- unstable_batchedUpdates: ReactUpdates.batchedUpdates,
12
- };