maplibre-react-native icon indicating copy to clipboard operation
maplibre-react-native copied to clipboard

Maplibre 9.1.0 "Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead."

Open MufeedaFi opened this issue 1 year ago • 0 comments

I have been using "@maplibre/maplibre-react-native": "9.1.0", in my react native "0.74.2" project. But MapLibreGL is giving some internal error warnings as below, while using these components.

<MapLibreGL.Camera/> as Warning: Component "Camera" contains the string ref "camera". Support for string refs will be removed in a future major release.

<MapLibreGL.SymbolLayer/> as Warning: Component "SymbolLayer" contains the string ref "nativeLayer". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead.

<MapLibreGL.LineLayer/> as Warning: Component "LineLayer" contains the string ref "nativeLayer". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead.

<MapLibreGL.FillLayer/> as Warning: Component "FillLayer" contains the string ref "nativeLayer". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead.

The issue is fixed with a patch on each of these components as found in https://stackoverflow.com/questions/63295481/error-function-components-cannot-have-string-refs-we-recommend-using-useref. ie, replacing the internal string refs with createRef().

Please maintain this in the repo, since patching is not a pretty solution. Thanks!

MufeedaFi avatar Jul 30 '24 10:07 MufeedaFi