React本机包更改未考虑在内

时间:2016-01-05 12:38:03

标签: javascript bundle react-native

我有一个使用此方法的Component:

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

1 个答案:

答案 0 :(得分:4)

好的,我发现,捆绑包使用了打包器的缓存版本。我删除了它:

rm -f $TMPDIR/react-packager*

然后我重新运行了bundle命令,它工作正常。