react-native-tvos 0.76.0-0rc1 → 0.76.0-0rc2

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.
@@ -104,6 +104,7 @@ const RCTTextInputViewConfig = {
104
104
  textTransform: true,
105
105
  textAlign: true,
106
106
  fontFamily: true,
107
+ lineBreakModeIOS: true,
107
108
  lineHeight: true,
108
109
  isHighlighted: true,
109
110
  writingDirection: true,
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 76,
19
19
  patch: 0,
20
- prerelease: '0rc1',
20
+ prerelease: '0rc2',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(76),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"0rc1",
27
+ RCTVersionPrerelease: @"0rc2",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -740,6 +740,29 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
740
740
  [self _handleFinishedScrolling:scrollView];
741
741
  }
742
742
 
743
+ - (void)didMoveToWindow
744
+ {
745
+ [super didMoveToWindow];
746
+
747
+ if (!self.window) {
748
+ // The view is being removed, ensure that the scroll end event is dispatched
749
+ [self _handleScrollEndIfNeeded];
750
+ }
751
+ }
752
+
753
+ - (void)_handleScrollEndIfNeeded
754
+ {
755
+ if (_scrollView.isDecelerating || !_scrollView.isTracking) {
756
+ if (!_eventEmitter) {
757
+ return;
758
+ }
759
+ static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onMomentumScrollEnd([self _scrollViewMetrics]);
760
+
761
+ [self _updateStateWithContentOffset];
762
+ _isUserTriggeredScrolling = NO;
763
+ }
764
+ }
765
+
743
766
  - (void)_handleFinishedScrolling:(UIScrollView *)scrollView
744
767
  {
745
768
  [self _forceDispatchNextScrollEvent];
@@ -896,6 +896,26 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
896
896
  RCT_FORWARD_SCROLL_EVENT(scrollViewDidEndZooming : scrollView withView : view atScale : scale);
897
897
  }
898
898
 
899
+ - (void)didMoveToWindow
900
+ {
901
+ [super didMoveToWindow];
902
+ if (self.window == nil) {
903
+ // Check if the ScrollView was in motion
904
+ if (_scrollView.isDecelerating || !_scrollView.isTracking) {
905
+ // Trigger the onMomentumScrollEnd event manually
906
+ RCT_SEND_SCROLL_EVENT(onMomentumScrollEnd, nil);
907
+ // We can't use the RCT_FORWARD_SCROLL_EVENT here beacuse the `_cmd` parameter passed
908
+ // to `respondsToSelector` is the current method - so it will be `didMoveToWindow` - and not
909
+ // `scrollViewDidEndDecelerating` that is passed.
910
+ for (NSObject<UIScrollViewDelegate> *scrollViewListener in _scrollListeners) {
911
+ if ([scrollViewListener respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
912
+ [scrollViewListener scrollViewDidEndDecelerating:_scrollView];
913
+ }
914
+ }
915
+ }
916
+ }
917
+ }
918
+
899
919
  - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
900
920
  {
901
921
  // Fire a final scroll event
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.76.0-0rc1
1
+ VERSION_NAME=0.76.0-0rc2
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
 
4
4
  android.useAndroidX=true
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 76,
20
20
  "patch", 0,
21
- "prerelease", "0rc1");
21
+ "prerelease", "0rc2");
22
22
  }
@@ -7,6 +7,8 @@
7
7
 
8
8
  package com.facebook.react.views.view;
9
9
 
10
+ import android.content.Context;
11
+ import android.content.pm.PackageManager;
10
12
  import android.graphics.Rect;
11
13
  import android.util.Log;
12
14
  import android.view.View;
@@ -94,6 +96,14 @@ public class ReactViewManager extends ReactClippingViewManager<ReactViewGroup> {
94
96
  @ReactProp(name = "accessible")
95
97
  public void setAccessible(ReactViewGroup view, boolean accessible) {
96
98
  view.setFocusable(accessible);
99
+ // This is required to handle Android TV/ Fire TV Devices that are Touch Enabled as well as LeanBack
100
+ // https://developer.android.com/reference/android/view/View#requestFocus(int,%20android.graphics.Rect)
101
+ // ** A view will not actually take focus if it is not focusable (isFocusable() returns false), **
102
+ // ** or if it is focusable and it is not focusable in touch mode (isFocusableInTouchMode()) **
103
+ // ** while the device is in touch mode. **
104
+ if (hasTouchScreen(view.getContext())) {
105
+ view.setFocusableInTouchMode(accessible);
106
+ }
97
107
  }
98
108
 
99
109
  @ReactProp(name = "hasTVPreferredFocus")
@@ -498,6 +508,14 @@ public class ReactViewManager extends ReactClippingViewManager<ReactViewGroup> {
498
508
  }
499
509
  root.setFocusDestinations(fd);
500
510
  }
511
+
512
+ /**
513
+ * Utility function to help capture Android TV/ Fire TV Devices with Touch Support
514
+ */
515
+ private boolean hasTouchScreen(Context context) {
516
+ PackageManager pm = context.getPackageManager();
517
+ return pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
518
+ }
501
519
 
502
520
  @ReactProp(name = "autoFocus")
503
521
  public void setAutoFocusTV(ReactViewGroup view, boolean autoFocus) {
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 76;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "0rc1";
21
+ std::string_view Prerelease = "0rc2";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
package/cli.js CHANGED
@@ -109,7 +109,7 @@ function warnWithDeprecationSchedule() {
109
109
  ${chalk.yellow('⚠️')} The \`init\` command is deprecated.
110
110
  The behavior will be changed on ${chalk.white.bold(CLI_DEPRECATION_DATE.toLocaleDateString())} ${emphasis(`(${daysRemaining} day${daysRemaining > 1 ? 's' : ''})`)}.
111
111
 
112
- - Switch to ${chalk.dim('npx @react-native-community/cli init')} for the identical behavior.
112
+ - Switch to ${chalk.grey.bold('npx @react-native-community/cli init')} for the identical behavior.
113
113
  - Refer to the documentation for information about alternative tools: ${chalk.dim('https://reactnative.dev/docs/getting-started')}`);
114
114
  }
115
115
 
@@ -117,11 +117,10 @@ function warnWithDeprecated() {
117
117
  if (!isInitCommand) {
118
118
  return;
119
119
  }
120
-
121
120
  console.warn(`
122
121
  🚨️ The \`init\` command is deprecated.
123
122
 
124
- - Switch to ${chalk.dim('npx @react-native-community/cli init')} for the identical behavior.
123
+ - Switch to ${chalk.grey.bold('npx @react-native-community/cli init')} for the identical behavior.
125
124
  - Refer to the documentation for information about alternative tools: ${chalk.dim('https://reactnative.dev/docs/getting-started')}`);
126
125
  }
127
126
 
@@ -174,7 +173,7 @@ async function main() {
174
173
 
175
174
  const isDeprecated =
176
175
  CLI_DEPRECATION_DATE.getTime() <= new Date().getTime() ||
177
- currentVersion.startsWith('0.76');
176
+ currentVersion.startsWith('0.77');
178
177
 
179
178
  /**
180
179
  * This command is now deprecated. We will continue to proxy commands to @react-native-community/cli, but it
@@ -191,8 +190,13 @@ async function main() {
191
190
  warnWithDeprecated();
192
191
  // We only exit if the user calls `init` and it's deprecated. All other cases should proxy to to @react-native-community/cli.
193
192
  // Be careful with this as it can break a lot of users.
193
+ console.warn(`${chalk.green('Exiting...')}`);
194
194
  process.exit(1);
195
- } else if (currentVersion.startsWith('0.75')) {
195
+ } else if (
196
+ currentVersion.startsWith('0.75') ||
197
+ currentVersion.startsWith('0.76')
198
+ ) {
199
+ // We check deprecation schedule only for 0.75 and 0.76 and 0.77 is expected to land in Jan 2025.
196
200
  warnWithDeprecationSchedule();
197
201
  }
198
202
  warnWhenRunningInit();
package/jest-preset.js CHANGED
@@ -15,7 +15,11 @@ module.exports = {
15
15
  platforms: ['android', 'ios', 'native'],
16
16
  },
17
17
  transform: {
18
- '^.+\\.(js|ts|tsx)$': 'babel-jest',
18
+ '^.+\\.(js)$': [
19
+ 'babel-jest',
20
+ {plugins: ['babel-plugin-syntax-hermes-parser']},
21
+ ],
22
+ '^.+\\.(ts|tsx)$': 'babel-jest',
19
23
  '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
20
24
  './jest/assetFileTransformer.js',
21
25
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.76.0-0rc1",
3
+ "version": "0.76.0-0rc2",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -110,16 +110,18 @@
110
110
  },
111
111
  "dependencies": {
112
112
  "@jest/create-cache-key-function": "^29.6.3",
113
- "@react-native/assets-registry": "0.76.0-rc.1",
114
- "@react-native/codegen": "0.76.0-rc.1",
115
- "@react-native/community-cli-plugin": "0.76.0-rc.1",
116
- "@react-native/gradle-plugin": "0.76.0-rc.1",
117
- "@react-native/js-polyfills": "0.76.0-rc.1",
118
- "@react-native/normalize-colors": "0.76.0-rc.1",
119
- "@react-native-tvos/virtualized-lists": "0.76.0-0rc1",
113
+ "@react-native/assets-registry": "0.76.0-rc.2",
114
+ "@react-native/codegen": "0.76.0-rc.2",
115
+ "@react-native/community-cli-plugin": "0.76.0-rc.2",
116
+ "@react-native/gradle-plugin": "0.76.0-rc.2",
117
+ "@react-native/js-polyfills": "0.76.0-rc.2",
118
+ "@react-native/normalize-colors": "0.76.0-rc.2",
119
+ "@react-native-tvos/virtualized-lists": "0.76.0-0rc2",
120
120
  "abort-controller": "^3.0.0",
121
121
  "anser": "^1.4.9",
122
122
  "ansi-regex": "^5.0.0",
123
+ "babel-jest": "^29.7.0",
124
+ "babel-plugin-syntax-hermes-parser": "^0.23.1",
123
125
  "base64-js": "^1.5.1",
124
126
  "chalk": "^4.0.0",
125
127
  "commander": "^12.0.0",
@@ -700,10 +700,18 @@ class ReactNativePodsUtils
700
700
  map[field] = "$(inherited)" + flag
701
701
  else
702
702
  unless map[field].include?(flag)
703
- map[field] = map[field] + flag
703
+ if map[field].instance_of? String
704
+ map[field] = map[field] + flag
705
+ elsif map[field].instance_of? Array
706
+ map[field].push(flag)
707
+ end
704
708
  end
705
709
  unless map[field].include?("$(inherited)")
706
- map[field] = "$(inherited) " + map[field]
710
+ if map[field].instance_of? String
711
+ map[field] = "$(inherited) " + map[field]
712
+ elsif map[field].instance_of? Array
713
+ map[field].unshift("$(inherited)")
714
+ end
707
715
  end
708
716
  end
709
717
  end
@@ -92,6 +92,8 @@ fi
92
92
 
93
93
  [ -z "$CLI_PATH" ] && CLI_PATH="$REACT_NATIVE_DIR/scripts/bundle.js"
94
94
 
95
+ [ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle"
96
+
95
97
  [ -z "$COMPOSE_SOURCEMAP_PATH" ] && COMPOSE_SOURCEMAP_PATH="$REACT_NATIVE_DIR/scripts/compose-source-maps.js"
96
98
 
97
99
  if [[ -z "$BUNDLE_CONFIG" ]]; then
@@ -8,7 +8,7 @@ require_relative "./hermes-utils.rb"
8
8
 
9
9
  react_native_path = File.dirname(Pod::Executable.execute_command('node', ['-p',
10
10
  'require.resolve(
11
- "react-native-tvos",
11
+ "react-native",
12
12
  {paths: [process.argv[1]]},
13
13
  )', __dir__]).strip
14
14
  )
@@ -52,10 +52,24 @@ function build_framework {
52
52
  fi
53
53
  }
54
54
 
55
+ # Allows RNTV CI to optionally build Vision OS framework
56
+ function set_include_vision {
57
+ if [[ "$INCLUDE_VISION_OS" == "0" || "$INCLUDE_VISION_OS" == "false" || "$INCLUDE_VISION_OS" == "FALSE" ]]; then
58
+ include_vision=0
59
+ else
60
+ include_vision=1
61
+ fi
62
+ }
63
+
55
64
  # group the frameworks together to create a universal framework
56
65
  function build_universal_framework {
57
66
  if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
58
- create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator"
67
+ set_include_vision
68
+ if [[ $include_vision == 1 ]]; then
69
+ create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator"
70
+ else
71
+ create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "appletvos" "appletvsimulator"
72
+ fi
59
73
  else
60
74
  echo "Skipping; Clean \"destroot\" to rebuild".
61
75
  fi
@@ -65,14 +79,17 @@ function build_universal_framework {
65
79
  # this is used to preserve backward compatibility
66
80
  function create_framework {
67
81
  if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
82
+ set_include_vision
83
+
68
84
  build_framework "iphoneos"
69
85
  build_framework "iphonesimulator"
70
86
  build_framework "appletvos"
71
87
  build_framework "appletvsimulator"
72
88
  build_framework "catalyst"
73
- build_framework "xros"
74
- build_framework "xrsimulator"
75
-
89
+ if [[ $include_vision == 1 ]]; then
90
+ build_framework "xros"
91
+ build_framework "xrsimulator"
92
+ fi
76
93
  build_universal_framework
77
94
  else
78
95
  echo "Skipping; Clean \"destroot\" to rebuild".
Binary file
Binary file
Binary file