mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-25 16:02:50 +00:00
Fix crash in React 18 StrictMode (#1680)
This commit is contained in:
parent
9a729c211a
commit
d7ebfbc2cd
@ -317,12 +317,20 @@ export default class Mapbox {
|
||||
// This eliminates the timing issue between calling resize() and DOM update
|
||||
/* eslint-disable accessor-pairs */
|
||||
const {container} = props;
|
||||
Object.defineProperty(container, 'offsetWidth', {get: () => this.width});
|
||||
Object.defineProperty(container, 'clientWidth', {get: () => this.width});
|
||||
Object.defineProperty(container, 'offsetWidth', {
|
||||
configurable: true,
|
||||
get: () => this.width
|
||||
});
|
||||
Object.defineProperty(container, 'clientWidth', {
|
||||
configurable: true,
|
||||
get: () => this.width
|
||||
});
|
||||
Object.defineProperty(container, 'offsetHeight', {
|
||||
configurable: true,
|
||||
get: () => this.height
|
||||
});
|
||||
Object.defineProperty(container, 'clientHeight', {
|
||||
configurable: true,
|
||||
get: () => this.height
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user