我的本机应用程序中的最新版本 @ turf / turf 出现问题
“ react-native”:“ 0.58.0”,
“ @ turf / turf”:“ ^ 5.1.6”
我只是在README.md中遵循了相同的示例,但是它不再对我有用。
问题是当我像这样导入草皮时
import * as turf from '@turf/turf';
在这里写函数
handleNearby = () => {
const { region, providers } = this.state;
let currentPoint = [region.longitude, region.latitude]
let points = _.map(providers, p => {
console.log('@p', p);
const to = [p.coordinates.longitude, p.coordinates.latitude];
const distance = turf.distance(currentPoint, to, { units: 'kilometers' });
return { coords: p.coordinates, name: p.username, id: p.id, distance }
});
const sortPoints = _.sortBy(points, ['distance']);
this.setState({ sortedMarkers: sortPoints });
console.log('@#points', sortPoints);
return;
}
并运行我遇到此错误的应用
attempting to a configurable attribute of a configurable property
但是当我在浏览器上运行调试器时,该应用程序运行良好, 不知道为什么!有帮助吗?