@uiw/react-amap-utils
Advanced tools
Comparing version 6.0.5 to 7.0.0
@@ -12,5 +12,8 @@ "use strict"; | ||
var _reactDom = require("react-dom"); | ||
var _client = require("react-dom/client"); | ||
var usePortal = exports.usePortal = function usePortal() { | ||
var ref = (0, _react.useRef)(); | ||
var _React$useState = _react["default"].useState(function () { | ||
var el = document.createElement('div'); | ||
ref.current = (0, _client.createRoot)(el); | ||
return el; | ||
@@ -38,3 +41,4 @@ }), | ||
var remove = function remove(elm) { | ||
elm && (0, _reactDom.unmountComponentAtNode)(elm); | ||
var _ref$current; | ||
elm && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.unmount()); | ||
}; | ||
@@ -41,0 +45,0 @@ return { |
@@ -1,6 +0,9 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { createPortal, unmountComponentAtNode } from 'react-dom'; | ||
import React, { useState, useEffect, useRef } from 'react'; | ||
import { createPortal } from 'react-dom'; | ||
import { createRoot } from 'react-dom/client'; | ||
export var usePortal = () => { | ||
var ref = useRef(); | ||
var [container] = React.useState(() => { | ||
var el = document.createElement('div'); | ||
ref.current = createRoot(el); | ||
return el; | ||
@@ -21,3 +24,4 @@ }); | ||
var remove = elm => { | ||
elm && unmountComponentAtNode(elm); | ||
var _ref$current; | ||
elm && ((_ref$current = ref.current) == null ? void 0 : _ref$current.unmount()); | ||
}; | ||
@@ -24,0 +28,0 @@ return { |
{ | ||
"name": "@uiw/react-amap-utils", | ||
"version": "6.0.5", | ||
"version": "7.0.0", | ||
"description": "基于 React 封装的高德地图组件。AMap Component Based On React.", | ||
@@ -33,8 +33,8 @@ "funding": "https://jaywcjlove.github.io/#/sponsor", | ||
"peerDependencies": { | ||
"react": ">=16.14.0", | ||
"react-dom": ">=16.14.0" | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
}, | ||
"dependencies": { | ||
"@uiw/react-amap-types": "6.0.5" | ||
"@uiw/react-amap-types": "7.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
26277
760
+ Added@uiw/react-amap-types@7.0.0(transitive)
- Removed@uiw/react-amap-types@6.0.5(transitive)
Updated@uiw/react-amap-types@7.0.0