1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | 'use strict';
|
10 |
|
11 | var _prodInvariant = require('./reactProdInvariant');
|
12 |
|
13 | var invariant = require('fbjs/lib/invariant');
|
14 |
|
15 | var genericComponentClass = null;
|
16 | var textComponentClass = null;
|
17 |
|
18 | var ReactHostComponentInjection = {
|
19 |
|
20 |
|
21 | injectGenericComponentClass: function (componentClass) {
|
22 | genericComponentClass = componentClass;
|
23 | },
|
24 |
|
25 |
|
26 | injectTextComponentClass: function (componentClass) {
|
27 | textComponentClass = componentClass;
|
28 | }
|
29 | };
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | function createInternalComponent(element) {
|
38 | !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
|
39 | return new genericComponentClass(element);
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function createInstanceForText(text) {
|
47 | return new textComponentClass(text);
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | function isTextComponent(component) {
|
55 | return component instanceof textComponentClass;
|
56 | }
|
57 |
|
58 | var ReactHostComponent = {
|
59 | createInternalComponent: createInternalComponent,
|
60 | createInstanceForText: createInstanceForText,
|
61 | isTextComponent: isTextComponent,
|
62 | injection: ReactHostComponentInjection
|
63 | };
|
64 |
|
65 | module.exports = ReactHostComponent; |
\ | No newline at end of file |