Reactjs 多边形填充颜色工作不正常(反应本机贴图)
我在iOS上使用谷歌地图,我有多边形。(本地地图) 在更新之前(到版本0.18.3。-目前我无法更新到最新版本),一切正常,但从现在起填充颜色会得到奇怪的结果 有时颜色还可以,有时颜色不合适,没有规则 在android上,一切都很好Reactjs 多边形填充颜色工作不正常(反应本机贴图),reactjs,google-maps,react-native,polygon,react-native-ios,Reactjs,Google Maps,React Native,Polygon,React Native Ios,我在iOS上使用谷歌地图,我有多边形。(本地地图) 在更新之前(到版本0.18.3。-目前我无法更新到最新版本),一切正常,但从现在起填充颜色会得到奇怪的结果 有时颜色还可以,有时颜色不合适,没有规则 在android上,一切都很好 export const Polygon = (props) => { return ( <MapView.Polygon coordinates={ props.selectedAreas }
export const Polygon = (props) => {
return (
<MapView.Polygon
coordinates={ props.selectedAreas }
fillColor={ props.fillColor }
strokeColor={ props.strokeColor }
/>
)
};
export const Polygon=(道具)=>{
返回(
)
};
使用来自
从“React”导入React;
从“react native maps”导入{Polygon};
函数CustomPolygon({onLayout,…props}){
const ref=React.useRef();
函数onlyOutpolyGon(){
如果(参考电流){
ref.current.setNativeProps({fillColor:props.fillColor});
}
//如果需要,请从道具中调用onLayout()
}
返回;
}
导出默认自定义多边形;
它不是很漂亮,但我想它将不得不这样做,直到上游的错误是固定的
import React from 'react';
import { Polygon } from 'react-native-maps';
function CustomPolygon({ onLayout, ...props }) {
const ref = React.useRef();
function onLayoutPolygon() {
if (ref.current) {
ref.current.setNativeProps({ fillColor: props.fillColor });
}
// call onLayout() from the props if you need it
}
return <Polygon ref={ref} onLayout={onLayoutPolygon} {...props} />;
}
export default CustomPolygon;