@samitouri / QOS-React / commits / 3630bf3559

Corrected a stubbed modules problem for RN fiber bundle (#9784)

Brian Vaughn committed May 26, 2017 at 11:15 UTC 3630bf3559b72d66437187901fb5eab3f976c6a4
5 files changed +89 -49
scripts/rollup/bundles.js
+2 -2
@@ -317,7 +317,7 @@ const bundles = [
317 ],
318 useFiber: false,
319 modulesToStub: [
320 - "'createReactNativeFiberComponentClass'",
320 + "'createReactNativeComponentClassFiber'",
321 "'ReactNativeFiberRenderer'",
322 "'findNumericNodeHandleFiber'",
323 "'ReactNativeFiber'",
@@ -359,7 +359,7 @@ const bundles = [
359 ],
360 useFiber: true,
361 modulesToStub: [
362 - "'createReactNativeComponentClass'",
362 + "'createReactNativeComponentClassStack'",
363 "'findNumericNodeHandleStack'",
364 "'ReactNativeStack'",
365 ],
scripts/rollup/results.json
+8 -8
@@ -165,20 +165,20 @@
165 "gzip": 83320
166 },
167 "ReactNativeStack-dev.js (RN_DEV)": {
168 - "size": 182999,
169 - "gzip": 35650
168 + "size": 182305,
169 + "gzip": 35469
170 },
171 "ReactNativeStack-prod.js (RN_PROD)": {
172 - "size": 134766,
173 - "gzip": 25923
172 + "size": 134072,
173 + "gzip": 25710
174 },
175 "ReactNativeFiber-dev.js (RN_DEV)": {
176 - "size": 271047,
177 - "gzip": 49114
176 + "size": 278278,
177 + "gzip": 50225
178 },
179 "ReactNativeFiber-prod.js (RN_PROD)": {
180 - "size": 208977,
181 - "gzip": 36295
180 + "size": 216205,
181 + "gzip": 37384
182 }
183 }
184 }
\ No newline at end of file
src/renderers/native/createReactNativeComponentClass.js
+3 -39
@@ -12,51 +12,15 @@
12
13 'use strict';
14
15 -const ReactNativeBaseComponent = require('ReactNativeBaseComponent');
15 const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags');
17 -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry');
16
17 // See also ReactNativeBaseComponent
20 -type ReactNativeBaseComponentViewConfig = {
18 +export type ReactNativeBaseComponentViewConfig = {
19 validAttributes: Object,
20 uiViewClassName: string,
21 propTypes?: Object,
22 };
23
26 -/**
27 - * @param {string} config iOS View configuration.
28 - * @private
29 - */
30 -const createReactNativeFiberComponentClass = function(
31 - viewConfig: ReactNativeBaseComponentViewConfig,
32 -): string {
33 - return ReactNativeViewConfigRegistry.register(viewConfig);
34 -};
35 -
36 -/**
37 - * @param {string} config iOS View configuration.
38 - * @private
39 - */
40 -const createReactNativeComponentClass = function(
41 - viewConfig: ReactNativeBaseComponentViewConfig,
42 -): ReactClass<any> {
43 - const Constructor = function(element) {
44 - this._currentElement = element;
45 - this._topLevelWrapper = null;
46 - this._hostParent = null;
47 - this._hostContainerInfo = null;
48 - this._rootNodeID = 0;
49 - this._renderedChildren = null;
50 - };
51 - Constructor.displayName = viewConfig.uiViewClassName;
52 - Constructor.viewConfig = viewConfig;
53 - Constructor.propTypes = viewConfig.propTypes;
54 - Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
55 - Constructor.prototype.constructor = Constructor;
56 -
57 - return ((Constructor: any): ReactClass<any>);
58 -};
59 -
24 module.exports = ReactNativeFeatureFlags.useFiber
61 - ? createReactNativeFiberComponentClass
62 - : createReactNativeComponentClass;
25 + ? require('createReactNativeComponentClassFiber')
26 + : require('createReactNativeComponentClassStack');
src/renderers/native/createReactNativeComponentClassFiber.js new
+31
@@ -0,0 +1,31 @@
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 createReactNativeComponentClassFiber
10 + * @flow
11 + */
12 +
13 +'use strict';
14 +
15 +const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry');
16 +
17 +import type {
18 + ReactNativeBaseComponentViewConfig,
19 +} from './createReactNativeComponentClass';
20 +
21 +/**
22 + * @param {string} config iOS View configuration.
23 + * @private
24 + */
25 +const createReactNativeComponentClassFiber = function(
26 + viewConfig: ReactNativeBaseComponentViewConfig,
27 +): string {
28 + return ReactNativeViewConfigRegistry.register(viewConfig);
29 +};
30 +
31 +module.exports = createReactNativeComponentClassFiber;
src/renderers/native/createReactNativeComponentClassStack.js new
+45
@@ -0,0 +1,45 @@
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 createReactNativeComponentClassStack
10 + * @flow
11 + */
12 +
13 +'use strict';
14 +
15 +const ReactNativeBaseComponent = require('ReactNativeBaseComponent');
16 +
17 +import type {
18 + ReactNativeBaseComponentViewConfig,
19 +} from './createReactNativeComponentClass';
20 +
21 +/**
22 + * @param {string} config iOS View configuration.
23 + * @private
24 + */
25 +const createReactNativeComponentClassStack = function(
26 + viewConfig: ReactNativeBaseComponentViewConfig,
27 +): ReactClass<any> {
28 + const Constructor = function(element) {
29 + this._currentElement = element;
30 + this._topLevelWrapper = null;
31 + this._hostParent = null;
32 + this._hostContainerInfo = null;
33 + this._rootNodeID = 0;
34 + this._renderedChildren = null;
35 + };
36 + Constructor.displayName = viewConfig.uiViewClassName;
37 + Constructor.viewConfig = viewConfig;
38 + Constructor.propTypes = viewConfig.propTypes;
39 + Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
40 + Constructor.prototype.constructor = Constructor;
41 +
42 + return ((Constructor: any): ReactClass<any>);
43 +};
44 +
45 +module.exports = createReactNativeComponentClassStack;