@react-leaflet/core
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -7,4 +7,3 @@ import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react'; | ||
const { instance , context } = useElement(props).current; | ||
useImperativeHandle(forwardedRef, ()=>instance | ||
); | ||
useImperativeHandle(forwardedRef, ()=>instance); | ||
return props.children == null ? null : /*#__PURE__*/ React.createElement(LeafletProvider, { | ||
@@ -20,4 +19,3 @@ value: context | ||
const { instance } = useElement(props, setOpen).current; | ||
useImperativeHandle(forwardedRef, ()=>instance | ||
); | ||
useImperativeHandle(forwardedRef, ()=>instance); | ||
useEffect(function updateOverlay() { | ||
@@ -41,4 +39,3 @@ if (isOpen) { | ||
const { instance } = useElement(props).current; | ||
useImperativeHandle(forwardedRef, ()=>instance | ||
); | ||
useImperativeHandle(forwardedRef, ()=>instance); | ||
return null; | ||
@@ -45,0 +42,0 @@ } |
@@ -0,1 +1,2 @@ | ||
/// <reference types="react" /> | ||
import type { Control, Layer, LayerGroup, Map } from 'leaflet'; | ||
@@ -2,0 +3,0 @@ export declare const CONTEXT_VERSION = 1; |
@@ -12,7 +12,10 @@ import { useEffect, useRef } from 'react'; | ||
return function useImmutableLeafletElement(props, context) { | ||
return useRef(createElement(props, context)); | ||
const elementRef = useRef(); | ||
if (!elementRef.current) elementRef.current = createElement(props, context); | ||
return elementRef; | ||
}; | ||
} | ||
return function useMutableLeafletElement(props, context) { | ||
const elementRef = useRef(createElement(props, context)); | ||
const elementRef = useRef(); | ||
if (!elementRef.current) elementRef.current = createElement(props, context); | ||
const propsRef = useRef(props); | ||
@@ -19,0 +22,0 @@ const { instance } = elementRef.current; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="react" /> | ||
import type { Control, ControlOptions, FeatureGroup, Layer, Path } from 'leaflet'; | ||
@@ -2,0 +3,0 @@ import { type PropsWithChildren } from './component.js'; |
{ | ||
"name": "@react-leaflet/core", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "React Leaflet core", | ||
@@ -31,14 +31,2 @@ "repository": { | ||
"sideEffects": false, | ||
"scripts": { | ||
"build:clean": "del lib", | ||
"build:js": "swc src -d ./lib --config-file ../../.swcrc", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"build": "yarn run build:clean && yarn run build:types && yarn run build:js", | ||
"test:types": "tsc --noEmit", | ||
"test:unit": "cross-env NODE_ENV=test jest", | ||
"test": "yarn run test:types && yarn run test:unit", | ||
"start": "yarn run test && yarn run build", | ||
"prepare": "yarn run build", | ||
"prepublishOnly": "package-check" | ||
}, | ||
"peerDependencies": { | ||
@@ -49,2 +37,6 @@ "leaflet": "^1.8.0", | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.17", | ||
"@types/react-dom": "^18.0.6" | ||
}, | ||
"jest": { | ||
@@ -65,3 +57,13 @@ "extensionsToTreatAsEsm": [ | ||
} | ||
}, | ||
"scripts": { | ||
"build:clean": "del lib", | ||
"build:js": "swc src -d ./lib --config-file ../../.swcrc", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"build": "pnpm run build:clean && pnpm run build:types && pnpm run build:js", | ||
"test:types": "tsc --noEmit", | ||
"test:unit": "cross-env NODE_ENV=test jest", | ||
"test": "pnpm run test:types && pnpm run test:unit", | ||
"start": "pnpm run test && pnpm run build" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34878
497
2