react-native-tvos 0.68.1-1 → 0.68.2-0

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 (103) hide show
  1. package/Libraries/Components/Touchable/TouchableHighlight.js +19 -5
  2. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +4 -0
  3. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +83 -30
  4. package/React/Views/RCTTVView.h +9 -5
  5. package/React/Views/RCTTVView.m +98 -52
  6. package/ReactAndroid/build.gradle +2 -11
  7. package/ReactAndroid/gradle.properties +1 -1
  8. package/ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/Android.mk +1 -0
  9. package/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/Android.mk +2 -0
  10. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/Android.mk +1 -0
  11. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk +1 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk +1 -0
  13. package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk +1 -0
  14. package/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/Android.mk +1 -0
  15. package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/Android.mk +2 -0
  16. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/Android.mk +1 -0
  17. package/ReactAndroid/src/main/jni/first-party/yogajni/Android.mk +1 -0
  18. package/ReactAndroid/src/main/jni/react/jni/Android.mk +2 -0
  19. package/ReactAndroid/src/main/jni/third-party/boost/Android.mk +1 -0
  20. package/ReactCommon/butter/Android.mk +1 -0
  21. package/ReactCommon/cxxreact/Android.mk +1 -0
  22. package/ReactCommon/hermes/executor/Android.mk +2 -0
  23. package/ReactCommon/hermes/inspector/Android.mk +1 -0
  24. package/ReactCommon/jsi/Android.mk +2 -0
  25. package/ReactCommon/jsiexecutor/Android.mk +1 -0
  26. package/ReactCommon/jsinspector/Android.mk +1 -0
  27. package/ReactCommon/logger/Android.mk +1 -0
  28. package/ReactCommon/react/config/Android.mk +1 -0
  29. package/ReactCommon/react/debug/Android.mk +1 -0
  30. package/ReactCommon/react/nativemodule/core/Android.mk +1 -0
  31. package/ReactCommon/react/nativemodule/samples/platform/android/Android.mk +1 -0
  32. package/ReactCommon/react/renderer/animations/Android.mk +1 -0
  33. package/ReactCommon/react/renderer/attributedstring/Android.mk +1 -0
  34. package/ReactCommon/react/renderer/componentregistry/Android.mk +1 -0
  35. package/ReactCommon/react/renderer/componentregistry/native/Android.mk +1 -0
  36. package/ReactCommon/react/renderer/components/image/Android.mk +1 -0
  37. package/ReactCommon/react/renderer/components/modal/Android.mk +1 -0
  38. package/ReactCommon/react/renderer/components/progressbar/Android.mk +1 -0
  39. package/ReactCommon/react/renderer/components/root/Android.mk +1 -0
  40. package/ReactCommon/react/renderer/components/scrollview/Android.mk +1 -0
  41. package/ReactCommon/react/renderer/components/slider/Android.mk +1 -0
  42. package/ReactCommon/react/renderer/components/switch/Android.mk +1 -0
  43. package/ReactCommon/react/renderer/components/text/Android.mk +1 -0
  44. package/ReactCommon/react/renderer/components/textinput/Android.mk +1 -0
  45. package/ReactCommon/react/renderer/components/unimplementedview/Android.mk +1 -0
  46. package/ReactCommon/react/renderer/components/view/Android.mk +1 -0
  47. package/ReactCommon/react/renderer/core/Android.mk +1 -0
  48. package/ReactCommon/react/renderer/debug/Android.mk +1 -0
  49. package/ReactCommon/react/renderer/graphics/Android.mk +1 -0
  50. package/ReactCommon/react/renderer/imagemanager/Android.mk +1 -0
  51. package/ReactCommon/react/renderer/leakchecker/Android.mk +1 -0
  52. package/ReactCommon/react/renderer/mapbuffer/Android.mk +1 -0
  53. package/ReactCommon/react/renderer/mounting/Android.mk +1 -0
  54. package/ReactCommon/react/renderer/runtimescheduler/Android.mk +1 -0
  55. package/ReactCommon/react/renderer/scheduler/Android.mk +1 -0
  56. package/ReactCommon/react/renderer/telemetry/Android.mk +1 -0
  57. package/ReactCommon/react/renderer/templateprocessor/Android.mk +1 -0
  58. package/ReactCommon/react/renderer/textlayoutmanager/Android.mk +1 -0
  59. package/ReactCommon/react/renderer/uimanager/Android.mk +1 -0
  60. package/ReactCommon/react/utils/Android.mk +1 -0
  61. package/ReactCommon/reactperflogger/Android.mk +1 -0
  62. package/ReactCommon/yoga/Android.mk +1 -0
  63. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1-sources.jar → 0.68.2-0/react-native-0.68.2-0-sources.jar} +0 -0
  64. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0-sources.jar.md5 +1 -0
  65. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0-sources.jar.sha1 +1 -0
  66. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0-sources.jar.sha256 +1 -0
  67. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0-sources.jar.sha512 +1 -0
  68. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.aar → 0.68.2-0/react-native-0.68.2-0.aar} +0 -0
  69. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.aar.md5 → 0.68.2-0/react-native-0.68.2-0.aar.md5} +0 -0
  70. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.aar.sha1 → 0.68.2-0/react-native-0.68.2-0.aar.sha1} +0 -0
  71. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.aar.sha256 → 0.68.2-0/react-native-0.68.2-0.aar.sha256} +0 -0
  72. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.aar.sha512 → 0.68.2-0/react-native-0.68.2-0.aar.sha512} +0 -0
  73. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.module → 0.68.2-0/react-native-0.68.2-0.module} +5 -5
  74. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.module.md5 +1 -0
  75. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.module.sha1 +1 -0
  76. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.module.sha256 +1 -0
  77. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.module.sha512 +1 -0
  78. package/android/com/facebook/react/react-native/{0.68.1-1/react-native-0.68.1-1.pom → 0.68.2-0/react-native-0.68.2-0.pom} +1 -1
  79. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.pom.md5 +1 -0
  80. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.pom.sha1 +1 -0
  81. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.pom.sha256 +1 -0
  82. package/android/com/facebook/react/react-native/0.68.2-0/react-native-0.68.2-0.pom.sha512 +1 -0
  83. package/android/com/facebook/react/react-native/maven-metadata.xml +4 -4
  84. package/android/com/facebook/react/react-native/maven-metadata.xml.md5 +1 -1
  85. package/android/com/facebook/react/react-native/maven-metadata.xml.sha1 +1 -1
  86. package/android/com/facebook/react/react-native/maven-metadata.xml.sha256 +1 -1
  87. package/android/com/facebook/react/react-native/maven-metadata.xml.sha512 +1 -1
  88. package/package.json +2 -2
  89. package/template/android/app/build.gradle +1 -3
  90. package/template/android/build.gradle +0 -4
  91. package/template/package.json +1 -1
  92. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1-sources.jar.md5 +0 -1
  93. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1-sources.jar.sha1 +0 -1
  94. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1-sources.jar.sha256 +0 -1
  95. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1-sources.jar.sha512 +0 -1
  96. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.module.md5 +0 -1
  97. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.module.sha1 +0 -1
  98. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.module.sha256 +0 -1
  99. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.module.sha512 +0 -1
  100. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.pom.md5 +0 -1
  101. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.pom.sha1 +0 -1
  102. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.pom.sha256 +0 -1
  103. package/android/com/facebook/react/react-native/0.68.1-1/react-native-0.68.1-1.pom.sha512 +0 -1
@@ -19,6 +19,8 @@ import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
19
19
  import Platform from '../../Utilities/Platform';
20
20
  import View from '../../Components/View/View';
21
21
  import type {ViewProps} from '../../Components/View/ViewPropTypes';
22
+ import typeof TVParallaxPropertiesType from '../AppleTV/TVViewPropTypes';
23
+ import tagForComponentOrHandle from '../AppleTV/tagForComponentOrHandle';
22
24
  import * as React from 'react';
23
25
 
24
26
  type AndroidProps = $ReadOnly<{|
@@ -29,9 +31,21 @@ type AndroidProps = $ReadOnly<{|
29
31
  nextFocusUp?: ?number,
30
32
  |}>;
31
33
 
34
+ type TVProps = $ReadOnly<{|
35
+ hasTVPreferredFocus?: ?boolean,
36
+ isTVSelectable?: ?boolean,
37
+ tvParallaxProperties?: ?TVParallaxPropertiesType,
38
+ nextFocusDown?: ?number,
39
+ nextFocusForward?: ?number,
40
+ nextFocusLeft?: ?number,
41
+ nextFocusRight?: ?number,
42
+ nextFocusUp?: ?number,
43
+ |}>;
44
+
32
45
  type Props = $ReadOnly<{|
33
46
  ...React.ElementConfig<TouchableWithoutFeedback>,
34
47
  ...AndroidProps,
48
+ ...TVProps,
35
49
  ...ViewProps,
36
50
 
37
51
  activeOpacity?: ?number,
@@ -313,11 +327,11 @@ class TouchableHighlight extends React.Component<Props, State> {
313
327
  hasTVPreferredFocus={this.props.hasTVPreferredFocus === true}
314
328
  isTVSelectable={this.props.isTVSelectable !== false && this.props.accessible !== false}
315
329
  tvParallaxProperties={this.props.tvParallaxProperties}
316
- nextFocusDown={this.props.nextFocusDown}
317
- nextFocusForward={this.props.nextFocusForward}
318
- nextFocusLeft={this.props.nextFocusLeft}
319
- nextFocusRight={this.props.nextFocusRight}
320
- nextFocusUp={this.props.nextFocusUp}
330
+ nextFocusDown={tagForComponentOrHandle(this.props.nextFocusDown)}
331
+ nextFocusForward={tagForComponentOrHandle(this.props.nextFocusForward)}
332
+ nextFocusLeft={tagForComponentOrHandle(this.props.nextFocusLeft)}
333
+ nextFocusRight={tagForComponentOrHandle(this.props.nextFocusRight)}
334
+ nextFocusUp={tagForComponentOrHandle(this.props.nextFocusUp)}
321
335
  focusable={
322
336
  this.props.focusable !== false && this.props.onPress !== undefined
323
337
  }
@@ -71,6 +71,10 @@ NS_ASSUME_NONNULL_BEGIN
71
71
 
72
72
  #if TARGET_OS_TV
73
73
  @property(nonatomic, nullable) UIFocusGuide *focusGuide;
74
+ @property(nonatomic, nullable) UIFocusGuide *focusGuideUp;
75
+ @property(nonatomic, nullable) UIFocusGuide *focusGuideDown;
76
+ @property(nonatomic, nullable) UIFocusGuide *focusGuideLeft;
77
+ @property(nonatomic, nullable) UIFocusGuide *focusGuideRight;
74
78
  #endif
75
79
 
76
80
  /**
@@ -309,41 +309,92 @@ using namespace facebook::react;
309
309
  return _props->isTVSelectable;
310
310
  }
311
311
 
312
- - (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
313
- if (_nextFocusActiveTarget == nil) return [super preferredFocusEnvironments];
314
- UIView * nextFocusActiveTarget = _nextFocusActiveTarget;
315
- _nextFocusActiveTarget = nil;
316
- NSArray<id<UIFocusEnvironment>> * focusEnvironment = @[nextFocusActiveTarget];
317
- return focusEnvironment;
318
- }
319
-
320
- - (BOOL) shouldUpdateFocusInContext:(UIFocusUpdateContext *)context {
321
- if (self.isFocused) {
322
- if (_nextFocusUp != nil && context.focusHeading == UIFocusHeadingUp) {
323
- self->_nextFocusActiveTarget = _nextFocusUp;
324
- [self setNeedsFocusUpdate];
325
- return false;
312
+ // In tvOS, to support directional focus APIs, we add a UIFocusGuide for each
313
+ // side of the view where a nextFocus has been set. Set layout constraints to
314
+ // make the guide 1 px thick, and set the destination to the nextFocus object.
315
+ //
316
+ // This is only done once the view is focused.
317
+ //
318
+ - (void)enableDirectionalFocusGuides
319
+ {
320
+ if (self->_nextFocusUp != nil) {
321
+ if (self.focusGuideUp == nil) {
322
+ self.focusGuideUp = [UIFocusGuide new];
323
+ [[self containingRootView] addLayoutGuide:self.focusGuideUp];
324
+
325
+ [self.focusGuideUp.bottomAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
326
+ [self.focusGuideUp.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
327
+ [self.focusGuideUp.heightAnchor constraintEqualToConstant:1.0].active = YES;
328
+ [self.focusGuideUp.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
326
329
  }
327
- if (_nextFocusDown != nil && context.focusHeading == UIFocusHeadingDown) {
328
- self->_nextFocusActiveTarget = _nextFocusDown;
329
- [self setNeedsFocusUpdate];
330
- return false;
330
+
331
+ self.focusGuideUp.preferredFocusEnvironments = @[self->_nextFocusUp];
332
+ }
333
+
334
+ if (self->_nextFocusDown != nil) {
335
+ if (self.focusGuideDown == nil) {
336
+ self.focusGuideDown = [UIFocusGuide new];
337
+ [[self containingRootView] addLayoutGuide:self.focusGuideDown];
338
+
339
+ [self.focusGuideDown.topAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES;
340
+ [self.focusGuideDown.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
341
+ [self.focusGuideDown.heightAnchor constraintEqualToConstant:1.0].active = YES;
342
+ [self.focusGuideDown.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
331
343
  }
332
- if (_nextFocusLeft != nil && context.focusHeading == UIFocusHeadingLeft) {
333
- self->_nextFocusActiveTarget = _nextFocusLeft;
334
- [self setNeedsFocusUpdate];
335
- return false;
344
+
345
+ self.focusGuideDown.preferredFocusEnvironments = @[self->_nextFocusDown];
346
+ }
347
+
348
+ if (self->_nextFocusLeft != nil) {
349
+ if (self.focusGuideLeft == nil) {
350
+ self.focusGuideLeft = [UIFocusGuide new];
351
+ [[self containingRootView] addLayoutGuide:self.focusGuideLeft];
352
+
353
+ [self.focusGuideLeft.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
354
+ [self.focusGuideLeft.widthAnchor constraintEqualToConstant:1.0].active = YES;
355
+ [self.focusGuideLeft.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
356
+ [self.focusGuideLeft.rightAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
336
357
  }
337
- if (_nextFocusRight != nil && context.focusHeading == UIFocusHeadingRight) {
338
- self->_nextFocusActiveTarget = _nextFocusRight;
339
- [self setNeedsFocusUpdate];
340
- return false;
358
+
359
+ self.focusGuideLeft.preferredFocusEnvironments = @[self->_nextFocusLeft];
360
+ }
361
+
362
+ if (self->_nextFocusRight != nil) {
363
+ if (self.focusGuideRight == nil) {
364
+ self.focusGuideRight = [UIFocusGuide new];
365
+ [[self containingRootView] addLayoutGuide:self.focusGuideRight];
366
+
367
+ [self.focusGuideRight.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
368
+ [self.focusGuideRight.widthAnchor constraintEqualToConstant:1.0].active = YES;
369
+ [self.focusGuideRight.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
370
+ [self.focusGuideRight.leftAnchor constraintEqualToAnchor:self.rightAnchor].active = YES;
341
371
  }
342
- self->_nextFocusActiveTarget = nil;
343
- return true;
372
+
373
+ self.focusGuideRight.preferredFocusEnvironments = @[self->_nextFocusRight];
374
+ }
375
+ }
376
+ // Called when focus leaves this view -- disable the directional focus guides
377
+ // (if they exist) so that they don't interfere with focus navigation from
378
+ // other views
379
+ //
380
+ - (void)disableDirectionalFocusGuides
381
+ {
382
+ if (self.focusGuideUp != nil) {
383
+ [[self containingRootView] removeLayoutGuide:self.focusGuideUp];
384
+ self.focusGuideUp = nil;
385
+ }
386
+ if (self.focusGuideDown != nil) {
387
+ [[self containingRootView] removeLayoutGuide:self.focusGuideDown];
388
+ self.focusGuideDown = nil;
389
+ }
390
+ if (self.focusGuideLeft != nil) {
391
+ [[self containingRootView] removeLayoutGuide:self.focusGuideLeft];
392
+ self.focusGuideLeft = nil;
393
+ }
394
+ if (self.focusGuideRight != nil) {
395
+ [[self containingRootView] removeLayoutGuide:self.focusGuideRight];
396
+ self.focusGuideRight = nil;
344
397
  }
345
- self->_nextFocusActiveTarget = nil;
346
- return true;
347
398
  }
348
399
 
349
400
  - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
@@ -353,11 +404,13 @@ using namespace facebook::react;
353
404
  }
354
405
  if (context.nextFocusedView == self && self.isUserInteractionEnabled ) {
355
406
  [self becomeFirstResponder];
407
+ [self enableDirectionalFocusGuides];
356
408
  [coordinator addCoordinatedAnimations:^(void){
357
409
  [self addParallaxMotionEffects];
358
410
  [self sendFocusNotification:context];
359
411
  } completion:^(void){}];
360
412
  } else {
413
+ [self disableDirectionalFocusGuides];
361
414
  [coordinator addCoordinatedAnimations:^(void){
362
415
  [self removeParallaxMotionEffects];
363
416
  [self sendBlurNotification:context];
@@ -32,11 +32,15 @@
32
32
  /**
33
33
  * Focus direction tags
34
34
  */
35
- @property (nonatomic, strong) RCTTVView * nextFocusUp;
36
- @property (nonatomic, strong) RCTTVView * nextFocusDown;
37
- @property (nonatomic, strong) RCTTVView * nextFocusLeft;
38
- @property (nonatomic, strong) RCTTVView * nextFocusRight;
39
- @property (nonatomic, strong) RCTTVView * nextFocusActiveTarget;
35
+ @property (nonatomic, weak) RCTTVView * nextFocusUp;
36
+ @property (nonatomic, weak) RCTTVView * nextFocusDown;
37
+ @property (nonatomic, weak) RCTTVView * nextFocusLeft;
38
+ @property (nonatomic, weak) RCTTVView * nextFocusRight;
39
+
40
+ @property (nonatomic, strong) UIFocusGuide * focusGuideUp;
41
+ @property (nonatomic, strong) UIFocusGuide * focusGuideDown;
42
+ @property (nonatomic, strong) UIFocusGuide * focusGuideLeft;
43
+ @property (nonatomic, strong) UIFocusGuide * focusGuideRight;
40
44
 
41
45
  - (instancetype)initWithBridge:(RCTBridge *)bridge;
42
46
 
@@ -127,6 +127,18 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
127
127
  return (self.isTVSelectable);
128
128
  }
129
129
 
130
+ - (RCTRootView *)rootView
131
+ {
132
+ UIView *rootview = self;
133
+ while (![rootview isReactRootView] && rootview != nil) {
134
+ rootview = [rootview superview];
135
+ }
136
+ if (rootview == nil) return nil;
137
+
138
+ rootview = [rootview superview];
139
+ return (RCTRootView *)rootview;
140
+ }
141
+
130
142
  - (void)addParallaxMotionEffects
131
143
  {
132
144
  if(![self.tvParallaxProperties[@"enabled"] boolValue]) {
@@ -237,11 +249,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
237
249
  }
238
250
  if (context.nextFocusedView == self && self.isTVSelectable ) {
239
251
  [self becomeFirstResponder];
252
+ [self enableDirectionalFocusGuides];
240
253
  [coordinator addCoordinatedAnimations:^(void){
241
254
  [self addParallaxMotionEffects];
242
255
  [self sendFocusNotification:context];
243
256
  } completion:^(void){}];
244
257
  } else {
258
+ [self disableDirectionalFocusGuides];
245
259
  [coordinator addCoordinatedAnimations:^(void){
246
260
  [self sendBlurNotification:context];
247
261
  [self removeParallaxMotionEffects];
@@ -250,41 +264,93 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
250
264
  }
251
265
  }
252
266
 
253
- - (BOOL) shouldUpdateFocusInContext:(UIFocusUpdateContext *)context {
254
- if (self.isFocused) {
255
- if (_nextFocusUp != nil && context.focusHeading == UIFocusHeadingUp) {
256
- self->_nextFocusActiveTarget = _nextFocusUp;
257
- [self setNeedsFocusUpdate];
258
- return false;
267
+ // In tvOS, to support directional focus APIs, we add a UIFocusGuide for each
268
+ // side of the view where a nextFocus has been set. Set layout constraints to
269
+ // make the guide 1 px thick, and set the destination to the nextFocus object.
270
+ //
271
+ // This is only done once the view is focused.
272
+ //
273
+ - (void)enableDirectionalFocusGuides
274
+ {
275
+ if (self->_nextFocusUp != nil) {
276
+ if (self.focusGuideUp == nil) {
277
+ self.focusGuideUp = [UIFocusGuide new];
278
+ [[self rootView] addLayoutGuide:self.focusGuideUp];
279
+
280
+ [self.focusGuideUp.bottomAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
281
+ [self.focusGuideUp.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
282
+ [self.focusGuideUp.heightAnchor constraintEqualToConstant:1.0].active = YES;
283
+ [self.focusGuideUp.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
259
284
  }
260
- if (_nextFocusDown != nil && context.focusHeading == UIFocusHeadingDown) {
261
- self->_nextFocusActiveTarget = _nextFocusDown;
262
- [self setNeedsFocusUpdate];
263
- return false;
285
+
286
+ self.focusGuideUp.preferredFocusEnvironments = @[self->_nextFocusUp];
287
+ }
288
+
289
+ if (self->_nextFocusDown != nil) {
290
+ if (self.focusGuideDown == nil) {
291
+ self.focusGuideDown = [UIFocusGuide new];
292
+ [[self rootView] addLayoutGuide:self.focusGuideDown];
293
+
294
+ [self.focusGuideDown.topAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES;
295
+ [self.focusGuideDown.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
296
+ [self.focusGuideDown.heightAnchor constraintEqualToConstant:1.0].active = YES;
297
+ [self.focusGuideDown.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
264
298
  }
265
- if (_nextFocusLeft != nil && context.focusHeading == UIFocusHeadingLeft) {
266
- self->_nextFocusActiveTarget = _nextFocusLeft;
267
- [self setNeedsFocusUpdate];
268
- return false;
299
+
300
+ self.focusGuideDown.preferredFocusEnvironments = @[self->_nextFocusDown];
301
+ }
302
+
303
+ if (self->_nextFocusLeft != nil) {
304
+ if (self.focusGuideLeft == nil) {
305
+ self.focusGuideLeft = [UIFocusGuide new];
306
+ [[self rootView] addLayoutGuide:self.focusGuideLeft];
307
+
308
+ [self.focusGuideLeft.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
309
+ [self.focusGuideLeft.widthAnchor constraintEqualToConstant:1.0].active = YES;
310
+ [self.focusGuideLeft.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
311
+ [self.focusGuideLeft.rightAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
269
312
  }
270
- if (_nextFocusRight != nil && context.focusHeading == UIFocusHeadingRight) {
271
- self->_nextFocusActiveTarget = _nextFocusRight;
272
- [self setNeedsFocusUpdate];
273
- return false;
313
+
314
+ self.focusGuideLeft.preferredFocusEnvironments = @[self->_nextFocusLeft];
315
+ }
316
+
317
+ if (self->_nextFocusRight != nil) {
318
+ if (self.focusGuideRight == nil) {
319
+ self.focusGuideRight = [UIFocusGuide new];
320
+ [[self rootView] addLayoutGuide:self.focusGuideRight];
321
+
322
+ [self.focusGuideRight.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
323
+ [self.focusGuideRight.widthAnchor constraintEqualToConstant:1.0].active = YES;
324
+ [self.focusGuideRight.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
325
+ [self.focusGuideRight.leftAnchor constraintEqualToAnchor:self.rightAnchor].active = YES;
274
326
  }
275
- self->_nextFocusActiveTarget = nil;
276
- return true;
327
+
328
+ self.focusGuideRight.preferredFocusEnvironments = @[self->_nextFocusRight];
277
329
  }
278
- self->_nextFocusActiveTarget = nil;
279
- return true;
280
330
  }
281
331
 
282
- - (NSArray<id<UIFocusEnvironment>> *)preferredFocusEnvironments {
283
- if (_nextFocusActiveTarget == nil) return [super preferredFocusEnvironments];
284
- RCTTVView * nextFocusActiveTarget = _nextFocusActiveTarget;
285
- _nextFocusActiveTarget = nil;
286
- NSArray<id<UIFocusEnvironment>> * focusEnvironment = @[nextFocusActiveTarget];
287
- return focusEnvironment;
332
+ // Called when focus leaves this view -- disable the directional focus guides
333
+ // (if they exist) so that they don't interfere with focus navigation from
334
+ // other views
335
+ //
336
+ - (void)disableDirectionalFocusGuides
337
+ {
338
+ if (self.focusGuideUp != nil) {
339
+ [[self rootView] removeLayoutGuide:self.focusGuideUp];
340
+ self.focusGuideUp = nil;
341
+ }
342
+ if (self.focusGuideDown != nil) {
343
+ [[self rootView] removeLayoutGuide:self.focusGuideDown];
344
+ self.focusGuideDown = nil;
345
+ }
346
+ if (self.focusGuideLeft != nil) {
347
+ [[self rootView] removeLayoutGuide:self.focusGuideLeft];
348
+ self.focusGuideLeft = nil;
349
+ }
350
+ if (self.focusGuideRight != nil) {
351
+ [[self rootView] removeLayoutGuide:self.focusGuideRight];
352
+ self.focusGuideRight = nil;
353
+ }
288
354
  }
289
355
 
290
356
  - (void)sendFocusNotification:(__unused UIFocusUpdateContext *)context
@@ -339,15 +405,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
339
405
  _hasTVPreferredFocus = hasTVPreferredFocus;
340
406
  if (hasTVPreferredFocus) {
341
407
  dispatch_async(dispatch_get_main_queue(), ^{
342
- UIView *rootview = self;
343
- while (![rootview isReactRootView] && rootview != nil) {
344
- rootview = [rootview superview];
345
- }
346
- if (rootview == nil) return;
408
+ RCTRootView *rootview = [self rootView];
347
409
 
348
- rootview = [rootview superview];
410
+ if (rootview == nil) return;
349
411
 
350
- [(RCTRootView *)rootview setReactPreferredFocusedView:self];
412
+ [rootview setReactPreferredFocusedView:self];
351
413
  [rootview setNeedsFocusUpdate];
352
414
  [rootview updateFocusIfNeeded];
353
415
  });
@@ -356,23 +418,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
356
418
 
357
419
  - (void)setHasTVPreferredFocus:(BOOL)hasTVPreferredFocus
358
420
  {
359
- _hasTVPreferredFocus = hasTVPreferredFocus;
360
- if (hasTVPreferredFocus) {
361
- dispatch_async(dispatch_get_main_queue(), ^{
362
- UIView *rootview = self;
363
- while (![rootview isReactRootView] && rootview != nil) {
364
- rootview = [rootview superview];
365
- }
366
- if (rootview == nil)
367
- return;
368
-
369
- rootview = [rootview superview];
370
-
371
- [(RCTRootView *)rootview setReactPreferredFocusedView:self];
372
- [rootview setNeedsFocusUpdate];
373
- [rootview updateFocusIfNeeded];
374
- });
375
- }
421
+ [self setPreferredFocus:hasTVPreferredFocus];
376
422
  }
377
423
 
378
424
  - (void)addFocusGuide:(NSArray*)destinations {
@@ -333,18 +333,9 @@ android {
333
333
  arguments "--output-sync=none"
334
334
  }
335
335
 
336
- // Note: On Windows there are limits on number of character in file paths and in command lines
337
- // Ref: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#Path-Length-Limits
338
- // NDK allows circumventing command line limits using response(RSP) files as inputs using NDK_APP_SHORT_COMMANDS flag.
339
- //
340
- // Windows can support long file paths if configured through registry or by prefixing all file paths with a special character sequence
341
- // The latter requires changes in NDK. And there are tools in NDK (AR) which is not able to handle long paths (>256) even after setting the registry key.
342
- // The new architecutre source tree is too deep, and the object file naming conventions in NDK makes the matters worse, by producing incredibly long file paths.
343
- // Other solutions such as symlinking source code etc. didn't work as expected, and makes the build scripts complicated and hard to manage.
344
- // This change temporarily works around the issue by placing the temporary build outputs as short a path as possible within the project path.
336
+ // Fix for windows limit on number of character in file paths and in command lines
345
337
  if (Os.isFamily(Os.FAMILY_WINDOWS)) {
346
- arguments "NDK_OUT=${rootProject.projectDir.getParent()}\\.cxx",
347
- "NDK_APP_SHORT_COMMANDS=true"
338
+ arguments "NDK_APP_SHORT_COMMANDS=true"
348
339
  }
349
340
  }
350
341
  }
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.68.1-1
1
+ VERSION_NAME=0.68.2-0
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  POM_NAME=ReactNative
@@ -13,6 +13,7 @@ include $(CLEAR_VARS)
13
13
  LOCAL_MODULE := jsijniprofiler
14
14
 
15
15
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
16
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
16
17
 
17
18
  LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
18
19
 
@@ -12,6 +12,7 @@ include $(CLEAR_VARS)
12
12
  LOCAL_MODULE := hermes-executor-release
13
13
 
14
14
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
15
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
15
16
 
16
17
  LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
17
18
 
@@ -35,6 +36,7 @@ LOCAL_MODULE := hermes-executor-debug
35
36
  LOCAL_CFLAGS := -DHERMES_ENABLE_DEBUGGER=1
36
37
 
37
38
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
39
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
38
40
 
39
41
  LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
40
42
 
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := mapbufferjni
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/react/common/mapbuffer/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_SHARED_LIBRARIES := \
15
16
  libfb \
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := fabricjni
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_SHARED_LIBRARIES := \
15
16
  libbutter \
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := jscexecutor
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)
15
16
 
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := reactnativeblob
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)
15
16
 
@@ -26,6 +26,7 @@ LOCAL_MODULE := reactperfloggerjni
26
26
 
27
27
  # Compile all local c++ files
28
28
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/reactperflogger/*.cpp)
29
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
29
30
 
30
31
  # Build the files in this directory as a shared library
31
32
  include $(BUILD_SHARED_LIBRARY)
@@ -28,6 +28,7 @@ LOCAL_MODULE := callinvokerholder
28
28
 
29
29
  # Compile all local c++ files
30
30
  LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/CallInvokerHolder.cpp
31
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
31
32
 
32
33
  # Build the files in this directory as a shared library
33
34
  include $(BUILD_STATIC_LIBRARY)
@@ -56,6 +57,7 @@ LOCAL_STATIC_LIBRARIES = libcallinvokerholder libreactperfloggerjni
56
57
 
57
58
  # Compile all local c++ files
58
59
  LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/TurboModuleManager.cpp $(LOCAL_PATH)/ReactCommon/OnLoad.cpp
60
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
59
61
 
60
62
  # Build the files in this directory as a shared library
61
63
  include $(BUILD_SHARED_LIBRARY)
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := uimanagerjni
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_SHARED_LIBRARIES := \
15
16
  libfb \
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := yoga
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jni/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)/jni
15
16
 
@@ -47,6 +47,7 @@ LOCAL_MODULE := reactnativeutilsjni
47
47
 
48
48
  # Compile all local c++ files.
49
49
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
50
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
50
51
 
51
52
  ifeq ($(APP_OPTIM),debug)
52
53
  # Keep symbols by overriding the strip command invoked by ndk-build.
@@ -106,6 +107,7 @@ LOCAL_MODULE := reactnativejni
106
107
 
107
108
  # Compile all local c++ files.
108
109
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
110
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
109
111
 
110
112
  ifeq ($(APP_OPTIM),debug)
111
113
  # Keep symbols by overriding the strip command invoked by ndk-build.
@@ -5,6 +5,7 @@ include $(CLEAR_VARS)
5
5
  # because the react native version does not include anything outside of headers.
6
6
  # They are required for Folly futures to compile successfully.
7
7
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/asm/$(TARGET_ARCH)/*.S)
8
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
8
9
 
9
10
  LOCAL_C_INCLUDES := $(LOCAL_PATH)/boost_1_63_0
10
11
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/boost_1_63_0
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := butter
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)/
15
16
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := reactnative
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
15
16
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
@@ -12,6 +12,7 @@ include $(CLEAR_VARS)
12
12
  LOCAL_MODULE := hermes-executor-common-release
13
13
 
14
14
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
15
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
15
16
 
16
17
  LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
17
18
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
@@ -27,6 +28,7 @@ LOCAL_MODULE := hermes-executor-common-debug
27
28
  LOCAL_CFLAGS := -DHERMES_ENABLE_DEBUGGER=1
28
29
 
29
30
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
31
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
30
32
 
31
33
  LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
32
34
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
@@ -12,6 +12,7 @@ include $(CLEAR_VARS)
12
12
  LOCAL_MODULE := hermes-inspector
13
13
 
14
14
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/detail/*.cpp $(LOCAL_PATH)/chrome/*.cpp)
15
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
15
16
 
16
17
  LOCAL_C_ROOT := $(LOCAL_PATH)/../..
17
18
 
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := jsi
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jsi/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)
15
16
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
@@ -25,6 +26,7 @@ include $(CLEAR_VARS)
25
26
  LOCAL_MODULE := jscruntime
26
27
 
27
28
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
29
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
28
30
 
29
31
  LOCAL_C_INCLUDES := $(LOCAL_PATH)
30
32
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
@@ -10,6 +10,7 @@ include $(CLEAR_VARS)
10
10
  LOCAL_MODULE := jsireact
11
11
 
12
12
  LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jsireact/*.cpp)
13
+ LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES))
13
14
 
14
15
  LOCAL_C_INCLUDES := $(LOCAL_PATH)
15
16
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)