diff --git a/lib/component.js b/lib/component.js index b7c7ce4..8db794b 100644 --- a/lib/component.js +++ b/lib/component.js @@ -32,11 +32,13 @@ if (typeof define === 'function' && define.amd) { define(['react', 'backbone', 'underscore'], factory); } else if (typeof module !== 'undefined' && module.exports) { - module.exports = factory(require('react'), require('backbone'), require('underscore')); + react = require('react-native'); // React Native + isReactNative = true; + module.exports = factory(isReactNative, react, require('backbone'), require('underscore')); } else { factory(root.React, root.Backbone, root._); } -}(this, function (React, Backbone, _) { +}(this, function (isReactNative, React, Backbone, _) { 'use strict'; if (!Backbone.React) { Backbone.React = {}; @@ -70,11 +72,15 @@ }, // Sets `this.el` and `this.$el` when the component mounts. componentDidMount: function () { - this.setElement(React.findDOMNode(this)); + if (isReactNative === false) { + this.setElement(React.findDOMNode(this)); + } }, // Sets `this.el` and `this.$el` when the component updates. componentDidUpdate: function () { - this.setElement(React.findDOMNode(this)); + if (isReactNative === false) { + this.setElement(React.findDOMNode(this)); + } }, // When the component gets the initial state, instance a `Wrapper` to take // care of models and collections binding with `this.state`. diff --git a/package.json b/package.json index 1d68051..a16feeb 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "peerDependencies": { "backbone": "^1.2.3", - "react": "^0.13.3" + "react-native": ">=0.14.0" }, "dependencies": { "underscore": "^1.8.3"