react-native-tvos 0.83.0-0rc4 → 0.83.1-1
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.
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/README.md +16 -54
- package/React/Base/RCTVersion.m +2 -2
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +0 -12
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +1 -14
- package/React/Views/RCTTVView.h +6 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkEventUtil.kt +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +8 -20
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +1 -1
- package/ReactAndroid/src/main/jni/CMakeLists.txt +7 -0
- package/ReactAndroid/src/main/jni/react/devsupport/CMakeLists.txt +7 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +3 -3
- package/ReactCommon/jsinspector-modern/HostAgent.cpp +2 -2
- package/ReactCommon/jsinspector-modern/InspectorInterfaces.cpp +10 -5
- package/ReactCommon/jsinspector-modern/InspectorInterfaces.h +2 -2
- package/ReactCommon/jsinspector-modern/TracingAgent.cpp +1 -1
- package/package.json +9 -8
- package/react-native.config.js +17 -0
- package/scripts/cocoapods/utils.rb +2 -0
- package/tvosCommands.js +51 -0
- package/types/public/ReactNativeTVTypes.d.ts +7 -0
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
export default class ReactNativeVersion {
|
|
29
29
|
static major: number = 0;
|
|
30
30
|
static minor: number = 83;
|
|
31
|
-
static patch: number =
|
|
32
|
-
static prerelease: string | null = '
|
|
31
|
+
static patch: number = 1;
|
|
32
|
+
static prerelease: string | null = '1';
|
|
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
|
-
###
|
|
97
|
+
### Creating a new project with the Community CLI
|
|
98
98
|
|
|
99
|
-
|
|
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
|
-
>
|
|
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
|
-
#
|
|
108
|
-
|
|
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
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -23,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
|
|
23
23
|
__rnVersion = @{
|
|
24
24
|
RCTVersionMajor: @(0),
|
|
25
25
|
RCTVersionMinor: @(83),
|
|
26
|
-
RCTVersionPatch: @(
|
|
27
|
-
RCTVersionPrerelease: @"
|
|
26
|
+
RCTVersionPatch: @(1),
|
|
27
|
+
RCTVersionPrerelease: @"1",
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
return __rnVersion;
|
|
@@ -1146,13 +1146,11 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
1146
1146
|
if (context.nextFocusedView == self) {
|
|
1147
1147
|
[self becomeFirstResponder];
|
|
1148
1148
|
[self addSwipeGestureRecognizers];
|
|
1149
|
-
[self sendFocusNotification];
|
|
1150
1149
|
// if we enter the scroll view from different view then block first touch event since it is the event that triggered the focus
|
|
1151
1150
|
_blockFirstTouch = (unsigned long)context.focusHeading != 0;
|
|
1152
1151
|
[self addArrowsListeners];
|
|
1153
1152
|
} else if (context.previouslyFocusedView == self) {
|
|
1154
1153
|
[self removeArrowsListeners];
|
|
1155
|
-
[self sendBlurNotification];
|
|
1156
1154
|
[self removeSwipeGestureRecognizers];
|
|
1157
1155
|
[self resignFirstResponder];
|
|
1158
1156
|
// If scrolling is enabled:
|
|
@@ -1261,16 +1259,6 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
1261
1259
|
return [super shouldUpdateFocusInContext:context];
|
|
1262
1260
|
}
|
|
1263
1261
|
|
|
1264
|
-
- (void)sendFocusNotification
|
|
1265
|
-
{
|
|
1266
|
-
[[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:@(self.tag) target:nil];
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
- (void)sendBlurNotification
|
|
1270
|
-
{
|
|
1271
|
-
[[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:@(self.tag) target:nil];
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
1262
|
- (NSInteger)swipeVerticalInterval
|
|
1275
1263
|
{
|
|
1276
1264
|
RCTEnhancedScrollView *scrollView = (RCTEnhancedScrollView *)_scrollView;
|
|
@@ -265,16 +265,6 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
|
|
|
265
265
|
[self handleFocusGuide];
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
- (void)sendFocusNotification:(__unused UIFocusUpdateContext *)context
|
|
269
|
-
{
|
|
270
|
-
[[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:@(self.tag) target:@(self.tag)];
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
- (void)sendBlurNotification:(__unused UIFocusUpdateContext *)context
|
|
274
|
-
{
|
|
275
|
-
[[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:@(self.tag) target:@(self.tag)];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
268
|
- (void)sendSelectNotification
|
|
279
269
|
{
|
|
280
270
|
[[NSNotificationCenter defaultCenter] postNavigationPressEventWithType:RCTTVRemoteEventSelect keyAction:RCTTVRemoteEventKeyActionUp tag:@(self.tag) target:@(self.tag)];
|
|
@@ -596,7 +586,6 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
|
|
|
596
586
|
[self enableDirectionalFocusGuides];
|
|
597
587
|
[coordinator addCoordinatedAnimations:^(void){
|
|
598
588
|
if (self->_eventEmitter) self->_eventEmitter->onFocus();
|
|
599
|
-
[self sendFocusNotification:context];
|
|
600
589
|
[self addParallaxMotionEffects];
|
|
601
590
|
} completion:^(void){}];
|
|
602
591
|
// Without this check, onBlur would also trigger when `TVFocusGuideView` transfers focus to its children.
|
|
@@ -607,7 +596,6 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
|
|
|
607
596
|
[coordinator addCoordinatedAnimations:^(void){
|
|
608
597
|
[self removeParallaxMotionEffects];
|
|
609
598
|
if (self->_eventEmitter) self->_eventEmitter->onBlur();
|
|
610
|
-
[self sendBlurNotification:context];
|
|
611
599
|
} completion:^(void){}];
|
|
612
600
|
[self resignFirstResponder];
|
|
613
601
|
}
|
|
@@ -1166,7 +1154,6 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
|
|
|
1166
1154
|
// `autoFocus`
|
|
1167
1155
|
if (oldViewProps.autoFocus != newViewProps.autoFocus) {
|
|
1168
1156
|
_autoFocus = newViewProps.autoFocus;
|
|
1169
|
-
[self handleFocusGuide];
|
|
1170
1157
|
}
|
|
1171
1158
|
|
|
1172
1159
|
_trapFocusUp = newViewProps.trapFocusUp;
|
|
@@ -1228,7 +1215,7 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
|
|
|
1228
1215
|
[self requestFocusSelf];
|
|
1229
1216
|
}
|
|
1230
1217
|
}
|
|
1231
|
-
|
|
1218
|
+
[self handleFocusGuide];
|
|
1232
1219
|
#endif
|
|
1233
1220
|
|
|
1234
1221
|
if (_swiftUIWrapper != nullptr) {
|
package/React/Views/RCTTVView.h
CHANGED
|
@@ -70,11 +70,17 @@
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Send Focus Notifications to listeners
|
|
73
|
+
* @deprecated This method emits focus events to TVEventHandler, which is deprecated.
|
|
74
|
+
* Use onFocus/onBlur component props instead. Will be removed when old arch is removed.
|
|
75
|
+
* See: https://github.com/react-native-tvos/react-native-tvos/issues/1037
|
|
73
76
|
*/
|
|
74
77
|
- (void)sendFocusNotification:(UIFocusUpdateContext *)context;
|
|
75
78
|
|
|
76
79
|
/**
|
|
77
80
|
* Send Blur Notifications to listeners
|
|
81
|
+
* @deprecated This method emits blur events to TVEventHandler, which is deprecated.
|
|
82
|
+
* Use onFocus/onBlur component props instead. Will be removed when old arch is removed.
|
|
83
|
+
* See: https://github.com/react-native-tvos/react-native-tvos/issues/1037
|
|
78
84
|
*/
|
|
79
85
|
- (void)sendBlurNotification:(UIFocusUpdateContext *)context;
|
|
80
86
|
|
|
@@ -15,6 +15,7 @@ import com.facebook.react.bridge.Arguments
|
|
|
15
15
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
16
16
|
import com.facebook.react.bridge.WritableMap
|
|
17
17
|
import com.facebook.react.bridge.buildReadableArray
|
|
18
|
+
import com.facebook.react.common.build.ReactBuildConfig
|
|
18
19
|
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
|
19
20
|
import java.net.SocketTimeoutException
|
|
20
21
|
import okhttp3.Headers
|
|
@@ -30,12 +31,21 @@ internal object NetworkEventUtil {
|
|
|
30
31
|
fun onCreateRequest(devToolsRequestId: String, request: Request) {
|
|
31
32
|
if (ReactNativeFeatureFlags.enableNetworkEventReporting()) {
|
|
32
33
|
val headersMap = okHttpHeadersToMap(request.headers())
|
|
34
|
+
var requestBody = ""
|
|
35
|
+
|
|
36
|
+
if (ReactBuildConfig.DEBUG) {
|
|
37
|
+
// Debug build: Process request body for preview (CDP only)
|
|
38
|
+
requestBody =
|
|
39
|
+
(request.body() as? ProgressRequestBody)?.getBodyPreview()
|
|
40
|
+
?: request.body()?.toString().orEmpty()
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
InspectorNetworkReporter.reportRequestStart(
|
|
34
44
|
devToolsRequestId,
|
|
35
45
|
request.url().toString(),
|
|
36
46
|
request.method(),
|
|
37
47
|
headersMap,
|
|
38
|
-
|
|
48
|
+
requestBody,
|
|
39
49
|
request.body()?.contentLength() ?: 0,
|
|
40
50
|
)
|
|
41
51
|
InspectorNetworkReporter.reportConnectionTiming(devToolsRequestId, headersMap)
|
|
@@ -1448,7 +1448,13 @@ public open class ReactViewGroup public constructor(context: Context?) :
|
|
|
1448
1448
|
if (isFocusDestinationsSet) {
|
|
1449
1449
|
val destination = findDestinationView()
|
|
1450
1450
|
|
|
1451
|
-
|
|
1451
|
+
// Destination is set but there's no such element on the tree
|
|
1452
|
+
// Just skip it to prevent cyclic issues.
|
|
1453
|
+
if (destination == null) {
|
|
1454
|
+
return false
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
if (destination.requestFocus()) {
|
|
1452
1458
|
return true
|
|
1453
1459
|
}
|
|
1454
1460
|
}
|
|
@@ -1472,9 +1478,7 @@ public open class ReactViewGroup public constructor(context: Context?) :
|
|
|
1472
1478
|
}
|
|
1473
1479
|
|
|
1474
1480
|
// Try moving the focus to the first focusable element otherwise.
|
|
1475
|
-
|
|
1476
|
-
return true
|
|
1477
|
-
}
|
|
1481
|
+
return moveFocusToFirstFocusable(this)
|
|
1478
1482
|
}
|
|
1479
1483
|
|
|
1480
1484
|
return super.requestFocus(direction, previouslyFocusedRect)
|
|
@@ -1606,21 +1610,5 @@ public open class ReactViewGroup public constructor(context: Context?) :
|
|
|
1606
1610
|
fun setViewClipped(view: View, clipped: Boolean) {
|
|
1607
1611
|
view.setTag(R.id.view_clipped, clipped)
|
|
1608
1612
|
}
|
|
1609
|
-
|
|
1610
|
-
private fun requestFocusViewOrAncestor(destination: View): Boolean {
|
|
1611
|
-
var v: View? = destination
|
|
1612
|
-
while (v != null) {
|
|
1613
|
-
if (v.requestFocus()) {
|
|
1614
|
-
return true
|
|
1615
|
-
}
|
|
1616
|
-
val parent = v.parent
|
|
1617
|
-
v = if (parent is View) {
|
|
1618
|
-
parent
|
|
1619
|
-
} else {
|
|
1620
|
-
null
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
return false
|
|
1624
|
-
}
|
|
1625
1613
|
}
|
|
1626
1614
|
}
|
|
@@ -109,13 +109,13 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
|
|
|
109
109
|
|
|
110
110
|
@ReactProp(name = "tvFocusable")
|
|
111
111
|
public open fun setTvFocusable(view: ReactViewGroup, focusable: Boolean) {
|
|
112
|
-
setFocusable(view, focusable)
|
|
113
112
|
if (!focusable) {
|
|
114
113
|
view.isFocusable = false
|
|
115
114
|
view.descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
|
|
116
115
|
} else {
|
|
117
116
|
view.descendantFocusability = ViewGroup.FOCUS_AFTER_DESCENDANTS
|
|
118
117
|
}
|
|
118
|
+
setFocusable(view, focusable)
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
@ReactProp(name = ViewProps.ACCESSIBILITY_ORDER)
|
|
@@ -338,3 +338,10 @@ target_include_directories(reactnative
|
|
|
338
338
|
$<TARGET_PROPERTY:uimanagerjni,INTERFACE_INCLUDE_DIRECTORIES>
|
|
339
339
|
$<TARGET_PROPERTY:yoga,INTERFACE_INCLUDE_DIRECTORIES>
|
|
340
340
|
)
|
|
341
|
+
|
|
342
|
+
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
|
|
343
|
+
target_compile_options(reactnative PRIVATE
|
|
344
|
+
-DREACT_NATIVE_DEBUGGER_ENABLED=1
|
|
345
|
+
-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
|
|
346
|
+
)
|
|
347
|
+
endif ()
|
|
@@ -23,3 +23,10 @@ target_link_libraries(react_devsupportjni
|
|
|
23
23
|
react_networking)
|
|
24
24
|
|
|
25
25
|
target_compile_reactnative_options(react_devsupportjni PRIVATE)
|
|
26
|
+
|
|
27
|
+
if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
|
|
28
|
+
target_compile_options(react_devsupportjni PRIVATE
|
|
29
|
+
-DREACT_NATIVE_DEBUGGER_ENABLED=1
|
|
30
|
+
-DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
|
|
31
|
+
)
|
|
32
|
+
endif ()
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
#define REACT_NATIVE_VERSION_MAJOR 0
|
|
16
16
|
#define REACT_NATIVE_VERSION_MINOR 83
|
|
17
|
-
#define REACT_NATIVE_VERSION_PATCH
|
|
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 = 83;
|
|
24
|
-
int32_t Patch =
|
|
25
|
-
std::string_view Prerelease = "
|
|
24
|
+
int32_t Patch = 1;
|
|
25
|
+
std::string_view Prerelease = "1";
|
|
26
26
|
} ReactNativeVersion;
|
|
27
27
|
|
|
28
28
|
} // namespace facebook::react
|
|
@@ -147,7 +147,7 @@ class HostAgent::Impl final {
|
|
|
147
147
|
if (InspectorFlags::getInstance().getNetworkInspectionEnabled()) {
|
|
148
148
|
if (req.method == "Network.enable") {
|
|
149
149
|
auto& inspector = getInspectorInstance();
|
|
150
|
-
if (inspector.getSystemState().
|
|
150
|
+
if (inspector.getSystemState().registeredHostsCount > 1) {
|
|
151
151
|
frontendChannel_(
|
|
152
152
|
cdp::jsonError(
|
|
153
153
|
req.id,
|
|
@@ -231,7 +231,7 @@ class HostAgent::Impl final {
|
|
|
231
231
|
"ReactNativeApplication.metadataUpdated",
|
|
232
232
|
createHostMetadataPayload(hostMetadata_)));
|
|
233
233
|
auto& inspector = getInspectorInstance();
|
|
234
|
-
bool isSingleHost = inspector.getSystemState().
|
|
234
|
+
bool isSingleHost = inspector.getSystemState().registeredHostsCount <= 1;
|
|
235
235
|
if (!isSingleHost) {
|
|
236
236
|
emitSystemStateChanged(isSingleHost);
|
|
237
237
|
}
|
|
@@ -67,8 +67,8 @@ class InspectorImpl : public IInspector {
|
|
|
67
67
|
public:
|
|
68
68
|
explicit SystemStateListener(InspectorSystemState& state) : state_(state) {}
|
|
69
69
|
|
|
70
|
-
void
|
|
71
|
-
state_.
|
|
70
|
+
void unstable_onHostTargetAdded() override {
|
|
71
|
+
state_.registeredHostsCount++;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
private:
|
|
@@ -94,6 +94,7 @@ class InspectorImpl : public IInspector {
|
|
|
94
94
|
ConnectFunc connectFunc_;
|
|
95
95
|
InspectorTargetCapabilities capabilities_;
|
|
96
96
|
};
|
|
97
|
+
|
|
97
98
|
mutable std::mutex mutex_;
|
|
98
99
|
int nextPageId_{1};
|
|
99
100
|
std::map<int, Page> pages_;
|
|
@@ -142,9 +143,13 @@ int InspectorImpl::addPage(
|
|
|
142
143
|
pageId,
|
|
143
144
|
Page{pageId, description, vm, std::move(connectFunc), capabilities});
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
// Strong assumption: If prefersFuseboxFrontend is set, the page added is a
|
|
147
|
+
// HostTarget and not a legacy Hermes runtime target.
|
|
148
|
+
if (capabilities.prefersFuseboxFrontend) {
|
|
149
|
+
for (const auto& listenerWeak : listeners_) {
|
|
150
|
+
if (auto listener = listenerWeak.lock()) {
|
|
151
|
+
listener->unstable_onHostTargetAdded();
|
|
152
|
+
}
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
|
|
@@ -53,7 +53,7 @@ using InspectorPage = InspectorPageDescription;
|
|
|
53
53
|
|
|
54
54
|
struct InspectorSystemState {
|
|
55
55
|
/** The total count of pages registered during the app lifetime. */
|
|
56
|
-
int
|
|
56
|
+
int registeredHostsCount;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
/// IRemoteConnection allows the VM to send debugger messages to the client.
|
|
@@ -83,7 +83,7 @@ class JSINSPECTOR_EXPORT ILocalConnection : public IDestructible {
|
|
|
83
83
|
class JSINSPECTOR_EXPORT IPageStatusListener : public IDestructible {
|
|
84
84
|
public:
|
|
85
85
|
virtual ~IPageStatusListener() = 0;
|
|
86
|
-
virtual void
|
|
86
|
+
virtual void unstable_onHostTargetAdded() {}
|
|
87
87
|
virtual void onPageRemoved(int /*pageId*/) {}
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -54,7 +54,7 @@ TracingAgent::~TracingAgent() {
|
|
|
54
54
|
bool TracingAgent::handleRequest(const cdp::PreparsedRequest& req) {
|
|
55
55
|
if (req.method == "Tracing.start") {
|
|
56
56
|
auto& inspector = getInspectorInstance();
|
|
57
|
-
if (inspector.getSystemState().
|
|
57
|
+
if (inspector.getSystemState().registeredHostsCount > 1) {
|
|
58
58
|
frontendChannel_(
|
|
59
59
|
cdp::jsonError(
|
|
60
60
|
req.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tvos",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.1-1",
|
|
4
4
|
"description": "A framework for building native apps using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"React-Core.podspec",
|
|
92
92
|
"React-Core-prebuilt.podspec",
|
|
93
93
|
"react-native.config.js",
|
|
94
|
+
"tvosCommands.js",
|
|
94
95
|
"React.podspec",
|
|
95
96
|
"React",
|
|
96
97
|
"!React/Fabric/RCTThirdPartyFabricComponentsProvider.*",
|
|
@@ -164,12 +165,12 @@
|
|
|
164
165
|
},
|
|
165
166
|
"dependencies": {
|
|
166
167
|
"@jest/create-cache-key-function": "^29.7.0",
|
|
167
|
-
"@react-native/assets-registry": "0.83.
|
|
168
|
-
"@react-native/codegen": "0.83.
|
|
169
|
-
"@react-native/community-cli-plugin": "0.83.
|
|
170
|
-
"@react-native/gradle-plugin": "0.83.
|
|
171
|
-
"@react-native/js-polyfills": "0.83.
|
|
172
|
-
"@react-native/normalize-colors": "0.83.
|
|
168
|
+
"@react-native/assets-registry": "0.83.1",
|
|
169
|
+
"@react-native/codegen": "0.83.1",
|
|
170
|
+
"@react-native/community-cli-plugin": "0.83.1",
|
|
171
|
+
"@react-native/gradle-plugin": "0.83.1",
|
|
172
|
+
"@react-native/js-polyfills": "0.83.1",
|
|
173
|
+
"@react-native/normalize-colors": "0.83.1",
|
|
173
174
|
"abort-controller": "^3.0.0",
|
|
174
175
|
"anser": "^1.4.9",
|
|
175
176
|
"ansi-regex": "^5.0.0",
|
|
@@ -197,7 +198,7 @@
|
|
|
197
198
|
"whatwg-fetch": "^3.0.0",
|
|
198
199
|
"ws": "^7.5.10",
|
|
199
200
|
"yargs": "^17.6.2",
|
|
200
|
-
"@react-native-tvos/virtualized-lists": "0.83.
|
|
201
|
+
"@react-native-tvos/virtualized-lists": "0.83.1-1"
|
|
201
202
|
},
|
|
202
203
|
"codegenConfig": {
|
|
203
204
|
"libraries": [
|
package/react-native.config.js
CHANGED
|
@@ -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;
|
|
@@ -58,9 +58,11 @@ class ReactNativePodsUtils
|
|
|
58
58
|
|
|
59
59
|
def self.set_gcc_preprocessor_definition_for_debugger(installer)
|
|
60
60
|
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspector", :debug)
|
|
61
|
+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspectornetwork", :debug)
|
|
61
62
|
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-RCTNetwork", :debug)
|
|
62
63
|
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-networking", :debug)
|
|
63
64
|
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspector", :debug)
|
|
65
|
+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspectornetwork", :debug)
|
|
64
66
|
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-RCTNetwork", :debug)
|
|
65
67
|
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-networking", :debug)
|
|
66
68
|
end
|
package/tvosCommands.js
ADDED
|
@@ -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];
|
|
@@ -52,6 +52,13 @@ declare module 'react-native' {
|
|
|
52
52
|
disableGestureHandlersCancelTouches(): void;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Hardware event received from TVEventHandler
|
|
57
|
+
*
|
|
58
|
+
* Note: The 'blur' and 'focus' event types are deprecated and will no longer be
|
|
59
|
+
* emitted on new architecture (Fabric). Use onFocus/onBlur component props instead.
|
|
60
|
+
* See: https://github.com/react-native-tvos/react-native-tvos/issues/1037
|
|
61
|
+
*/
|
|
55
62
|
export type HWEvent = {
|
|
56
63
|
eventType: 'up' | 'down' | 'right' | 'left' | 'longUp' | 'longDown' | 'longRight' | 'longLeft' | 'blur' | 'focus' | 'pan' | string;
|
|
57
64
|
eventKeyAction?: -1 | 1 | 0 | number | undefined;
|