alibaba / alibaba/flutter_boost
iOS 中 popUntil没有考虑native的情况
- Dominant language
- Dart
- Stars
- 7.2k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
native1 -> fluuter1 -> native2-> fluuter2 -> native3 -> fluuter3 -> native4 -> fluuter4
然后 popUntil 到 fluuter1 会有问题,从源码中看。一共执行了执行了 3 次 nativeRouterApi.popRoute 操作。但是这三次操作只能pop到 native3 。
即便是更改了 BoostDelegate 中 popRoute 的实现,来判断 navigationController.viewControllers 中的 element 是否是flutter还是native,但是 native2 根本没办法判断,因为 native2 的pop没有调用
BOOL popDid = NO;
FBFlutterViewContainer *fbVC = self.navigationController.viewControllers.lastObject;
if ([fbVC isKindOfClass:FBFlutterViewContainer.class] && [fbVC.name isEqualToString:options.pageName]) {
[self.navigationController popViewControllerAnimated:animated];
popDid = YES;
}
if (popDid == NO) {
NSArray *tempVcs = self.navigationController.viewControllers;
for (long i = tempVcs.count-1; i>=0; i--) {
FBFlutterViewContainer *fbVC = tempVcs[i];
if ([fbVC isKindOfClass:FBFlutterViewContainer.class] && [fbVC.name isEqualToString:options.pageName]) {
[self.navigationController popViewControllerAnimated:animated];
break;
} else {
[self.navigationController popViewControllerAnimated:NO];
}
}
}
如果想实现完全的 popUntil 方法,需要在 targetContainer?.navigator?.popUntil(ModalRoute.withName(targetPage.name))); 前调用 nativeRouterApi.popRoute 并添加特殊参数来区分popUntil。或者 调用 nativeRouterApi.popUntil 了,这种情况下需要添加 popUntil 桥接
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing BoostDelegate, nativeRouterApi.popRoute, and the iOS navigationController.viewControllers handling described in the issue. Compare that flow with targetContainer?.navigator?.popUntil(ModalRoute.withName(targetPage.name)) and the proposed nativeRouterApi.popUntil bridge; done means popUntil reaches the requested Flutter route across interleaved native and Flutter containers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, ios, objective-c
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100