Skip to content

Commit

Permalink
Update to React 0.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLeCam committed Mar 11, 2015
1 parent fe83942 commit 5b78104
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 46 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ The Popup children will be rendered as its content using `React.renderToStaticMa

## Changelog

v0.4.0-beta.1
### v0.4.0-rc.1 (11/03/15)

- Updated React dependency to 0.13:
React 0.13.0.

### v0.4.0-beta.1 (08/03/15)

- Updated React dependency to 0.13.0-rc2:
- Components are defined as ES6 classes.
- Mixins are replaced by the base components `MapComponent`, `MapLayer`, `BaseTileLayer` and `PopupContainer`. All components extend from these.
- The new [`React.cloneElement()`](https://facebook.github.io/react/blog/2015/03/03/react-v0.13-rc2.html#react.cloneelement) API is used instead of `React.cloneWithProps()` to pass the `map` property to the components.
- The new [`React.cloneElement()`](https://facebook.github.io/react/blog/2015/03/03/react-v0.13-rc2.html#react.cloneelement) API is used instead of the deprecated `React.addons.cloneWithProps()` to pass the `map` property to the components.
- The `map` property has been removed from the components `propTypes` definition as it is dynamically injected to its children by the `Map` component, React would [now warn it is not set](https://facebook.github.io/react/blog/2015/02/24/streamlining-react-elements.html#solution-early-proptype-warnings). It is still required by components to have access to the Leaflet object.
- Events can now be set as `on{Event}` rather than `onLeaflet{Event}`, ex `onClick` instead of `onLeafletClick`, as all events are proxied to Leaflet.
- Deprecated `getLeafletElement()` method, simply use the `leafletElement` property instead to access the Leaflet object created for a component.
Expand Down
32 changes: 11 additions & 21 deletions example/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ React.render(examples, document.getElementById("app"));

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

Expand Down Expand Up @@ -81,23 +81,19 @@ var EventsExample = (function (_React$Component) {

_inherits(EventsExample, _React$Component);

_prototypeProperties(EventsExample, null, {
_createClass(EventsExample, {
handleClick: {
value: function handleClick() {
this.refs.map.leafletElement.locate();
},
writable: true,
configurable: true
}
},
handleLocationFound: {
value: function handleLocationFound(e) {
this.setState({
hasLocation: true,
latlng: e.latlng
});
},
writable: true,
configurable: true
}
},
render: {
value: function render() {
Expand Down Expand Up @@ -128,9 +124,7 @@ var EventsExample = (function (_React$Component) {
}),
marker
);
},
writable: true,
configurable: true
}
}
});

Expand All @@ -144,7 +138,7 @@ module.exports = EventsExample;

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

Expand Down Expand Up @@ -172,7 +166,7 @@ var SimpleExample = (function (_React$Component) {

_inherits(SimpleExample, _React$Component);

_prototypeProperties(SimpleExample, null, {
_createClass(SimpleExample, {
render: {
value: function render() {
var position = [this.state.lat, this.state.lng];
Expand All @@ -199,9 +193,7 @@ var SimpleExample = (function (_React$Component) {
)
)
);
},
writable: true,
configurable: true
}
}
});

Expand All @@ -215,7 +207,7 @@ module.exports = SimpleExample;

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

Expand Down Expand Up @@ -247,7 +239,7 @@ var VectorLayersExample = (function (_React$Component) {

_inherits(VectorLayersExample, _React$Component);

_prototypeProperties(VectorLayersExample, null, {
_createClass(VectorLayersExample, {
render: {
value: function render() {
var center = [51.505, -0.09];
Expand Down Expand Up @@ -289,9 +281,7 @@ var VectorLayersExample = (function (_React$Component) {
React.createElement(MultiPolygon, { polygons: multiPolygon, color: "purple" }),
React.createElement(Rectangle, { bounds: rectangle, color: "black" })
);
},
writable: true,
configurable: true
}
}
});

Expand Down
36 changes: 24 additions & 12 deletions example/build/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

Expand Down Expand Up @@ -4543,7 +4544,7 @@ if ("production" !== process.env.NODE_ENV) {
}
}

React.version = '0.13.0-rc2';
React.version = '0.13.0';

module.exports = React;

Expand Down Expand Up @@ -6459,7 +6460,7 @@ ReactComponent.prototype.setState = function(partialState, callback) {
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldUpdateComponent`, but it will invoke
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
Expand All @@ -6482,6 +6483,7 @@ if ("production" !== process.env.NODE_ENV) {
var deprecatedAPIs = {
getDOMNode: 'getDOMNode',
isMounted: 'isMounted',
replaceProps: 'replaceProps',
replaceState: 'replaceState',
setProps: 'setProps'
};
Expand Down Expand Up @@ -6805,6 +6807,20 @@ var ReactCompositeComponentMixin = {

// Initialize the public class
var inst = new Component(publicProps, publicContext);

if ("production" !== process.env.NODE_ENV) {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
("production" !== process.env.NODE_ENV ? warning(
inst.render != null,
'%s(...): No `render` method found on the returned component ' +
'instance: you may have forgotten to define `render` in your ' +
'component or you may have accidentally tried to render an element ' +
'whose type is a function that isn\'t a React component.',
Component.displayName || Component.name || 'Component'
) : null);
}

// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
Expand Down Expand Up @@ -10063,17 +10079,12 @@ var ReactDefaultPerf = {
addValue(entry.inclusive, rootNodeID, totalTime);
}

var displayName = null;
if (this._instance.constructor.displayName) {
displayName = this._instance.constructor.displayName;
} else if (this._currentElement.type) {
displayName = this._currentElement.type;
}

entry.displayNames[rootNodeID] = {
current: displayName,
current: typeof this._currentElement.type === 'string' ?
this._currentElement.type :
this.getName(),
owner: this._currentElement._owner ?
this._currentElement._owner._instance.constructor.displayName :
this._currentElement._owner.getName() :
'<root>'
};

Expand Down Expand Up @@ -14465,14 +14476,15 @@ function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (ReactElement.isValidElement(propValue)) {
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
propValue = ReactFragment.extractIfFragment(propValue);
Expand Down
12 changes: 7 additions & 5 deletions example/build/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ function baseAssign(object, source, customizer) {
value = object[key],
result = customizer(value, source[key], key, object, source);

if ((result === result ? result !== value : value === value) ||
if ((result === result ? (result !== value) : (value === value)) ||
(typeof value == 'undefined' && !(key in object))) {
object[key] = result;
}
Expand Down Expand Up @@ -2572,8 +2572,10 @@ function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, sta
othCtor = other.constructor;

// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
return false;
}
}
Expand Down Expand Up @@ -2785,7 +2787,7 @@ function isIterateeCall(value, index, object) {
}
if (prereq) {
var other = object[index];
return value === value ? value === other : other !== other;
return value === value ? (value === other) : (other !== other);
}
return false;
}
Expand Down Expand Up @@ -3320,7 +3322,7 @@ var keys = !nativeKeys ? shimKeys : function(object) {
length = object.length;
}
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object != 'function' && (length && isLength(length)))) {
(typeof object != 'function' && (length && isLength(length)))) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-leaflet",
"version": "0.4.0-beta.1",
"version": "0.4.0-rc.1",
"description": "React components for Leaflet maps",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -30,14 +30,14 @@
},
"homepage": "https://github.com/PaulLeCam/react-leaflet",
"dependencies": {
"lodash": "^3.4.0"
"lodash": "^3.0.0"
},
"peerDependencies": {
"leaflet": "^0.7.0",
"react": "^0.13.0-rc2"
"react": "^0.13.0"
},
"devDependencies": {
"babel": "^4.7.3",
"babel": "^4.7.8",
"babelify": "^5.0.3",
"browserify": "^9.0.3",
"gulp": "^3.8.10",
Expand All @@ -47,7 +47,7 @@
"jest-cli": "^0.4.0",
"leaflet": "^0.7.3",
"onchange": "^1.0.0",
"react": "^0.13.0-rc2",
"react": "^0.13.0",
"vinyl-source-stream2": "^0.1.1",
"watchify": "^2.4.0"
},
Expand Down

0 comments on commit 5b78104

Please sign in to comment.