我有一个使用这种方法的组件:
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 bundle 时,我检查了输出文件,它仍然有我删除的那两行。是否有缓存或剩余的东西?
我的包命令行:
react-native bundle --dev true --entry-file index.ios.js --bundle-output ios/main.jsbundle --verbose --platform ios
我正在使用 react-native 0.16.0
最佳答案
好的,我发现,这个包使用了打包器的缓存版本。我通过这样做删除了它:
rm -f $TMPDIR/react-packager*
然后我重新运行 bundle 命令,它工作正常。
关于javascript - 未考虑 React native 包更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34611918/