react-native-tvos 0.81.1-1 → 0.81.1-3

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.
@@ -12,7 +12,7 @@ import type {ViewProps} from '../View/ViewPropTypes';
12
12
  import type {ComponentOrHandleType} from './tagForComponentOrHandle';
13
13
 
14
14
  import Platform from '../../Utilities/Platform';
15
- import setAndForwardRef from '../../Utilities/setAndForwardRef';
15
+ import useMergeRefs from '../../Utilities/useMergeRefs';
16
16
  import View from '../View/View';
17
17
  import {Commands} from '../View/ViewNativeComponent';
18
18
  import tagForComponentOrHandle from './tagForComponentOrHandle';
@@ -57,17 +57,15 @@ export type TVFocusGuideViewImperativeMethods = $ReadOnly<{
57
57
  setDestinations: (destinations: (ComponentOrHandleType | number)[]) => void,
58
58
  }>;
59
59
 
60
- function TVFocusGuideView(
61
- {
62
- enabled = true,
63
- safePadding,
64
- destinations: destinationsProp,
65
- autoFocus,
66
- focusable,
67
- ...props
68
- }: TVFocusGuideViewProps,
69
- forwardedRef: any,
70
- ): React.Node {
60
+ function TVFocusGuideView({
61
+ enabled = true,
62
+ safePadding,
63
+ destinations: destinationsProp,
64
+ autoFocus,
65
+ focusable,
66
+ ref,
67
+ ...props
68
+ }: TVFocusGuideViewProps): React.Node {
71
69
  const focusGuideRef = React.useRef<React.ElementRef<typeof View> | null>(
72
70
  null,
73
71
  );
@@ -78,7 +76,7 @@ function TVFocusGuideView(
78
76
  const dests: number[] = (destinations || [])
79
77
  .map((destination: any) => tagForComponentOrHandle(destination))
80
78
  .filter(Boolean);
81
-
79
+
82
80
  if (focusGuideRef.current != null) {
83
81
  Commands.setDestinations(focusGuideRef.current, dests);
84
82
  }
@@ -87,26 +85,23 @@ function TVFocusGuideView(
87
85
  [],
88
86
  );
89
87
 
90
- const _setNativeRef = React.useMemo(() => {
91
- return setAndForwardRef({
92
- getForwardedRef: () => forwardedRef,
93
- setLocalRef: ref => {
94
- focusGuideRef.current = ref;
95
-
96
- // This is a hack. Ideally we would forwardRef to the underlying
97
- // host component. However, since TVFocusGuide has its own methods that can be
98
- // called as well, if we used the standard forwardRef then these
99
- // methods wouldn't be accessible
100
- //
101
- // Here we mutate the ref, so that the user can use the standard native
102
- // methods like `focus()`, `blur()`, etc. while also having access to
103
- // imperative methods of this component like `setDestinations()`.
104
- if (ref) {
105
- ref.setDestinations = setDestinations;
106
- }
107
- },
108
- })
109
- }, [forwardedRef, setDestinations]);
88
+ const setLocalRef = React.useCallback(
89
+ (instance: HostInstance | null) => {
90
+ // $FlowExpectedError[incompatible-type]
91
+ focusGuideRef.current = instance;
92
+
93
+ if (instance != null) {
94
+ // $FlowFixMe[prop-missing]
95
+ // $FlowFixMe[unsafe-object-assign]
96
+ Object.assign(instance, {
97
+ setDestinations,
98
+ });
99
+ }
100
+ },
101
+ [setDestinations],
102
+ );
103
+
104
+ const mergedRef = useMergeRefs(setLocalRef, ref);
110
105
 
111
106
  React.useEffect(() => {
112
107
  if (destinationsProp !== null && destinationsProp !== undefined) {
@@ -127,7 +122,7 @@ function TVFocusGuideView(
127
122
  <View
128
123
  {...props}
129
124
  style={style}
130
- ref={_setNativeRef}
125
+ ref={mergedRef}
131
126
  collapsable={false}
132
127
  autoFocus={autoFocus}
133
128
  // tvOS only prop
@@ -12,7 +12,7 @@ import type {ViewProps} from './ViewPropTypes';
12
12
 
13
13
  import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
14
14
  import TextAncestorContext from '../../Text/TextAncestorContext';
15
- import setAndForwardRef from '../../Utilities/setAndForwardRef';
15
+ import useMergeRefs from '../../Utilities/useMergeRefs';
16
16
  import ViewNativeComponent from './ViewNativeComponent';
17
17
  import {Commands} from './ViewNativeComponent';
18
18
  import * as React from 'react';
@@ -39,26 +39,23 @@ component View(
39
39
  }
40
40
  }, []);
41
41
 
42
- const _setNativeRef = React.useMemo(() => {
43
- return setAndForwardRef({
44
- getForwardedRef: () => viewRef.current,
45
- setLocalRef: _ref => {
46
- viewRef.current = _ref;
47
-
48
- // This is a hack. Ideally we would forwardRef to the underlying
49
- // host component. However, since TVFocusGuide has its own methods that can be
50
- // called as well, if we used the standard forwardRef then these
51
- // methods wouldn't be accessible
52
- //
53
- // Here we mutate the ref, so that the user can use the standart native
54
- // methods like `measureLayout()` etc. while also having access to
55
- // imperative methods of this component like `requestTVFocus()`.
56
- if (_ref) {
57
- _ref.requestTVFocus = requestTVFocus;
58
- }
59
- },
60
- })
61
- }, [requestTVFocus]);
42
+ const setLocalRef = React.useCallback(
43
+ (instance: HostInstance | null) => {
44
+ // $FlowExpectedError[incompatible-type]
45
+ viewRef.current = instance;
46
+
47
+ if (instance != null) {
48
+ // $FlowFixMe[prop-missing]
49
+ // $FlowFixMe[unsafe-object-assign]
50
+ Object.assign(instance, {
51
+ requestTVFocus,
52
+ });
53
+ }
54
+ },
55
+ [requestTVFocus],
56
+ );
57
+
58
+ const mergedRef = useMergeRefs(setLocalRef, ref);
62
59
 
63
60
  let actualView;
64
61
  if (ReactNativeFeatureFlags.reduceDefaultPropsInView()) {
@@ -151,7 +148,7 @@ component View(
151
148
  ref == null ? (
152
149
  <ViewNativeComponent {...processedProps} />
153
150
  ) : (
154
- <ViewNativeComponent {...processedProps} ref={ref} />
151
+ <ViewNativeComponent {...processedProps} ref={mergedRef} />
155
152
  );
156
153
  } else {
157
154
  const {
@@ -232,7 +229,7 @@ component View(
232
229
  : importantForAccessibility
233
230
  }
234
231
  nativeID={id ?? nativeID}
235
- ref={_setNativeRef}
232
+ ref={mergedRef}
236
233
  />
237
234
  );
238
235
  }
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @flow strict
8
+ * @noformat
8
9
  * @generated by scripts/releases/set-version.js
9
10
  */
10
11
 
@@ -17,5 +18,5 @@ export const version: $ReadOnly<{
17
18
  major: 0,
18
19
  minor: 81,
19
20
  patch: 1,
20
- prerelease: '1',
21
+ prerelease: '3',
21
22
  };
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated by scripts/releases/set-rn-version.js
7
+ * @generated by scripts/releases/set-version.js
8
8
  */
9
9
 
10
10
  #import "RCTVersion.h"
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(81),
26
26
  RCTVersionPatch: @(1),
27
- RCTVersionPrerelease: @"1",
27
+ RCTVersionPrerelease: @"3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.81.1-1
1
+ VERSION_NAME=0.81.1-3
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
 
4
4
  android.useAndroidX=true
@@ -15,6 +15,6 @@ public object ReactNativeVersion {
15
15
  "major" to 0,
16
16
  "minor" to 81,
17
17
  "patch" to 1,
18
- "prerelease" to null
18
+ "prerelease" to "3"
19
19
  )
20
20
  }
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated by scripts/releases/set-rn-version.js
7
+ * @generated by scripts/releases/set-version.js
8
8
  */
9
9
 
10
10
  #pragma once
@@ -12,13 +12,17 @@
12
12
  #include <cstdint>
13
13
  #include <string_view>
14
14
 
15
+ #define REACT_NATIVE_VERSION_MAJOR 0
16
+ #define REACT_NATIVE_VERSION_MINOR 81
17
+ #define REACT_NATIVE_VERSION_PATCH 1
18
+
15
19
  namespace facebook::react {
16
20
 
17
21
  constexpr struct {
18
22
  int32_t Major = 0;
19
23
  int32_t Minor = 81;
20
24
  int32_t Patch = 1;
21
- std::string_view Prerelease = "1";
25
+ std::string_view Prerelease = "3";
22
26
  } ReactNativeVersion;
23
27
 
24
28
  } // namespace facebook::react
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.81.1-1",
3
+ "version": "0.81.1-3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -198,7 +198,7 @@
198
198
  "whatwg-fetch": "^3.0.0",
199
199
  "ws": "^6.2.3",
200
200
  "yargs": "^17.6.2",
201
- "@react-native-tvos/virtualized-lists": "0.81.1-1"
201
+ "@react-native-tvos/virtualized-lists": "0.81.1-3"
202
202
  },
203
203
  "codegenConfig": {
204
204
  "libraries": [
Binary file
Binary file
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env python
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ import os
8
+ import sys
9
+
10
+ # Make sure we can find the lit package.
11
+ sys.path.insert(0, os.path.join("/Users/runner/work/react-native/react-native/packages/react-native/sdks/hermes/external/llvh", 'utils', 'lit'))
12
+
13
+ if __name__=='__main__':
14
+ from lit.main import main
15
+ main({})
Binary file
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<dce51078df5fd03980baaac9a31ca8a0>>
7
+ * @generated SignedSource<<6a73d474d9a2542964617b14e756698c>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/build-types/index.js.
10
10
  * Original file: packages/react-native/Libraries/Components/TV/TVFocusGuideView.js
@@ -65,7 +65,7 @@ type TVFocusGuideViewProps = Readonly<Omit<ViewProps, keyof {
65
65
  export type TVFocusGuideViewImperativeMethods = Readonly<{
66
66
  setDestinations: (destinations: (ComponentOrHandleType | number)[]) => void;
67
67
  }>;
68
- declare function TVFocusGuideView($$PARAM_0$$: TVFocusGuideViewProps, forwardedRef: any): React.ReactNode;
68
+ declare function TVFocusGuideView($$PARAM_0$$: TVFocusGuideViewProps): React.ReactNode;
69
69
  declare const $$TVFocusGuideView: typeof TVFocusGuideView;
70
70
  declare type $$TVFocusGuideView = typeof $$TVFocusGuideView;
71
71
  export default $$TVFocusGuideView;