UNPKG

618 BJavaScriptView Raw
1/**
2 * Copyright (c) 2013-present, Facebook, Inc.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 */
8
9'use strict';
10
11var ReactNodeTypes = require('./ReactNodeTypes');
12
13function getHostComponentFromComposite(inst) {
14 var type;
15
16 while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
17 inst = inst._renderedComponent;
18 }
19
20 if (type === ReactNodeTypes.HOST) {
21 return inst._renderedComponent;
22 } else if (type === ReactNodeTypes.EMPTY) {
23 return null;
24 }
25}
26
27module.exports = getHostComponentFromComposite;
\No newline at end of file