Skip to content

Ref bug #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion dist/GoogleApiComponent.js
Original file line number Diff line number Diff line change
@@ -200,6 +200,8 @@
}, {
key: 'render',
value: function render() {
var _this2 = this;

var LoadingContainer = this.LoadingContainer;

if (!this.state.loaded) {
@@ -215,7 +217,9 @@
'div',
null,
_react2.default.createElement(WrappedComponent, props),
_react2.default.createElement('div', { ref: 'map' })
_react2.default.createElement('div', { ref: function ref(_ref) {
return _this2._mapRef = _ref;
} })
);
}
}]);
8 changes: 7 additions & 1 deletion dist/components/Marker.js
Original file line number Diff line number Diff line change
@@ -210,7 +210,13 @@
}, {
key: 'render',
value: function render() {
return null;
return _react2.default.createElement(
_react.Fragment,
null,
this.props.children && this.marker ? _react2.default.Children.only(_react2.default.cloneElement(this.props.children, { marker: this.marker,
google: this.props.google,
map: this.props.map })) : null
);
}
}]);

822 changes: 410 additions & 412 deletions dist/index.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/lib/GoogleApi.js
Original file line number Diff line number Diff line change
@@ -49,7 +49,8 @@
v: googleVersion,
channel: channel,
language: language,
region: region
region: region,
onerror: 'ERROR_FUNCTION'
};

var paramStr = Object.keys(params).filter(function (k) {
2 changes: 1 addition & 1 deletion dist/lib/String.js
Original file line number Diff line number Diff line change
@@ -21,4 +21,4 @@
return word.charAt(0).toUpperCase() + word.slice(1);
}).join('');
};
});
});
3,024 changes: 1,504 additions & 1,520 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/GoogleApiComponent.js
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ export const wrapper = input => WrappedComponent => {
return (
<div>
<WrappedComponent {...props} />
<div ref="map" />
<div ref={ref => this._mapRef = ref} />
</div>
);
}
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -130,8 +130,7 @@ export class Map extends React.Component {
const {google} = this.props;
const maps = google.maps;

const mapRef = this.refs.map;
const node = ReactDOM.findDOMNode(mapRef);
const node = ReactDOM.findDOMNode(this._mapRef);
const curr = this.state.currentLocation;
const center = new maps.LatLng(curr.lat, curr.lng);

@@ -257,7 +256,7 @@ export class Map extends React.Component {

return (
<div style={containerStyles} className={this.props.className}>
<div style={style} ref="map">
<div style={style} ref={ref => this._mapRef = ref}>
Loading map...
</div>
{this.renderChildren()}