Skip to content

Commit 83c556c

Browse files
authored
Merge pull request #2 from lh0x00/bugfix/RefReact18Support
fix: set `configurable` pass react 18 render twice, and format lint
2 parents bf12aa3 + 13612cd commit 83c556c

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

examples/zoom-to-bounds/src/map-style.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ const mapStyle = {
99

1010
mapStyle.sources['sf-neighborhoods'] = {
1111
type: 'geojson',
12-
data:
13-
'https://raw.githubusercontent.com/uber/react-map-gl/master/examples/.data/feature-example-sf.json'
12+
data: 'https://raw.githubusercontent.com/uber/react-map-gl/master/examples/.data/feature-example-sf.json'
1413
};
1514

1615
mapStyle.layers.push(

src/components/popup.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ function Popup(props) {
174174
);
175175

176176
// If eventManager does not exist (using with static map), listen to React event
177-
const onReactClick = useCallback(e => !context.eventManager && onClick(e, thisRef), [
178-
context.eventManager
179-
]);
177+
const onReactClick = useCallback(
178+
e => !context.eventManager && onClick(e, thisRef),
179+
[context.eventManager]
180+
);
180181

181182
return (
182183
<div

src/goong/goong.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,20 @@ export default class Goong {
317317
// This eliminates the timing issue between calling resize() and DOM update
318318
/* eslint-disable accessor-pairs */
319319
const {container} = props;
320-
Object.defineProperty(container, 'offsetWidth', {get: () => this.width});
321-
Object.defineProperty(container, 'clientWidth', {get: () => this.width});
320+
Object.defineProperty(container, 'offsetWidth', {
321+
configurable: true,
322+
get: () => this.width
323+
});
324+
Object.defineProperty(container, 'clientWidth', {
325+
configurable: true,
326+
get: () => this.width
327+
});
322328
Object.defineProperty(container, 'offsetHeight', {
329+
configurable: true,
323330
get: () => this.height
324331
});
325332
Object.defineProperty(container, 'clientHeight', {
333+
configurable: true,
326334
get: () => this.height
327335
});
328336

@@ -401,8 +409,14 @@ export default class Goong {
401409
}
402410

403411
_getViewState(props) {
404-
const {longitude, latitude, zoom, pitch = 0, bearing = 0, altitude = 1.5} =
405-
props.viewState || props;
412+
const {
413+
longitude,
414+
latitude,
415+
zoom,
416+
pitch = 0,
417+
bearing = 0,
418+
altitude = 1.5
419+
} = props.viewState || props;
406420
return {longitude, latitude, zoom, pitch, bearing, altitude};
407421
}
408422

0 commit comments

Comments
 (0)