BLUE
PHP 7.4.33
Path:
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/@react-google-maps/api/src/components/maps
Run
Logout
Edit File
Size: 2.50 KB
Close
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/@react-google-maps/api/src/components/maps/BicyclingLayer.tsx
Text
Base64
import { memo, useState, useEffect, useContext, PureComponent, type ContextType, } from 'react' import MapContext from '../../map-context.js' type BicyclingLayerState = { bicyclingLayer: google.maps.BicyclingLayer | null } export type BicyclingLayerProps = { /** This callback is called when the bicyclingLayer instance has loaded. It is called with the bicyclingLayer instance. */ onLoad?: ((bicyclingLayer: google.maps.BicyclingLayer) => void) | undefined /** This callback is called when the component unmounts. It is called with the bicyclingLayer instance. */ onUnmount?: ((bicyclingLayer: google.maps.BicyclingLayer) => void) | undefined } function BicyclingLayerFunctional({ onLoad, onUnmount, }: BicyclingLayerProps): null { const map = useContext<google.maps.Map | null>(MapContext) const [instance, setInstance] = useState<google.maps.BicyclingLayer | null>( null ) // Order does matter useEffect(() => { if (instance !== null) { instance.setMap(map) } }, [map]) useEffect(() => { const bicyclingLayer = new google.maps.BicyclingLayer() setInstance(bicyclingLayer) bicyclingLayer.setMap(map) if (onLoad) { onLoad(bicyclingLayer) } return () => { if (bicyclingLayer !== null) { if (onUnmount) { onUnmount(bicyclingLayer) } bicyclingLayer.setMap(null) } } }, []) return null } export const BicyclingLayerF = memo(BicyclingLayerFunctional) export class BicyclingLayer extends PureComponent< BicyclingLayerProps, BicyclingLayerState > { static override contextType = MapContext declare context: ContextType<typeof MapContext> override state: BicyclingLayerState = { bicyclingLayer: null, } override componentDidMount(): void { const bicyclingLayer = new google.maps.BicyclingLayer() this.setState(() => { return { bicyclingLayer, } }, this.setBicyclingLayerCallback) } override componentWillUnmount(): void { if (this.state.bicyclingLayer !== null) { if (this.props.onUnmount) { this.props.onUnmount(this.state.bicyclingLayer) } this.state.bicyclingLayer.setMap(null) } } setBicyclingLayerCallback = (): void => { if (this.state.bicyclingLayer !== null) { this.state.bicyclingLayer.setMap(this.context) if (this.props.onLoad) { this.props.onLoad(this.state.bicyclingLayer) } } } override render(): null { return null } } export default BicyclingLayer
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
BicyclingLayer.md
679 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BicyclingLayer.tsx
2.50 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TrafficLayer.md
669 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TrafficLayer.tsx
3.53 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TransitLayer.md
663 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TransitLayer.tsx
2.43 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).