Remove some mocks that are already packaged by InitializeJavaScriptAppEngine (#6642)
Pieter De Baets committed
May 3, 2016 at 16:46 UTC
760b1ef4c3b4706584f973bbcab273d86fa0a799
7 files changed
+14
-39
gulpfile.js
-2
@@ -39,9 +39,7 @@ var whiteListNames = [
39
'deepFreezeAndThrowOnMutationInDev',
40
'flattenStyle',
41
'InitializeJavaScriptAppEngine',
42
- 'JSTimersExecution',
42
'RCTEventEmitter',
44
- 'RCTLog',
43
'TextInputState',
44
'UIManager',
45
'View',
src/renderers/native/ReactNativeDefaultInjection.js
+8
-5
@@ -15,11 +15,13 @@
15
* Make sure essential globals are available and are patched correctly. Please don't remove this
16
* line. Bundles created by react-packager `require` it before executing any application code. This
17
* ensures it exists in the dependency graph and can be `require`d.
18
+ * TODO: require this in packager, not in React #10932517
19
*/
20
require('InitializeJavaScriptAppEngine');
21
22
var EventPluginHub = require('EventPluginHub');
23
var EventPluginUtils = require('EventPluginUtils');
24
+var RCTEventEmitter = require('RCTEventEmitter');
25
var ReactComponentEnvironment = require('ReactComponentEnvironment');
26
var ReactDefaultBatchingStrategy = require('ReactDefaultBatchingStrategy');
27
var ReactElement = require('ReactElement');
@@ -28,6 +30,7 @@ var ReactNativeBridgeEventPlugin = require('ReactNativeBridgeEventPlugin');
30
var ReactNativeComponent = require('ReactNativeComponent');
31
var ReactNativeComponentEnvironment = require('ReactNativeComponentEnvironment');
32
var ReactNativeComponentTree = require('ReactNativeComponentTree');
33
+var ReactNativeEventEmitter = require('ReactNativeEventEmitter');
34
var ReactNativeEventPluginOrder = require('ReactNativeEventPluginOrder');
35
var ReactNativeGlobalResponderHandler = require('ReactNativeGlobalResponderHandler');
36
var ReactNativeTextComponent = require('ReactNativeTextComponent');
@@ -38,12 +41,12 @@ var ResponderEventPlugin = require('ResponderEventPlugin');
41
42
var invariant = require('invariant');
43
41
-// Just to ensure this gets packaged, since its only caller is from Native.
42
-require('RCTEventEmitter');
43
-require('RCTLog');
44
-require('JSTimersExecution');
45
-
44
function inject() {
45
+ /**
46
+ * Register the event emitter with the native bridge
47
+ */
48
+ RCTEventEmitter.register(ReactNativeEventEmitter);
49
+
50
/**
51
* Inject module for resolving DOM hierarchy and plugin ordering.
52
*/
src/renderers/native/ReactNativeEventEmitter.js
+1
-1
@@ -11,13 +11,13 @@
11
*/
12
'use strict';
13
14
+var EventConstants = require('EventConstants');
15
var EventPluginHub = require('EventPluginHub');
16
var EventPluginRegistry = require('EventPluginRegistry');
17
var ReactEventEmitterMixin = require('ReactEventEmitterMixin');
18
var ReactNativeComponentTree = require('ReactNativeComponentTree');
19
var ReactNativeTagHandles = require('ReactNativeTagHandles');
20
var ReactUpdates = require('ReactUpdates');
20
-var EventConstants = require('EventConstants');
21
22
var warning = require('warning');
23
src/renderers/native/__mocks__/InitializeJavaScriptAppEngine.js
+1
-1
@@ -11,4 +11,4 @@
11
12
// Noop
13
14
-// TODO: Move all initialization callers back into react-native
14
+// TODO #10932517: Move all initialization callers back into react-native
src/renderers/native/__mocks__/JSTimersExecution.js
deleted
-14
@@ -1,14 +0,0 @@
1
-/**
2
- * Copyright 2013-2015, 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
-
10
-'use strict';
11
-
12
-// Noop
13
-
14
-// TODO: Move all initialization callers back into react-native
src/renderers/native/__mocks__/RCTEventEmitter.js
+4
-2
@@ -9,6 +9,8 @@
9
10
'use strict';
11
12
-// Noop
12
+var RCTEventEmitter = {
13
+ register: jest.fn(),
14
+};
15
14
-// TODO: Move all initialization callers back into react-native
16
+module.exports = RCTEventEmitter;
src/renderers/native/__mocks__/RCTLog.js
deleted
-14
@@ -1,14 +0,0 @@
1
-/**
2
- * Copyright 2013-2015, 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
-
10
-'use strict';
11
-
12
-// Noop
13
-
14
-// TODO: Move all initialization callers back into react-native