-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from susonthapa/feat/add-full-screen-support
added full screen support on CarPlay Map template
- Loading branch information
Showing
4 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/react-native-carplay/ios/RNCarPlayViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// | ||
// RNCarPlayViewController.h | ||
// Created by Susan Thapa on 27/02/2024. | ||
// | ||
#import <UIKit/UIKit.h> | ||
#import <React/RCTRootView.h> | ||
|
||
@interface RNCarPlayViewController : UIViewController | ||
- (instancetype)initWithRootView:(RCTRootView *)rootView; | ||
@end |
50 changes: 50 additions & 0 deletions
50
packages/react-native-carplay/ios/RNCarPlayViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// RNCarPlayViewController.m | ||
// react-native-carplay | ||
// | ||
// Created by Susan Thapa on 27/02/2024. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "RNCarPlayViewController.h" | ||
#import <React/RCTRootView.h> | ||
|
||
@interface RNCarPlayViewController () | ||
|
||
@property (nonatomic, strong) RCTRootView *rootView; | ||
|
||
@end | ||
|
||
@implementation RNCarPlayViewController | ||
|
||
- (instancetype)initWithRootView:(RCTRootView *)rootView { | ||
self = [super init]; | ||
if (self) { | ||
_rootView = rootView; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
self.view.translatesAutoresizingMaskIntoConstraints = false; | ||
if (self.rootView) { | ||
self.rootView.translatesAutoresizingMaskIntoConstraints = false; | ||
self.rootView.frame = self.view.bounds; | ||
[self.view addSubview:self.rootView]; | ||
|
||
[NSLayoutConstraint activateConstraints:@[ | ||
[self.rootView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor], | ||
[self.rootView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor], | ||
[self.rootView.topAnchor constraintEqualToAnchor:self.view.topAnchor], | ||
[self.rootView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor], | ||
]]; | ||
} | ||
} | ||
|
||
- (void)viewWillLayoutSubviews { | ||
[super viewWillLayoutSubviews]; | ||
self.rootView.frame = self.view.bounds; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters