Skip to content

Commit

Permalink
fix(StyleLoadFinish): 解决样式加载完子组件不渲染
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Jan 26, 2024
1 parent 58721db commit dd28301
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/StyleLoadFinish/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useRef, useEffect, useState } from 'react';
import { isFunction } from '@pansy/shared';
import { useMap } from '../../hooks/useMap';
import { isStyleLoaded } from '../../utils/isStyleLoaded';

/**
* finish: 样式是否加载完成
Expand Down Expand Up @@ -58,6 +59,12 @@ export const StyleLoadFinish = (props: StyleLoadFinishProps) => {

useEffect(() => {
if (map) {
if (isStyleLoaded(map)) {
themeStatus.current = [0, 3, 1];
checkStylePassRef.current = 1;
forceUpdate();
themeStatus.current = [0, 0, 0];
}
map.on('styledataloading', handleStyleLoading);
map.on('styledata', handleStyleData);
map.on('style.load', handleStyleLoad);
Expand Down

0 comments on commit dd28301

Please sign in to comment.