Skip to content

Commit c227e35

Browse files
React 19 support (#362)
* Bump react and @types/react Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) and [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react). These dependencies needed to be updated together. Updates `react` from 18.3.1 to 19.0.0 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.0.0/packages/react) Updates `@types/react` from 18.3.8 to 19.0.8 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: react dependency-type: direct:development update-type: version-update:semver-major - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * add React 19 * update the changelog * drop the explicit context * leave React to set the context and delay init * fix all types in the examples --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Momtchil Momtchev <momtchil@momtchev.com>
1 parent 0e6c337 commit c227e35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+309
-286
lines changed

.github/workflows/node.js.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
with:
4141
node-version: 20.x
4242
- run: |
43-
npm i react@18 react-dom@18 react-test-renderer@18 @types/react@18 @types/react-dom@18 @testing-library/react@13
43+
npm i react@18 react-dom@18 react-test-renderer@18 \
44+
@types/react@18 @types/react-dom@18 @testing-library/react@13 \
45+
react-router@7.0.2
4446
- run: npm i
4547
- run: tsc
4648
- run: npm test
@@ -57,7 +59,9 @@ jobs:
5759
with:
5860
node-version: 20.x
5961
- run: |
60-
npm i react@18.1 react-dom@18.1 react-test-renderer@18.1 @types/react@18 @types/react-dom@18 @testing-library/react@13
62+
npm i react@18.1 react-dom@18.1 react-test-renderer@18.1 \
63+
@types/react@18 @types/react-dom@18 @testing-library/react@13 \
64+
react-router@7.0.2
6165
- run: npm i
6266
- run: tsc
6367
- run: npm test
@@ -74,7 +78,9 @@ jobs:
7478
with:
7579
node-version: 20.x
7680
- run: |
77-
npm i react@18.2 react-dom@18.2 react-test-renderer@18.2 @types/react@18 @types/react-dom@18 @testing-library/react@13
81+
npm i react@18.2 react-dom@18.2 react-test-renderer@18.2 \
82+
@types/react@18 @types/react-dom@18 @testing-library/react@13 \
83+
react-router@7.0.2
7884
- run: npm i
7985
- run: tsc
8086
- run: npm test
@@ -91,7 +97,28 @@ jobs:
9197
with:
9298
node-version: 20.x
9399
- run: |
94-
npm i react@18.3.1 react-dom@18.3.1 react-test-renderer@18.3.1 @types/react@18.3.2 @types/react-dom@18.0.5 @testing-library/react@15.0.7
100+
npm i react@18.3.1 react-dom@18.3.1 react-test-renderer@18.3.1 \
101+
@types/react@18.3.2 @types/react-dom@18.0.5 @testing-library/react@15.0.7 \
102+
react-router@7.0.2
103+
- run: npm i
104+
- run: tsc
105+
- run: npm test
106+
- run: npm run build:examples
107+
108+
react-19:
109+
runs-on: ubuntu-latest
110+
111+
steps:
112+
- run: echo "::add-mask::${{ secrets.STADIA_MAPS_API_KEY }}"
113+
- uses: actions/checkout@v4
114+
- name: Use Node.js 20.x
115+
uses: actions/setup-node@v4
116+
with:
117+
node-version: 20.x
118+
- run: |
119+
npm i react@19 react-dom@19 react-test-renderer@19 \
120+
@types/react@19 @types/react-dom@19 @testing-library/react@16.2.0 \
121+
react-router@7.1.5
95122
- run: npm i
96123
- run: tsc
97124
- run: npm test

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.2.0] 2025-02-01
9+
10+
- React 19 support
11+
812
### [3.3.1] 2025-01-10
913

1014
- Fix `RLayerVectorImage` in OpenLayers 10.3.1

examples/Add-Delete.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, {JSX} from 'react';
22
import {fromLonLat} from 'ol/proj';
33
import {Point} from 'ol/geom';
44
import {Feature} from 'ol';
@@ -30,7 +30,7 @@ export default function Interactions(): JSX.Element {
3030
})
3131
)
3232
);
33-
const vectorRef = React.useRef() as React.RefObject<RLayerVector>;
33+
const vectorRef = React.useRef(null) as React.RefObject<RLayerVector>;
3434
return (
3535
<React.Fragment>
3636
<RMap

examples/Addon.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* This example shows how to extend RLayers to include support for your custom component
33
*/
44

5-
import React from 'react';
5+
import React, {JSX} from 'react';
66
import {fromLonLat} from 'ol/proj';
77
import {MapboxVectorLayer as VectorMapbox} from 'ol-mapbox-style';
88

9-
import {RMap, RLayer, RLayerProps, RContextType} from 'rlayers';
9+
import {RMap, RLayer, RLayerProps} from 'rlayers';
1010

1111
/**
1212
* The properties interface definition
@@ -25,9 +25,9 @@ class MyLayerMapbox extends RLayer<MyLayerMapboxProps> {
2525
// Tiled layers must extend RLayerRaster, non-tiled vector layers must extend RLayerVector
2626
// This allows you to have the same features as RLayers built-in components
2727
// Completely custom layers must extend RLayer
28-
constructor(props: Readonly<MyLayerMapboxProps>, context?: React.Context<RContextType>) {
28+
constructor(props: Readonly<MyLayerMapboxProps>) {
2929
// You must call the parent constructor
30-
super(props, context);
30+
super(props);
3131

3232
// You must create the this.ol object which must be compatible with the this.ol of the parent
3333
this.ol = new VectorMapbox({

examples/AnimatedOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, {JSX} from 'react';
22
import {fromLonLat} from 'ol/proj';
33
import {Coordinate} from 'ol/coordinate';
44
import {Point} from 'ol/geom';

examples/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import 'bootstrap/dist/css/bootstrap.min.css';
33
import './example.css';
44
import './ghp.css';
5-
import React from 'react';
5+
import React, {JSX} from 'react';
66
import {HashRouter as Router, Routes, Route, Link} from 'react-router-dom';
77
import {VERSION as OL_VERSION} from 'ol';
88
import semver from 'semver';

examples/Cluster.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useCallback} from 'react';
1+
import React, {JSX, useCallback} from 'react';
22
import {fromLonLat} from 'ol/proj';
33
import GeoJSON from 'ol/format/GeoJSON';
44
import {createEmpty, extend, getHeight, getWidth} from 'ol/extent';
@@ -32,7 +32,7 @@ const extentFeatures = (features, resolution) => {
3232
export default function Cluster(): JSX.Element {
3333
const [distance, setDistance] = React.useState(20);
3434
const [selected, setSelected] = React.useState<string>('Click a cluster for details');
35-
const earthquakeLayer = React.useRef();
35+
const earthquakeLayer = React.useRef(null);
3636
return (
3737
<React.Fragment>
3838
<RMap className='example-map' initial={{center: fromLonLat([0, 0]), zoom: 1}}>

examples/CodePenButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const CodePenButton = React.memo(function CodePenButton(props: {
5353
});
5454
}, [props.text]);
5555

56-
const ref = React.useRef<HTMLFormElement>();
56+
const ref = React.useRef<HTMLFormElement>(null);
5757

5858
if (text && text.match(/in CodePen/)) return null;
5959
return (

examples/Controls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useCallback} from 'react';
1+
import React, {JSX, useCallback} from 'react';
22
import {MapBrowserEvent} from 'ol';
33
import {fromLonLat, toLonLat} from 'ol/proj';
44
import 'ol/ol.css';

examples/Draw.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, {JSX} from 'react';
22
import {fromLonLat} from 'ol/proj';
33
import {
44
altShiftKeysOnly,

0 commit comments

Comments
 (0)