react-native-tvos 0.73.6-2 → 0.73.6-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
15
  patch: 6,
16
- prerelease: '2',
16
+ prerelease: '3',
17
17
  };
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
26
  RCTVersionPatch: @(6),
27
- RCTVersionPrerelease: @"2",
27
+ RCTVersionPrerelease: @"3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -6,7 +6,9 @@
6
6
  */
7
7
 
8
8
  #import "RCTTVNavigationEventEmitter.h"
9
+ #if TARGET_OS_TV
9
10
  #import "RCTTVNavigationEventNotificationConstants.h"
11
+ #endif
10
12
 
11
13
  #import <FBReactNativeSpec/FBReactNativeSpec.h>
12
14
  #import "CoreModulesPlugins.h"
@@ -28,10 +30,12 @@ RCT_EXPORT_MODULE()
28
30
  - (instancetype)init
29
31
  {
30
32
  if (self = [super init]) {
33
+ #if TARGET_OS_TV
31
34
  [[NSNotificationCenter defaultCenter] addObserver:self
32
35
  selector:@selector(handleTVNavigationEventNotification:)
33
36
  name:RCTTVNavigationEventNotificationName
34
37
  object:nil];
38
+ #endif
35
39
  }
36
40
  return self;
37
41
  }
@@ -9,6 +9,10 @@
9
9
 
10
10
  @protocol RCTFabricModalHostViewControllerDelegate <NSObject>
11
11
  - (void)boundsDidChange:(CGRect)newBounds;
12
+ #if TARGET_OS_TV
13
+ - (void)enableEventHandlers;
14
+ - (void)disableEventHandlers;
15
+ #endif
12
16
  @end
13
17
 
14
18
  @interface RCTFabricModalHostViewController : UIViewController
@@ -42,18 +42,28 @@
42
42
  [_touchHandler attachToView:self.view];
43
43
  }
44
44
 
45
- #if !TARGET_OS_TV
46
- - (UIStatusBarStyle)preferredStatusBarStyle
47
- {
48
- return [RCTSharedApplication() statusBarStyle];
49
- }
50
-
51
45
  - (void)viewDidDisappear:(BOOL)animated
52
46
  {
53
47
  [super viewDidDisappear:animated];
54
48
  _lastViewBounds = CGRectZero;
55
49
  }
56
50
 
51
+ #if TARGET_OS_TV
52
+ - (void)viewDidAppear:(BOOL)animated
53
+ {
54
+ [self.delegate enableEventHandlers];
55
+ }
56
+
57
+ - (void)viewWillDisappear:(BOOL)animated
58
+ {
59
+ [self.delegate disableEventHandlers];
60
+ }
61
+ #else
62
+ - (UIStatusBarStyle)preferredStatusBarStyle
63
+ {
64
+ return [RCTSharedApplication() statusBarStyle];
65
+ }
66
+
57
67
  - (BOOL)prefersStatusBarHidden
58
68
  {
59
69
  return [RCTSharedApplication() isStatusBarHidden];
@@ -19,6 +19,10 @@
19
19
 
20
20
  #import "RCTFabricModalHostViewController.h"
21
21
 
22
+ #if TARGET_OS_TV
23
+ #import <React/RCTTVRemoteHandler.h>
24
+ #endif
25
+
22
26
  using namespace facebook::react;
23
27
 
24
28
  #if !TARGET_OS_TV
@@ -115,6 +119,10 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
115
119
  BOOL _shouldPresent;
116
120
  BOOL _isPresented;
117
121
  UIView *_modalContentsSnapshot;
122
+ #if TARGET_OS_TV
123
+ UITapGestureRecognizer *_menuButtonGestureRecognizer;
124
+ RCTTVRemoteHandler *_tvRemoteHandler;
125
+ #endif
118
126
  }
119
127
 
120
128
  - (instancetype)initWithFrame:(CGRect)frame
@@ -123,6 +131,11 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
123
131
  static const auto defaultProps = std::make_shared<const ModalHostViewProps>();
124
132
  _props = defaultProps;
125
133
  _shouldAnimatePresentation = YES;
134
+ #if TARGET_OS_TV
135
+ _menuButtonGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
136
+ action:@selector(menuButtonPressed)];
137
+ _menuButtonGestureRecognizer.allowedPressTypes = @[ @(UIPressTypeMenu) ];
138
+ #endif
126
139
 
127
140
  _isPresented = NO;
128
141
  }
@@ -130,6 +143,38 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
130
143
  return self;
131
144
  }
132
145
 
146
+ #if TARGET_OS_TV
147
+ - (void)menuButtonPressed {
148
+ UIView *snapshot = _modalContentsSnapshot;
149
+ [self.viewController.view addSubview:snapshot];
150
+ [self dismissViewController:self.viewController
151
+ animated:_shouldAnimatePresentation
152
+ completion:^{
153
+ [snapshot removeFromSuperview];
154
+ auto eventEmitter = [self modalEventEmitter];
155
+ if (eventEmitter) {
156
+ eventEmitter->onDismiss(ModalHostViewEventEmitter::OnDismiss{});
157
+ eventEmitter->onRequestClose(ModalHostViewEventEmitter::OnRequestClose{});
158
+ }
159
+ }];
160
+ }
161
+
162
+ - (void)enableEventHandlers
163
+ {
164
+ _tvRemoteHandler = [[RCTTVRemoteHandler alloc] initWithView:_viewController.view];
165
+ [_tvRemoteHandler disableTVMenuKey];
166
+
167
+ [_viewController.view addGestureRecognizer:_menuButtonGestureRecognizer];
168
+ }
169
+
170
+ - (void)disableEventHandlers
171
+ {
172
+ _tvRemoteHandler = nil;
173
+ [_viewController.view removeGestureRecognizer:_menuButtonGestureRecognizer];
174
+ }
175
+
176
+ #endif
177
+
133
178
  - (RCTFabricModalHostViewController *)viewController
134
179
  {
135
180
  if (!_viewController) {
@@ -11,7 +11,6 @@
11
11
  #import <React/RCTBridge+Private.h>
12
12
  #import <React/RCTConstants.h>
13
13
  #import <React/RCTScrollEvent.h>
14
- #import <React/RCTTVNavigationEventNotification.h>
15
14
 
16
15
  #import <react/renderer/components/scrollview/RCTComponentViewHelpers.h>
17
16
  #import <react/renderer/components/scrollview/ScrollViewComponentDescriptor.h>
@@ -26,7 +25,8 @@
26
25
  #import "RCTFabricComponentsPlugins.h"
27
26
 
28
27
  #if TARGET_OS_TV
29
- #import "RCTTVRemoteHandler.h"
28
+ #import <React/RCTTVRemoteHandler.h>
29
+ #import <React/RCTTVNavigationEventNotification.h>
30
30
  #endif
31
31
 
32
32
  using namespace facebook::react;
@@ -19,7 +19,9 @@
19
19
  #import <React/RCTLog.h>
20
20
 
21
21
  #import <React/RCTRootComponentView.h>
22
+ #if TARGET_OS_TV
22
23
  #import <React/RCTTVNavigationEventNotification.h>
24
+ #endif
23
25
 
24
26
  #import <react/renderer/components/view/ViewComponentDescriptor.h>
25
27
  #import <react/renderer/components/view/ViewEventEmitter.h>
@@ -34,6 +34,32 @@
34
34
  return self;
35
35
  }
36
36
 
37
+ - (void)viewDidAppear:(BOOL)animated
38
+ {
39
+ #if TARGET_OS_TV
40
+ [self.modalHostView enableEventHandlers];
41
+ #endif
42
+ }
43
+
44
+ - (void)viewWillDisappear:(BOOL)animated
45
+ {
46
+ #if TARGET_OS_TV
47
+ [self.modalHostView disableEventHandlers];
48
+ if (self.modalHostView.onRequestClose) {
49
+ self.modalHostView.onRequestClose(nil);
50
+ }
51
+ #endif
52
+ }
53
+
54
+ - (void)viewDidDisappear:(BOOL)animated
55
+ {
56
+ #if TARGET_OS_TV
57
+ if (self.modalHostView.onDismiss) {
58
+ self.modalHostView.onDismiss(nil);
59
+ }
60
+ #endif
61
+ }
62
+
37
63
  - (void)viewDidLayoutSubviews
38
64
  {
39
65
  [super viewDidLayoutSubviews];
@@ -12,7 +12,6 @@
12
12
  #import "RCTConvert.h"
13
13
  #import "RCTLog.h"
14
14
  #import "RCTScrollEvent.h"
15
- #import "RCTTVNavigationEventNotification.h"
16
15
  #import "RCTUIManager.h"
17
16
  #import "RCTUIManagerObserverCoordinator.h"
18
17
  #import "RCTUIManagerUtils.h"
@@ -23,6 +22,7 @@
23
22
 
24
23
  #if TARGET_OS_TV
25
24
  #import "RCTTVRemoteHandler.h"
25
+ #import "RCTTVNavigationEventNotification.h"
26
26
  #endif
27
27
 
28
28
  #if !TARGET_OS_TV
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.6-2
1
+ VERSION_NAME=0.73.6-3
2
2
 
3
3
  # react.internal.publishingGroup=com.facebook.react
4
4
  # For TV use this group
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 73,
20
20
  "patch", 6,
21
- "prerelease", "2");
21
+ "prerelease", "3");
22
22
  }
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 73;
20
20
  int32_t Patch = 6;
21
- std::string_view Prerelease = "2";
21
+ std::string_view Prerelease = "3";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.73.6-2",
3
+ "version": "0.73.6-3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -103,7 +103,7 @@
103
103
  "@react-native/gradle-plugin": "0.73.4",
104
104
  "@react-native/js-polyfills": "0.73.1",
105
105
  "@react-native/normalize-colors": "0.73.2",
106
- "@react-native-tvos/virtualized-lists": "0.73.6-2",
106
+ "@react-native-tvos/virtualized-lists": "0.73.6-3",
107
107
  "abort-controller": "^3.0.0",
108
108
  "anser": "^1.4.9",
109
109
  "ansi-regex": "^5.0.0",
@@ -1 +1 @@
1
- hermes-2024-03-01-RNv0.73.5-5e3ba8a5ff73efc46f4570492176b0605de77ed6
1
+ hermes-2024-04-19-RNv0.73.0-4f027b891c5e0a187dfd1a98ce80c3ec61dbc9c8
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "expo": "^50.0.2",
15
15
  "react": "18.2.0",
16
- "react-native": "npm:react-native-tvos@0.73.6-2"
16
+ "react-native": "npm:react-native-tvos@0.73.6-3"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@babel/core": "^7.20.0",