Skip to content

Commit

Permalink
Remove NavigatorIOS
Browse files Browse the repository at this point in the history
Summary:
Legacy navigator impl. There are other alternatives that should be used instead.

Part of the slimmening effort as described here: react-native-community/discussions-and-proposals#6

Reviewed By: TheSavior

Differential Revision: D9677824

fbshipit-source-id: 24ae500751d2a8c398f246d36604a58f0b3c113b
fkgozali authored and facebook-github-bot committed Sep 7, 2018
1 parent 9e63b5c commit 0df92af
Showing 17 changed files with 7 additions and 2,580 deletions.
12 changes: 0 additions & 12 deletions Libraries/Components/Navigation/NavigatorIOS.android.js

This file was deleted.

932 changes: 0 additions & 932 deletions Libraries/Components/Navigation/NavigatorIOS.ios.js

This file was deleted.

10 changes: 7 additions & 3 deletions Libraries/react-native/react-native-implementation.js
Original file line number Diff line number Diff line change
@@ -66,9 +66,6 @@ const ReactNative = {
get Modal() {
return require('Modal');
},
get NavigatorIOS() {
return require('NavigatorIOS');
},
get Picker() {
return require('Picker');
},
@@ -325,6 +322,13 @@ const ReactNative = {
'Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html',
);
},
get NavigatorIOS() {
invariant(
false,
'NavigatorIOS is deprecated and has been removed from this package. ' +
'Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html',
);
},
};

module.exports = ReactNative;
84 changes: 0 additions & 84 deletions RNTester/js/NavigatorIOSBarStyleExample.js

This file was deleted.

75 changes: 0 additions & 75 deletions RNTester/js/NavigatorIOSColorsExample.js

This file was deleted.

303 changes: 0 additions & 303 deletions RNTester/js/NavigatorIOSExample.js

This file was deleted.

15 changes: 0 additions & 15 deletions RNTester/js/RNTesterList.ios.js
Original file line number Diff line number Diff line change
@@ -92,21 +92,6 @@ const ComponentExamples: Array<RNTesterExample> = [
module: require('./MultiColumnExample'),
supportsTVOS: true,
},
{
key: 'NavigatorIOSColorsExample',
module: require('./NavigatorIOSColorsExample'),
supportsTVOS: false,
},
{
key: 'NavigatorIOSBarStyleExample',
module: require('./NavigatorIOSBarStyleExample'),
supportsTVOS: false,
},
{
key: 'NavigatorIOSExample',
module: require('./NavigatorIOSExample'),
supportsTVOS: true,
},
{
key: 'PickerExample',
module: require('./PickerExample'),
42 changes: 0 additions & 42 deletions React/Views/RCTNavItem.h

This file was deleted.

174 changes: 0 additions & 174 deletions React/Views/RCTNavItem.m

This file was deleted.

19 changes: 0 additions & 19 deletions React/Views/RCTNavItemManager.h

This file was deleted.

80 changes: 0 additions & 80 deletions React/Views/RCTNavItemManager.m

This file was deleted.

34 changes: 0 additions & 34 deletions React/Views/RCTNavigator.h

This file was deleted.

630 changes: 0 additions & 630 deletions React/Views/RCTNavigator.m

This file was deleted.

12 changes: 0 additions & 12 deletions React/Views/RCTNavigatorManager.h

This file was deleted.

83 changes: 0 additions & 83 deletions React/Views/RCTNavigatorManager.m

This file was deleted.

12 changes: 0 additions & 12 deletions React/Views/RCTWrapperViewController.h
Original file line number Diff line number Diff line change
@@ -7,22 +7,10 @@

#import <UIKit/UIKit.h>

@class RCTNavItem;
@class RCTWrapperViewController;

@protocol RCTWrapperViewControllerNavigationListener <NSObject>

- (void)wrapperViewController:(RCTWrapperViewController *)wrapperViewController
didMoveToNavigationController:(UINavigationController *)navigationController;

@end

@interface RCTWrapperViewController : UIViewController

- (instancetype)initWithContentView:(UIView *)contentView NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithNavItem:(RCTNavItem *)navItem;

@property (nonatomic, weak) id<RCTWrapperViewControllerNavigationListener> navigationListener;
@property (nonatomic, strong) RCTNavItem *navItem;

@end
70 changes: 0 additions & 70 deletions React/Views/RCTWrapperViewController.m
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@
#import <UIKit/UIScrollView.h>

#import "RCTEventDispatcher.h"
#import "RCTNavItem.h"
#import "RCTUtils.h"
#import "UIView+React.h"
#import "RCTAutoInsetsProtocol.h"
@@ -38,14 +37,6 @@ - (instancetype)initWithContentView:(UIView *)contentView
return self;
}

- (instancetype)initWithNavItem:(RCTNavItem *)navItem
{
if ((self = [self initWithContentView:navItem])) {
_navItem = navItem;
}
return self;
}

RCT_NOT_IMPLEMENTED(- (instancetype)initWithNibName:(NSString *)nn bundle:(NSBundle *)nb)
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)

@@ -83,55 +74,6 @@ - (void)viewDidLayoutSubviews
}
}

static UIView *RCTFindNavBarShadowViewInView(UIView *view)
{
if ([view isKindOfClass:[UIImageView class]] && view.bounds.size.height <= 1) {
return view;
}
for (UIView *subview in view.subviews) {
UIView *shadowView = RCTFindNavBarShadowViewInView(subview);
if (shadowView) {
return shadowView;
}
}
return nil;
}

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

// TODO: find a way to make this less-tightly coupled to navigation controller
if ([self.parentViewController isKindOfClass:[UINavigationController class]])
{
[self.navigationController
setNavigationBarHidden:_navItem.navigationBarHidden
animated:animated];

UINavigationBar *bar = self.navigationController.navigationBar;
bar.barTintColor = _navItem.barTintColor;
bar.tintColor = _navItem.tintColor;
bar.translucent = _navItem.translucent;
#if !TARGET_OS_TV
bar.barStyle = _navItem.barStyle;
#endif
bar.titleTextAttributes = _navItem.titleTextColor ? @{
NSForegroundColorAttributeName: _navItem.titleTextColor
} : nil;

RCTFindNavBarShadowViewInView(bar).hidden = _navItem.shadowHidden;

UINavigationItem *item = self.navigationItem;
item.title = _navItem.title;
item.titleView = _navItem.titleImageView;
#if !TARGET_OS_TV
item.backBarButtonItem = _navItem.backButtonItem;
#endif //TARGET_OS_TV
item.leftBarButtonItem = _navItem.leftButtonItem;
item.rightBarButtonItem = _navItem.rightButtonItem;
}
}

- (void)loadView
{
// Add a wrapper so that the wrapper view managed by the
@@ -142,16 +84,4 @@ - (void)loadView
self.view = _wrapperView;
}

- (void)didMoveToParentViewController:(UIViewController *)parent
{
// There's no clear setter for navigation controllers, but did move to parent
// view controller provides the desired effect. This is called after a pop
// finishes, be it a swipe to go back or a standard tap on the back button
[super didMoveToParentViewController:parent];
if (parent == nil || [parent isKindOfClass:[UINavigationController class]]) {
[self.navigationListener wrapperViewController:self
didMoveToNavigationController:(UINavigationController *)parent];
}
}

@end

1 comment on commit 0df92af

@janicduplessis
Copy link
Contributor

@janicduplessis janicduplessis commented on 0df92af Sep 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 RIP

Please sign in to comment.