Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions injected/DOMHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ function getDOMNode(instance, depth, diveTo) {

// TODO: Better duck checking, of what is a text component
if (ReactHost.isTextComponent(instance)) {
// ReactTextComponent
return getTextNode(instance.props.text, bindNode(instance));
if (typeof instance.props === "string") {
// React 0.11+
return getTextNode(instance.props, bindNode(instance));
} else {
// React 0.10
return getTextNode(instance.props.text, bindNode(instance));
}
}

var id = bindNode(instance);
Expand Down Expand Up @@ -393,7 +398,12 @@ function parseValue(stringValue, currentType) {
DOMHost.setNodeValue = function(id, value) {
var instance = instanceCache[id];
var currentValue;
if (ReactHost.isTextComponent(instance)) {
if (ReactHost.isTextComponent(instance) &&
typeof instance.props === "string") {
// React 0.11+
instance.props = parseValue(value, typeof instance.props);
} else if (ReactHost.isTextComponent(instance)) {
// React 0.10+
instance.props.text = parseValue(value, typeof instance.props.text);
} else {
instance.props.children = parseValue(value, typeof instance.props.children);
Expand Down
7 changes: 6 additions & 1 deletion injected/ReactHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ var ReactHost = {

isTextComponent: function(component) {
if (!ReactTextComponent) return false;
return component instanceof ReactTextComponent;
// ReactTextComponent is the type in React 0.10 but is the element factory
// in React 0.11+, so check both
return component instanceof ReactTextComponent || (
ReactTextComponent.type &&
component instanceof ReactTextComponent.type
);
},

_unwrapMethod: function(method, targetEventName) {
Expand Down