react-native-tvos 0.84.0-0rc5 → 0.84.1-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.
@@ -28,8 +28,8 @@
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 84;
31
- static patch: number = 0;
32
- static prerelease: string | null = '0rc5';
31
+ static patch: number = 1;
32
+ static prerelease: string | null = '0';
33
33
 
34
34
  static getVersionString(): string {
35
35
  return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
package/README.md CHANGED
@@ -94,64 +94,26 @@ See the [Building Expo apps for TV](https://docs.expo.dev/guides/building-for-tv
94
94
 
95
95
  Using Expo's [continuous native generation (CNG)](https://docs.expo.dev/workflow/continuous-native-generation/) model, projects created this way can be used to build either mobile or TV apps, taking advantage of the full support for both mobile and TV platforms in this repo.
96
96
 
97
- ### Project creation using the React Native Community CLI
97
+ ### Creating a new project with the Community CLI
98
98
 
99
- As of React Native 0.75.x, the template that used to reside in the `react-native` core package has been moved to a [new community repo](https://github.com/react-native-community/template) and will be maintained there. To support developers that wish to continue using the community CLI, we have created a [new TV template repository](https://github.com/react-native-tvos/template-tv) and will maintain a TV port of this template.
99
+ We maintain [template-tv](https://github.com/react-native-tvos/template-tv), a TV-specific template for developers using the React Native Community CLI. This project extends the Community CLI with `run-tvos`, `build-tvos`, and `log-tvos` commands for tvOS development.
100
100
 
101
- > _Note:_ The new TV template will only build apps for Apple TV and Android TV. Multiple platform targets are no longer supported in React Native app Podfiles.
102
-
103
- To create a new project for RNTV 0.81:
101
+ > [!NOTE]
102
+ > This template only supports Apple TV and Android TV. Multiple platform targets are no longer supported in React Native app Podfiles.
104
103
 
104
+ **Quick start:**
105
105
  ```sh
106
- #
107
- # Init an app called 'TVTest', note that you must not be in a node module (directory with node_modules sub-directory) for this to work
108
- $ npx @react-native-community/cli@latest init TVTest --template @react-native-tvos/template-tv
109
-
110
- ###### ######
111
- ### #### #### ###
112
- ## ### ### ##
113
- ## #### ##
114
- ## #### ##
115
- ## ## ## ##
116
- ## ### ### ##
117
- ## ######################## ##
118
- ###### ### ### ######
119
- ### ## ## ## ## ###
120
- ### ## ### #### ### ## ###
121
- ## #### ######## #### ##
122
- ## ### ########## ### ##
123
- ## #### ######## #### ##
124
- ### ## ### #### ### ## ###
125
- ### ## ## ## ## ###
126
- ###### ### ### ######
127
- ## ######################## ##
128
- ## ### ### ##
129
- ## ## ## ##
130
- ## #### ##
131
- ## #### ##
132
- ## ### ### ##
133
- ### #### #### ###
134
- ###### ######
135
-
136
-
137
- Welcome to React Native 0.81!
138
- Learn once, write anywhere
139
-
140
- ✔ Downloading template
141
- ✔ Copying template
142
- ✔ Processing template
143
- ✔ Installing dependencies
144
- ✔ Do you want to install CocoaPods now? Only needed if you run your project in Xcode directly … yes
145
- ✔ Installing Ruby Gems
146
- ✔ Installing CocoaPods dependencies (this may take a few minutes)
147
- .
148
- .
149
- .
150
- $ cd TVTest
151
- # Now build and start the app in the tvOS Simulator - this will only work on a macOS machine.
152
- npx react-native run-ios --simulator "Apple TV"
153
- # This command builds and starts the app in an Android TV emulator (needs to be created in advance).
154
- npx react-native run:android --device tv_api_31
106
+ # Initialize a new app called 'TVTest'
107
+ # This command should be run outside of any existing node project
108
+ npx @react-native-community/cli@latest init TVTest --template @react-native-tvos/template-tv
109
+
110
+ cd TVTest
111
+
112
+ # Build and run on tvOS Simulator (macOS only, requires Apple TV simulator)
113
+ npx react-native run-tvos --simulator "Apple TV"
114
+
115
+ # Build and run on Android TV emulator (requires Android TV emulator)
116
+ npx react-native run-android --device tv_api_31
155
117
  ```
156
118
 
157
119
  ## How to support TV specific file extensions
@@ -23,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(84),
26
- RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"0rc5",
26
+ RCTVersionPatch: @(1),
27
+ RCTVersionPrerelease: @"0",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -1139,6 +1139,16 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
1139
1139
  #pragma mark Apple TV swipe and focus handling
1140
1140
 
1141
1141
  #if TARGET_OS_TV
1142
+ - (void)sendFocusEvent
1143
+ {
1144
+ self->_eventEmitter->onFocus();
1145
+ }
1146
+
1147
+ - (void)sendBlurEvent
1148
+ {
1149
+ self->_eventEmitter->onBlur();
1150
+ }
1151
+
1142
1152
  - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
1143
1153
  withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
1144
1154
  {
@@ -1148,11 +1158,13 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
1148
1158
  if (context.nextFocusedView == self) {
1149
1159
  [self becomeFirstResponder];
1150
1160
  [self addSwipeGestureRecognizers];
1161
+ [self sendFocusEvent];
1151
1162
  // if we enter the scroll view from different view then block first touch event since it is the event that triggered the focus
1152
1163
  _blockFirstTouch = (unsigned long)context.focusHeading != 0;
1153
1164
  [self addArrowsListeners];
1154
1165
  } else if (context.previouslyFocusedView == self) {
1155
1166
  [self removeArrowsListeners];
1167
+ [self sendBlurEvent];
1156
1168
  [self removeSwipeGestureRecognizers];
1157
1169
  [self resignFirstResponder];
1158
1170
  // If scrolling is enabled:
@@ -88,6 +88,7 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
88
88
  NSArray* _focusDestinations;
89
89
  id<UIFocusItem> _previouslyFocusedItem;
90
90
  RCTSwiftUIContainerViewWrapper *_swiftUIWrapper;
91
+ BOOL _shouldFocusOnMount;
91
92
  }
92
93
 
93
94
  #ifdef RCT_DYNAMIC_FRAMEWORKS
@@ -113,6 +114,8 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
113
114
  _tvParallaxProperties.pressMagnification = 1.0f;
114
115
  _tvParallaxProperties.pressDuration = 0.3f;
115
116
  _tvParallaxProperties.pressDelay = 0.0f;
117
+
118
+ _shouldFocusOnMount = false;
116
119
  #else
117
120
  self.multipleTouchEnabled = YES;
118
121
  #endif
@@ -170,6 +173,15 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
170
173
 
171
174
  #pragma mark - Apple TV methods
172
175
 
176
+ - (void)didMoveToWindow {
177
+ [super didMoveToWindow];
178
+
179
+ if (self->_shouldFocusOnMount) {
180
+ self->_shouldFocusOnMount = false;
181
+ [self focusSelf];
182
+ }
183
+ }
184
+
173
185
  - (RCTSurfaceHostingProxyRootView *)containingRootView
174
186
  {
175
187
  UIView *rootview = self;
@@ -205,10 +217,8 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
205
217
  if (!focusedSync) {
206
218
  // `focusSelf` function relies on `rootView` which may not be present on the first render.
207
219
  // `focusSelf` fails and returns `false` in that case. We try re-executing the same action
208
- // by putting it to the main queue to make sure it runs after UI creation is completed.
209
- dispatch_async(dispatch_get_main_queue(), ^{
210
- [self focusSelf];
211
- });
220
+ // when the view has moved to the window. This is tracked by the `_shouldFocusOnMount` flag.
221
+ self->_shouldFocusOnMount = true;
212
222
  }
213
223
  }
214
224
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.84.0-0rc5
1
+ VERSION_NAME=0.84.1-0
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
  react.internal.hermesPublishingGroup=com.facebook.hermes
4
4
 
@@ -14,7 +14,7 @@ public object ReactNativeVersion {
14
14
  public val VERSION: Map<String, Any?> = mapOf(
15
15
  "major" to 0,
16
16
  "minor" to 84,
17
- "patch" to 0,
18
- "prerelease" to "0rc5"
17
+ "patch" to 1,
18
+ "prerelease" to "0"
19
19
  )
20
20
  }
@@ -14,15 +14,15 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 84
17
- #define REACT_NATIVE_VERSION_PATCH 0
17
+ #define REACT_NATIVE_VERSION_PATCH 1
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 84;
24
- int32_t Patch = 0;
25
- std::string_view Prerelease = "0rc5";
24
+ int32_t Patch = 1;
25
+ std::string_view Prerelease = "0";
26
26
  } ReactNativeVersion;
27
27
 
28
28
  } // namespace facebook::react
@@ -8,10 +8,13 @@
8
8
  #include "Registration.h"
9
9
  #include "ConnectionDemux.h"
10
10
 
11
- #if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
11
+ #if defined(HERMES_ENABLE_DEBUGGER)
12
12
 
13
- namespace facebook::hermes::inspector_modern::chrome {
13
+ #include <hermes/hermes.h>
14
+
15
+ #if !defined(HERMES_V1_ENABLED)
14
16
 
17
+ namespace facebook::hermes::inspector_modern::chrome {
15
18
  namespace {
16
19
 
17
20
  ConnectionDemux& demux() {
@@ -34,4 +37,42 @@ void disableDebugging(DebugSessionToken session) {
34
37
 
35
38
  } // namespace facebook::hermes::inspector_modern::chrome
36
39
 
37
- #endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
40
+ #else
41
+
42
+ namespace facebook::hermes::inspector_modern {
43
+ class RuntimeAdapter {
44
+ // Backwards compatibility definition fallback for libraries that are compiled
45
+ // without `HERMES_V1_ENABLED` but are linked against React Native with
46
+ // `HERMES_V1_ENABLED` which doesn't provide this symbol.
47
+ public:
48
+ virtual ~RuntimeAdapter() = 0;
49
+ virtual HermesRuntime& getRuntime() = 0;
50
+ virtual void tickleJs();
51
+ };
52
+
53
+ namespace chrome {
54
+
55
+ using DebugSessionToken = int;
56
+
57
+ DebugSessionToken enableDebugging(
58
+ std::unique_ptr<RuntimeAdapter>,
59
+ const std::string&) {
60
+ // Backwards compatibility fallback for libraries that are compiled without
61
+ // `HERMES_V1_ENABLED` but are linked against React Native with
62
+ // `HERMES_V1_ENABLED` which doesn't provide this symbol.
63
+ return -1;
64
+ };
65
+
66
+ void disableDebugging(DebugSessionToken) {
67
+ // Backwards compatibility fallback for libraries that are compiled without
68
+ // `HERMES_V1_ENABLED` but are linked against React Native with
69
+ // `HERMES_V1_ENABLED` which doesn't provide this symbol.
70
+ }
71
+
72
+ } // namespace chrome
73
+
74
+ } // namespace facebook::hermes::inspector_modern
75
+
76
+ #endif // !defined(HERMES_V1_ENABLED)
77
+
78
+ #endif // defined(HERMES_ENABLE_DEBUGGER)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.84.0-0rc5",
3
+ "version": "0.84.1-0",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -165,12 +165,12 @@
165
165
  },
166
166
  "dependencies": {
167
167
  "@jest/create-cache-key-function": "^29.7.0",
168
- "@react-native/assets-registry": "0.84.0-rc.5",
169
- "@react-native/codegen": "0.84.0-rc.5",
170
- "@react-native/community-cli-plugin": "0.84.0-rc.5",
171
- "@react-native/gradle-plugin": "0.84.0-rc.5",
172
- "@react-native/js-polyfills": "0.84.0-rc.5",
173
- "@react-native/normalize-colors": "0.84.0-rc.5",
168
+ "@react-native/assets-registry": "0.84.1",
169
+ "@react-native/codegen": "0.84.1",
170
+ "@react-native/community-cli-plugin": "0.84.1",
171
+ "@react-native/gradle-plugin": "0.84.1",
172
+ "@react-native/js-polyfills": "0.84.1",
173
+ "@react-native/normalize-colors": "0.84.1",
174
174
  "abort-controller": "^3.0.0",
175
175
  "anser": "^1.4.9",
176
176
  "ansi-regex": "^5.0.0",
@@ -179,7 +179,7 @@
179
179
  "base64-js": "^1.5.1",
180
180
  "commander": "^12.0.0",
181
181
  "flow-enums-runtime": "^0.0.6",
182
- "hermes-compiler": "250829098.0.7",
182
+ "hermes-compiler": "250829098.0.9",
183
183
  "invariant": "^2.2.4",
184
184
  "jest-environment-node": "^29.7.0",
185
185
  "memoize-one": "^5.0.0",
@@ -198,7 +198,7 @@
198
198
  "whatwg-fetch": "^3.0.0",
199
199
  "ws": "^7.5.10",
200
200
  "yargs": "^17.6.2",
201
- "@react-native-tvos/virtualized-lists": "0.84.0-0rc5"
201
+ "@react-native-tvos/virtualized-lists": "0.84.1-0"
202
202
  },
203
203
  "codegenConfig": {
204
204
  "libraries": [
@@ -136,4 +136,21 @@ if (android != null) {
136
136
  };
137
137
  }
138
138
 
139
+ try {
140
+ const apple = require('@react-native-community/cli-platform-apple');
141
+ const tvosCommands = require('./tvosCommands');
142
+
143
+ config.commands.push(...tvosCommands);
144
+ config.platforms.tvos = {
145
+ projectConfig: apple.getProjectConfig({platformName: 'tvos'}),
146
+ dependencyConfig: apple.getDependencyConfig({platformName: 'tvos'}),
147
+ };
148
+ } catch {
149
+ if (verbose) {
150
+ console.warn(
151
+ '@react-native-community/cli-platform-apple not found, the react-native.config.js may be unusable.',
152
+ );
153
+ }
154
+ }
155
+
139
156
  module.exports = config;
@@ -1 +1 @@
1
- hermes-v250829098.0.8
1
+ hermes-v250829098.0.9
@@ -1,2 +1,2 @@
1
- HERMES_VERSION_NAME=0.14.1
2
- HERMES_V1_VERSION_NAME=250829098.0.7
1
+ HERMES_VERSION_NAME=0.15.1
2
+ HERMES_V1_VERSION_NAME=250829098.0.9
@@ -47,8 +47,28 @@ buildscript {
47
47
  val properties = java.util.Properties()
48
48
  val propertiesToInherit = listOf("hermesV1Enabled", "react.hermesV1Enabled")
49
49
 
50
+ // We cannot assume that the node_modules are next to the android project, for example
51
+ // in monorepos, they might get hoisted.
52
+ // In a composite build, this included build can access the invoking (consumer) build
53
+ // via `gradle.parent`. We use its StartParameter to locate the app's `gradle.properties`:
54
+ // - `projectDir/gradle.properties` when Gradle is run with `-p <androidDir>`
55
+ // - `currentDir/gradle.properties` when run from the app android folder
56
+ // If neither exists, we keep the legacy RN fallback path below.
57
+
58
+ val parentGradle = gradle.parent
59
+ val parentProjectDir = parentGradle?.startParameter?.projectDir
60
+ val parentCurrentDir = parentGradle?.startParameter?.currentDir
61
+ val gradlePropertiesCandidates =
62
+ listOfNotNull(
63
+ parentProjectDir?.resolve("gradle.properties"),
64
+ parentCurrentDir?.resolve("gradle.properties"),
65
+ // Backward-compatible fallback for classic RN app layouts.
66
+ file("../../android/gradle.properties"),
67
+ )
68
+
50
69
  try {
51
- file("../../android/gradle.properties").inputStream().use { properties.load(it) }
70
+ val propertiesFile = gradlePropertiesCandidates.firstOrNull { it.exists() }
71
+ propertiesFile?.inputStream()?.use { properties.load(it) }
52
72
 
53
73
  gradle.rootProject {
54
74
  propertiesToInherit.forEach { property ->
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @flow
3
+ */
4
+
5
+ let apple;
6
+ try {
7
+ apple = require('@react-native-community/cli-platform-apple');
8
+ } catch {
9
+ if (verbose) {
10
+ console.warn(
11
+ '@react-native-community/cli-platform-apple not found, the react-native.config.js may be unusable.'
12
+ );
13
+ }
14
+ }
15
+
16
+ const platformName = 'tvos';
17
+
18
+ const run = {
19
+ name: `run-${platformName}`,
20
+ description: 'builds your app and starts it on a tvOS simulator or Apple TV device',
21
+ func: apple.createRun({platformName}),
22
+ examples: [
23
+ {
24
+ desc: 'Run on a specific simulator',
25
+ cmd: `npx react-native run-${platformName} --simulator "Apple TV"`,
26
+ },
27
+ ],
28
+ options: apple.getRunOptions({platformName}),
29
+ };
30
+
31
+ const log = {
32
+ name: `log-${platformName}`,
33
+ description: 'displays system logs from a connected tvOS device or simulator',
34
+ func: apple.createLog({platformName: platformName}),
35
+ options: apple.getLogOptions({platformName}),
36
+ };
37
+
38
+ const build = {
39
+ name: `build-${platformName}`,
40
+ description: 'builds your app for tvOS',
41
+ func: apple.createBuild({platformName}),
42
+ examples: [
43
+ {
44
+ desc: 'Build the app for all tvOS devices in Release mode',
45
+ cmd: `npx react-native build-${platformName} --mode "Release"`,
46
+ },
47
+ ],
48
+ options: apple.getBuildOptions({platformName}),
49
+ };
50
+
51
+ module.exports = [run, log, build];