我有一个使用这种方法的组件:
onRegionChangeComplete = (region) => {
var mapHeight = windowHeight - 124;
var centerCircleLatitude = region.latitude + (mapHeight - windowWidth - (topSize * 2)) * (region.latitudeDelta / (2 * mapHeight));
var centerCircleLongitude = region.longitude;
RestaurantsActions.setRegion(radius, region.longitude, region.latitude, region.longitudeDelta, region.latitudeDelta, centerCircleLongitude, centerCircleLatitude, windowWidth, mapHeight);
this.setState({data: RestaurantsStore.filteredRestaurants()});
this.setState({isChanging : false});
this.setState({index : 0});
this.refs.carousel.goToPage(this.state.index, 'annotationPress');
}
我将上面的代码更改为删除最后两行:
onRegionChangeComplete = (region) => {
var mapHeight = windowHeight - 124;
var centerCircleLatitude = region.latitude + (mapHeight - windowWidth - (topSize * 2)) * (region.latitudeDelta / (2 * mapHeight));
var centerCircleLongitude = region.longitude;
RestaurantsActions.setRegion(radius, region.longitude, region.latitude, region.longitudeDelta, region.latitudeDelta, centerCircleLongitude, centerCircleLatitude, windowWidth, mapHeight);
this.setState({data: RestaurantsStore.filteredRestaurants()});
this.setState({isChanging : false});
}
运行react-native捆绑包时,我检查了输出文件,但仍然删除了这两行.是否有缓存或剩余的东西?
我的捆绑软件命令行:
react-native bundle --dev true --entry-file index.ios.js --bundle-output ios/main.jsbundle --verbose --platform ios
我正在使用本机0.16.0
解决方法:
好的,我发现捆绑软件使用了打包程序的缓存版本.我通过执行以下操作将其删除:
rm -f $TMPDIR/react-packager*
然后我重新运行了bundle命令,它运行良好.