react-native-tvos 0.66.3-1 → 0.66.3-2

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.
Files changed (60) hide show
  1. package/Libraries/Components/AppleTV/TVFocusGuideView.js +30 -35
  2. package/Libraries/Components/AppleTV/TVViewPropTypes.js +0 -27
  3. package/Libraries/Components/Pressable/Pressable.js +2 -0
  4. package/Libraries/Components/View/ViewNativeComponent.js +6 -1
  5. package/Libraries/LogBox/UI/LogBoxButton.js +1 -0
  6. package/React/Base/RCTTVRemoteHandler.h +3 -0
  7. package/React/Base/RCTTVRemoteHandler.m +24 -0
  8. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +1 -1
  9. package/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h +9 -0
  10. package/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +18 -0
  11. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +4 -0
  12. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +416 -2
  13. package/React/Fabric/Mounting/RCTComponentViewFactory.mm +2 -0
  14. package/React/Views/RCTTVView.h +5 -0
  15. package/React/Views/RCTTVView.m +16 -0
  16. package/React/Views/RCTViewManager.m +17 -0
  17. package/ReactAndroid/gradle.properties +1 -1
  18. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +37 -73
  19. package/ReactCommon/react/renderer/components/view/ViewProps.cpp +28 -0
  20. package/ReactCommon/react/renderer/components/view/ViewProps.h +10 -0
  21. package/ReactCommon/react/renderer/components/view/primitives.h +34 -0
  22. package/ReactCommon/react/renderer/components/view/propsConversions.h +66 -0
  23. package/android/com/facebook/react/react-native/{0.66.3-1/react-native-0.66.3-1.aar → 0.66.3-2/react-native-0.66.3-2.aar} +0 -0
  24. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.aar.md5 +1 -0
  25. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.aar.sha1 +1 -0
  26. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.aar.sha256 +1 -0
  27. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.aar.sha512 +1 -0
  28. package/android/com/facebook/react/react-native/{0.66.3-1/react-native-0.66.3-1.module → 0.66.3-2/react-native-0.66.3-2.module} +16 -16
  29. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.module.md5 +1 -0
  30. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.module.sha1 +1 -0
  31. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.module.sha256 +1 -0
  32. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.module.sha512 +1 -0
  33. package/android/com/facebook/react/react-native/{0.66.3-1/react-native-0.66.3-1.pom → 0.66.3-2/react-native-0.66.3-2.pom} +1 -1
  34. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.pom.md5 +1 -0
  35. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.pom.sha1 +1 -0
  36. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.pom.sha256 +1 -0
  37. package/android/com/facebook/react/react-native/0.66.3-2/react-native-0.66.3-2.pom.sha512 +1 -0
  38. package/android/com/facebook/react/react-native/maven-metadata.xml +4 -4
  39. package/android/com/facebook/react/react-native/maven-metadata.xml.md5 +1 -1
  40. package/android/com/facebook/react/react-native/maven-metadata.xml.sha1 +1 -1
  41. package/android/com/facebook/react/react-native/maven-metadata.xml.sha256 +1 -1
  42. package/android/com/facebook/react/react-native/maven-metadata.xml.sha512 +1 -1
  43. package/package.json +2 -2
  44. package/template/package.json +1 -1
  45. package/React/Views/RCTTVFocusGuideView.h +0 -22
  46. package/React/Views/RCTTVFocusGuideView.m +0 -60
  47. package/React/Views/RCTTVFocusGuideViewManager.h +0 -12
  48. package/React/Views/RCTTVFocusGuideViewManager.m +0 -30
  49. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.aar.md5 +0 -1
  50. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.aar.sha1 +0 -1
  51. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.aar.sha256 +0 -1
  52. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.aar.sha512 +0 -1
  53. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.module.md5 +0 -1
  54. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.module.sha1 +0 -1
  55. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.module.sha256 +0 -1
  56. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.module.sha512 +0 -1
  57. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.pom.md5 +0 -1
  58. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.pom.sha1 +0 -1
  59. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.pom.sha256 +0 -1
  60. package/android/com/facebook/react/react-native/0.66.3-1/react-native-0.66.3-1.pom.sha512 +0 -1
@@ -8,10 +8,11 @@
8
8
  * @format
9
9
  */
10
10
 
11
- const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
12
11
  const React = require('react');
13
12
  const ReactNative = require('react-native');
13
+ import ReactNativeShims from '../../Renderer/shims/ReactNative';
14
14
  const Platform = require('../../Utilities/Platform');
15
+ import {Commands} from '../../Components/View/ViewNativeComponent';
15
16
  import type {ViewProps} from '../View/ViewPropTypes';
16
17
 
17
18
  type FocusGuideProps = $ReadOnly<{
@@ -23,26 +24,21 @@ type FocusGuideProps = $ReadOnly<{
23
24
  destinations: ?(Object[]),
24
25
  }>;
25
26
 
26
- class TVFocusGuideView extends React.Component<FocusGuideProps> {
27
- _focusGuideRef: ?Object;
28
- _destinationTags: ?(number[]);
27
+ const TVFocusGuideView = (props: FocusGuideProps) => {
28
+ const focusGuideRef = React.useRef(null);
29
29
 
30
- componentDidUpdate() {
31
- const destinations = this.props.destinations || [];
32
- this._destinationTags = destinations.map(
33
- c => ReactNative.findNodeHandle(c) || 0,
34
- );
35
- this._focusGuideRef &&
36
- this._focusGuideRef.setNativeProps({
37
- destinationTags: this._destinationTags,
38
- });
39
- }
30
+ React.useEffect(() => {
31
+ const nativeDestinations = (props.destinations || [])
32
+ .map(d => ReactNative.findNodeHandle(d))
33
+ .filter(c => c !== 0 && c !== null && c !== undefined);
34
+ const hostComponentRef = ReactNativeShims.findHostInstance_DEPRECATED(focusGuideRef?.current);
35
+ hostComponentRef && Commands.setDestinations(hostComponentRef, nativeDestinations);
36
+ }, [props.destinations]);
40
37
 
41
- render(): React.Node {
42
- return (
43
- // Container view must have nonzero size
44
- <ReactNative.View style={[{minHeight: 1, minWidth: 1}, this.props.style]}>
45
- {
38
+ return (
39
+ // Container view must have nonzero size
40
+ <ReactNative.View style={[{minHeight: 1, minWidth: 1}, props.style]}>
41
+ {
46
42
  /**
47
43
  * The client specified layout(using 'style' prop) should be applied the container view ReactNative.View.
48
44
  * And the focusGuide's layout shoule be overrided to wrap it fully inside the container view.
@@ -51,20 +47,21 @@ class TVFocusGuideView extends React.Component<FocusGuideProps> {
51
47
  * and so, the left margin is getting added twice and UI becomes incorrect.
52
48
  * The same is applicable for other layout properties.
53
49
  */
54
- }
55
- {Platform.isTVOS ? (
56
- <RNFocusGuide
57
- style={[this.props.style, styles.focusGuideLayout]}
58
- ref={ref => (this._focusGuideRef = ref)}
59
- destinationTags={this._destinationTags}>
60
- {this.props.children}
61
- </RNFocusGuide>
62
- ) : (
63
- this.props.children
64
- )}
65
- </ReactNative.View>)
66
- }
67
- }
50
+ }
51
+ {Platform.isTVOS ? (
52
+ <ReactNative.View
53
+ style={[props.style, styles.focusGuideLayout]}
54
+ ref={focusGuideRef}
55
+ >
56
+ {props.children}
57
+ </ReactNative.View>
58
+ ) : (
59
+ props.children
60
+ )}
61
+ </ReactNative.View>
62
+ );
63
+
64
+ };
68
65
 
69
66
  const styles = ReactNative.StyleSheet.create({
70
67
  focusGuideLayout: {
@@ -79,6 +76,4 @@ const styles = ReactNative.StyleSheet.create({
79
76
  },
80
77
  });
81
78
 
82
- const RNFocusGuide = requireNativeComponent('RCTTVFocusGuideView');
83
-
84
79
  module.exports = TVFocusGuideView;
@@ -78,31 +78,4 @@ export type TVViewProps = $ReadOnly<{|
78
78
  */
79
79
  tvParallaxProperties?: TVParallaxPropertiesType,
80
80
 
81
- /**
82
- * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0.
83
- *
84
- * @platform ios
85
- */
86
- tvParallaxShiftDistanceX?: number,
87
-
88
- /**
89
- * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0.
90
- *
91
- * @platform ios
92
- */
93
- tvParallaxShiftDistanceY?: number,
94
-
95
- /**
96
- * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 0.05.
97
- *
98
- * @platform ios
99
- */
100
- tvParallaxTiltAngle?: number,
101
-
102
- /**
103
- * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 1.0.
104
- *
105
- * @platform ios
106
- */
107
- tvParallaxMagnification?: number,
108
81
  |}>;
@@ -193,6 +193,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
193
193
  pressRetentionOffset,
194
194
  style,
195
195
  testOnly_pressed,
196
+ tvParallaxProperties,
196
197
  unstable_pressDelay,
197
198
  ...restProps
198
199
  } = props;
@@ -319,6 +320,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
319
320
  ref={viewRef}
320
321
  isTVSelectable={isTVSelectable !== false && accessible !== false}
321
322
  style={typeof style === 'function' ? style({pressed, focused}) : style}
323
+ tvParallaxProperties={tvParallaxProperties}
322
324
  collapsable={false}>
323
325
  {typeof children === 'function' ? children({pressed, focused}) : children}
324
326
  {__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
@@ -34,10 +34,15 @@ interface NativeCommands {
34
34
  viewRef: React.ElementRef<HostComponent<mixed>>,
35
35
  pressed: boolean,
36
36
  ) => void;
37
+ // Apple TV focus guide API
38
+ +setDestinations: (
39
+ viewRef: React.ElementRef<HostComponent<mixed>>,
40
+ destinations: Array<React.ElementRef<HostComponent<mixed>>>,
41
+ ) => void;
37
42
  }
38
43
 
39
44
  export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
40
- supportedCommands: ['hotspotUpdate', 'setPressed'],
45
+ supportedCommands: ['hotspotUpdate', 'setPressed', 'setDestinations'],
41
46
  });
42
47
 
43
48
  export default ViewNativeComponent;
@@ -63,6 +63,7 @@ function LogBoxButton(props: Props): React.Node {
63
63
  content
64
64
  ) : (
65
65
  <LogBoxTouchable
66
+ tvParallaxProperties={{enabled: false}}
66
67
  hitSlop={props.hitSlop}
67
68
  onPress={props.onPress}
68
69
  onPressIn={() => setPressed(true)}
@@ -19,6 +19,9 @@ extern NSString *const RCTTVRemoteEventRight;
19
19
  extern NSString *const RCTTVRemoteEventUp;
20
20
  extern NSString *const RCTTVRemoteEventDown;
21
21
 
22
+ extern NSString *const RCTTVRemoteEventPageUp;
23
+ extern NSString *const RCTTVRemoteEventPageDown;
24
+
22
25
  extern NSString *const RCTTVRemoteEventSwipeLeft;
23
26
  extern NSString *const RCTTVRemoteEventSwipeRight;
24
27
  extern NSString *const RCTTVRemoteEventSwipeUp;
@@ -32,6 +32,9 @@ NSString *const RCTTVRemoteEventRight = @"right";
32
32
  NSString *const RCTTVRemoteEventUp = @"up";
33
33
  NSString *const RCTTVRemoteEventDown = @"down";
34
34
 
35
+ NSString *const RCTTVRemoteEventPageUp = @"pageUp";
36
+ NSString *const RCTTVRemoteEventPageDown = @"pageDown";
37
+
35
38
  NSString *const RCTTVRemoteEventSwipeLeft = @"swipeLeft";
36
39
  NSString *const RCTTVRemoteEventSwipeRight = @"swipeRight";
37
40
  NSString *const RCTTVRemoteEventSwipeUp = @"swipeUp";
@@ -102,6 +105,17 @@ static __volatile BOOL __useMenuKey = NO;
102
105
  [self addTapGestureRecognizerWithSelector:@selector(selectPressed:)
103
106
  pressType:UIPressTypeSelect
104
107
  name:RCTTVRemoteEventSelect];
108
+
109
+ // Page Up/Down
110
+ if (@available(tvOS 14.3, *)) {
111
+ [self addTapGestureRecognizerWithSelector:@selector(tappedPageUp:)
112
+ pressType:UIPressTypePageUp
113
+ name:RCTTVRemoteEventPageUp];
114
+
115
+ [self addTapGestureRecognizerWithSelector:@selector(tappedPageDown:)
116
+ pressType:UIPressTypePageDown
117
+ name:RCTTVRemoteEventPageDown];
118
+ }
105
119
 
106
120
  // Up
107
121
  [self addTapGestureRecognizerWithSelector:@selector(tappedUp:)
@@ -280,6 +294,16 @@ static __volatile BOOL __useMenuKey = NO;
280
294
  [self sendAppleTVEvent:RCTTVRemoteEventDown toView:r.view];
281
295
  }
282
296
 
297
+ - (void)tappedPageUp:(UIGestureRecognizer *)r
298
+ {
299
+ [self sendAppleTVEvent:RCTTVRemoteEventPageUp toView:r.view];
300
+ }
301
+
302
+ - (void)tappedPageDown:(UIGestureRecognizer *)r
303
+ {
304
+ [self sendAppleTVEvent:RCTTVRemoteEventPageDown toView:r.view];
305
+ }
306
+
283
307
  - (void)tappedLeft:(UIGestureRecognizer *)r
284
308
  {
285
309
  [self sendAppleTVEvent:RCTTVRemoteEventLeft toView:r.view];
@@ -24,7 +24,7 @@
24
24
 
25
25
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
26
26
  __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
27
- if (@available(iOS 13.0, *)) {
27
+ if (@available(iOS 13.0, tvOS 13.0, *)) {
28
28
  self.modalInPresentation = YES;
29
29
  }
30
30
  #endif
@@ -9,6 +9,10 @@
9
9
 
10
10
  #import <React/RCTViewComponentView.h>
11
11
 
12
+ #if TARGET_OS_TV
13
+ #import "RCTTVRemoteHandler.h"
14
+ #endif
15
+
12
16
  NS_ASSUME_NONNULL_BEGIN
13
17
 
14
18
  /**
@@ -16,6 +20,11 @@ NS_ASSUME_NONNULL_BEGIN
16
20
  */
17
21
  @interface RCTRootComponentView : RCTViewComponentView
18
22
 
23
+ #if TARGET_OS_TV
24
+ @property (nonatomic, strong, nullable) RCTTVRemoteHandler *tvRemoteHandler;
25
+ @property (nonatomic, weak, nullable) UIView *reactPreferredFocusedView;
26
+ #endif
27
+
19
28
  @end
20
29
 
21
30
  NS_ASSUME_NONNULL_END
@@ -20,11 +20,29 @@ using namespace facebook::react;
20
20
  if (self = [super initWithFrame:frame]) {
21
21
  static const auto defaultProps = std::make_shared<const RootProps>();
22
22
  _props = defaultProps;
23
+ #if TARGET_OS_TV
24
+ self.tvRemoteHandler = [[RCTTVRemoteHandler alloc] initWithView:self];
25
+ #endif
23
26
  }
24
27
 
25
28
  return self;
26
29
  }
27
30
 
31
+ #if TARGET_OS_TV
32
+ - (void)dealloc
33
+ {
34
+ self.tvRemoteHandler = nil;
35
+ }
36
+
37
+ - (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
38
+ if (self.reactPreferredFocusedView) {
39
+ return @[self.reactPreferredFocusedView];
40
+ }
41
+ return [super preferredFocusEnvironments];
42
+ }
43
+ #endif
44
+
45
+
28
46
  #pragma mark - RCTComponentViewProtocol
29
47
 
30
48
  + (ComponentDescriptorProvider)componentDescriptorProvider
@@ -69,6 +69,10 @@ NS_ASSUME_NONNULL_BEGIN
69
69
  */
70
70
  @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
71
71
 
72
+ #if TARGET_OS_TV
73
+ @property(nonatomic, nullable) UIFocusGuide *focusGuide;
74
+ #endif
75
+
72
76
  /**
73
77
  * Enforcing `call super` semantic for overridden methods from `RCTComponentViewProtocol`.
74
78
  * The methods update the instance variables.