Skip to content

Commit da3e980

Browse files
committed
documentation update
1 parent bb6ccd5 commit da3e980

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

ios/StackControllerDelegate.mm

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,27 @@ - (instancetype)initWithEventEmitter:(RNNEventEmitter *)eventEmitter {
2626
- (void)navigationController:(UINavigationController *)navigationController
2727
willShowViewController:(UIViewController *)viewController
2828
animated:(BOOL)animated {
29-
if (_presentedViewController &&
30-
![navigationController.viewControllers containsObject:_presentedViewController]) {
31-
_isPopping = YES;
32-
}
33-
34-
id<UIViewControllerTransitionCoordinator> coordinator = navigationController.transitionCoordinator;
35-
if (coordinator && coordinator.isInteractive) {
36-
UIViewController *poppingViewController = _presentedViewController;
37-
[coordinator notifyWhenInteractionChangesUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
38-
if (!context.isCancelled) {
39-
if ([poppingViewController conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
40-
UIViewController<RNNLayoutProtocol> *rnnVC = (UIViewController<RNNLayoutProtocol> *)poppingViewController;
41-
if ([rnnVC.options.navigationButtonEventOnSwipeBack withDefault:NO]) {
42-
NSString *buttonId = [rnnVC.options.topBar.backButton.identifier withDefault:@"RNN.back"];
43-
[self->_eventEmitter sendOnNavigationButtonPressed:rnnVC.layoutInfo.componentId
44-
buttonId:buttonId];
29+
if (_presentedViewController) {
30+
if (![navigationController.viewControllers containsObject:_presentedViewController]) {
31+
_isPopping = YES;
32+
}
33+
34+
id<UIViewControllerTransitionCoordinator> coordinator = navigationController.transitionCoordinator;
35+
if (coordinator && coordinator.isInteractive) {
36+
UIViewController *poppingViewController = _presentedViewController;
37+
[coordinator notifyWhenInteractionChangesUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
38+
if (!context.isCancelled) {
39+
if ([poppingViewController conformsToProtocol:@protocol(RNNLayoutProtocol)]) {
40+
UIViewController<RNNLayoutProtocol> *rnnVC = (UIViewController<RNNLayoutProtocol> *)poppingViewController;
41+
if ([rnnVC.options.navigationButtonEventOnSwipeBack withDefault:NO]) {
42+
NSString *buttonId = [rnnVC.options.topBar.backButton.identifier withDefault:@"RNN.back"];
43+
[self->_eventEmitter sendOnNavigationButtonPressed:rnnVC.layoutInfo.componentId
44+
buttonId:buttonId];
45+
}
4546
}
4647
}
47-
}
48-
}];
48+
}];
49+
}
4950
}
5051
}
5152

website/docs/api/options-root.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ Enable or disable swipe back to pop gesture.
141141
| ------- | -------- | -------- |
142142
| boolean | No | iOS |
143143

144+
## `navigationButtonEventOnSwipeBack`
145+
146+
Enable NavigationButtonPressed event sending on Swipe-back on pushed VC.
147+
148+
| Type | Required | Platform | Default |
149+
| ------- | -------- | -------- | ------- |
150+
| boolean | No | iOS | false |
151+
144152
## `backgroundImage`
145153

146154
Background image of the screen.

0 commit comments

Comments
 (0)