代码跟踪
- AMapView.m 文件下
2. 会执行到此。container 和 originalSuperview 都是 MapView
react-native 会先删除后,再加入到视图中。导致删除失效
// Hack: At this moment we have two contradict intents.
// First one: We want to delete the view from view hierarchy.
// Second one: We want to animate this view, which implies the existence of this view in the hierarchy.
// So, we have to remove this view from React's view hierarchy but postpone removing from UIKit's hierarchy.
// Here the problem: the default implementation of `-[UIView removeReactSubview:]` also removes the view from
// UIKit's hierarchy. So, let's temporary restore the view back after removing. To do so, we have to memorize
// original `superview` (which can differ from `container`) and an index of removed view.
- 执行上面的原因是 react-native 设置删除动画时,会执行此方法
暂时性解决方案:
LayoutAnimation.configureNext({
delete: undefined,
});