react-native-tvos 0.83.2-0 → 0.83.4-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 (64) hide show
  1. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +1 -0
  2. package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -1
  3. package/Libraries/Components/ScrollView/ScrollView.js +8 -1
  4. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -0
  5. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +2 -1
  6. package/Libraries/Components/TV/TVViewPropTypes.js +7 -0
  7. package/Libraries/Components/View/View.js +6 -0
  8. package/Libraries/Core/ReactNativeVersion.js +1 -1
  9. package/Libraries/Core/setUpReactDevTools.js +23 -6
  10. package/Libraries/NativeComponent/TVViewConfig.js +1 -0
  11. package/Libraries/Network/RCTHTTPRequestHandler.h +9 -0
  12. package/Libraries/Network/RCTHTTPRequestHandler.mm +15 -1
  13. package/Libraries/Pressability/Pressability.js +7 -0
  14. package/Libraries/WebSocket/RCTReconnectingWebSocket.m +4 -1
  15. package/React/Base/RCTBundleURLProvider.mm +5 -3
  16. package/React/Base/RCTDevSupportHttpHeaders.h +24 -0
  17. package/React/Base/RCTDevSupportHttpHeaders.m +65 -0
  18. package/React/Base/RCTMultipartDataTask.h +9 -0
  19. package/React/Base/RCTMultipartDataTask.m +16 -1
  20. package/React/Base/RCTVersion.m +1 -1
  21. package/React/CoreModules/RCTWebSocketModule.h +6 -0
  22. package/React/CoreModules/RCTWebSocketModule.mm +14 -1
  23. package/React/DevSupport/RCTInspectorDevServerHelper.mm +33 -22
  24. package/React/DevSupport/RCTInspectorNetworkHelper.mm +2 -0
  25. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +1 -0
  26. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +3 -0
  27. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +110 -4
  28. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +2 -0
  29. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +31 -4
  30. package/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm +5 -1
  31. package/ReactAndroid/api/ReactAndroid.api +1 -0
  32. package/ReactAndroid/gradle.properties +1 -1
  33. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +2 -8
  34. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt +17 -13
  35. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.kt +10 -19
  36. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt +2 -2
  37. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/DevSupportHttpClient.kt +49 -0
  38. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt +1 -12
  39. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  40. package/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.kt +3 -4
  41. package/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/JSPackagerClient.kt +2 -1
  42. package/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.kt +2 -8
  43. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +49 -5
  44. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt +7 -0
  45. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +46 -4
  46. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +69 -0
  47. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +7 -0
  48. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +1 -0
  49. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +4 -0
  50. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  51. package/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp +10 -0
  52. package/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.h +1 -0
  53. package/ReactCommon/react/renderer/components/scrollview/conversions.h +6 -0
  54. package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp +18 -1
  55. package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.h +2 -0
  56. package/ReactCommon/react/renderer/components/scrollview/primitives.h +1 -1
  57. package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +11 -1
  58. package/ReactCommon/react/renderer/components/view/BaseViewProps.h +4 -0
  59. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +18 -0
  60. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h +1 -0
  61. package/package.json +8 -8
  62. package/scripts/replace-rncore-version.js +62 -8
  63. package/settings.gradle.kts +21 -1
  64. package/types/public/ReactNativeTVTypes.d.ts +19 -2
@@ -12,6 +12,8 @@
12
12
 
13
13
  const {spawnSync} = require('child_process');
14
14
  const fs = require('fs');
15
+ const os = require('os');
16
+ const path = require('path');
15
17
  const yargs = require('yargs');
16
18
 
17
19
  const LAST_BUILD_FILENAME = 'React-Core-prebuilt/.last_build_configuration';
@@ -62,14 +64,66 @@ function replaceRNCoreConfiguration(
62
64
  const tarballURLPath = `${podsRoot}/ReactNativeCore-artifacts/reactnative-core-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`;
63
65
 
64
66
  const finalLocation = 'React-Core-prebuilt';
65
- console.log('Preparing the final location', finalLocation);
66
- fs.rmSync(finalLocation, {force: true, recursive: true});
67
- fs.mkdirSync(finalLocation, {recursive: true});
68
-
69
- console.log('Extracting the tarball', tarballURLPath);
70
- spawnSync('tar', ['-xf', tarballURLPath, '-C', finalLocation], {
71
- stdio: 'inherit',
72
- });
67
+
68
+ // Extract to a temporary directory on a regular filesystem first, then move
69
+ // into the final location. This avoids issues with partial tar extraction on
70
+ // certain filesystems (e.g. EdenFS) where extracting directly can silently
71
+ // produce incomplete results.
72
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'rncore-'));
73
+ const tmpExtractDir = path.join(tmpDir, 'React-Core-prebuilt');
74
+ fs.mkdirSync(tmpExtractDir, {recursive: true});
75
+
76
+ try {
77
+ console.log('Extracting the tarball to temp dir', tarballURLPath);
78
+ const result = spawnSync(
79
+ 'tar',
80
+ ['-xf', tarballURLPath, '-C', tmpExtractDir],
81
+ {
82
+ stdio: 'inherit',
83
+ },
84
+ );
85
+
86
+ if (result.status !== 0) {
87
+ throw new Error(`tar extraction failed with exit code ${result.status}`);
88
+ }
89
+
90
+ // Verify extraction produced the expected xcframework structure
91
+ const xcfwPath = path.join(tmpExtractDir, 'React.xcframework');
92
+ const modulemapPath = path.join(xcfwPath, 'Modules', 'module.modulemap');
93
+ if (!fs.existsSync(modulemapPath)) {
94
+ throw new Error(
95
+ `Extraction verification failed: ${modulemapPath} not found`,
96
+ );
97
+ }
98
+
99
+ // Move from temp to final location
100
+ console.log('Preparing the final location', finalLocation);
101
+ fs.rmSync(finalLocation, {force: true, recursive: true});
102
+
103
+ // Use mv for an atomic-ish replacement. If the final location is on the
104
+ // same filesystem as tmpDir this is a rename; otherwise it falls back to
105
+ // copy + delete via spawnSync.
106
+ const mvResult = spawnSync('mv', [tmpExtractDir, finalLocation], {
107
+ stdio: 'inherit',
108
+ });
109
+
110
+ if (mvResult.status !== 0) {
111
+ // Fallback: copy recursively then remove temp
112
+ console.log('mv failed, falling back to cp -R');
113
+ fs.mkdirSync(finalLocation, {recursive: true});
114
+ const cpResult = spawnSync(
115
+ 'cp',
116
+ ['-R', tmpExtractDir + '/.', finalLocation],
117
+ {stdio: 'inherit'},
118
+ );
119
+ if (cpResult.status !== 0) {
120
+ throw new Error(`cp fallback failed with exit code ${cpResult.status}`);
121
+ }
122
+ }
123
+ } finally {
124
+ // Clean up temp directory
125
+ fs.rmSync(tmpDir, {force: true, recursive: true});
126
+ }
73
127
  }
74
128
 
75
129
  function updateLastBuildConfiguration(configuration /*: string */) {
@@ -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 ->
@@ -4,7 +4,24 @@ import type { View, ScrollViewProps, HostComponent, EventSubscription, TVParalla
4
4
  declare module 'react-native' {
5
5
  export type FocusDestination = null | number | React.Component<any, any> | React.ComponentClass<any>;
6
6
 
7
+ interface ScrollViewProps {
8
+ /**
9
+ * Padding applied when snapping to items using `snapToAlignment="item"`.
10
+ * Set on the parent scroll view, not directly on child items.
11
+ * Only used when `snapToAlignment` is set to `'item'`.
12
+ */
13
+ snapToItemPadding?: number | undefined;
14
+ }
15
+
7
16
  interface ViewProps {
17
+ /**
18
+ * Controls the scroll snap alignment when this view receives focus inside a ScrollView.
19
+ * Used with snapToAlignment="item" on the parent ScrollView.
20
+ *
21
+ * @platform tv
22
+ */
23
+ scrollSnapAlign?: 'start' | 'center' | 'end' | undefined;
24
+
8
25
  /**
9
26
  * Android TV only prop
10
27
  */
@@ -54,8 +71,8 @@ declare module 'react-native' {
54
71
 
55
72
  /**
56
73
  * Hardware event received from TVEventHandler
57
- *
58
- * Note: The 'blur' and 'focus' event types are deprecated and will no longer be
74
+ *
75
+ * Note: The 'blur' and 'focus' event types are deprecated and will no longer be
59
76
  * emitted on new architecture (Fabric). Use onFocus/onBlur component props instead.
60
77
  * See: https://github.com/react-native-tvos/react-native-tvos/issues/1037
61
78
  */