react-native-tvos 0.72.6-0 → 0.72.6-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/Animated/NativeAnimatedHelper.js +6 -3
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +6 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +2 -1
- package/Libraries/promiseRejectionTrackingOptions.js +21 -7
- package/React/Base/RCTTouchHandlerTV.m +35 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Fabric/RCTSurfacePointerHandlerTV.mm +37 -0
- package/React/Fabric/RCTSurfaceTouchHandlerTV.mm +30 -0
- package/React/React-RCTFabric.podspec +5 -1
- package/React/Views/RCTTVView.m +2 -2
- package/React-Core.podspec +4 -2
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java +19 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +22 -6
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +4 -0
- package/package.json +4 -4
- package/scripts/codegen/generate-legacy-interop-components.js +8 -2
- package/template/package.json +1 -1
- package/types/public/ReactNativeTVTypes.d.ts +25 -25
|
@@ -562,10 +562,13 @@ function transformDataType(value: number | string): number | string {
|
|
|
562
562
|
if (typeof value !== 'string') {
|
|
563
563
|
return value;
|
|
564
564
|
}
|
|
565
|
-
|
|
565
|
+
|
|
566
|
+
// Normalize degrees and radians to a number expressed in radians
|
|
567
|
+
if (value.endsWith('deg')) {
|
|
566
568
|
const degrees = parseFloat(value) || 0;
|
|
567
|
-
|
|
568
|
-
|
|
569
|
+
return (degrees * Math.PI) / 180.0;
|
|
570
|
+
} else if (value.endsWith('rad')) {
|
|
571
|
+
return parseFloat(value) || 0;
|
|
569
572
|
} else {
|
|
570
573
|
return value;
|
|
571
574
|
}
|
|
@@ -96,15 +96,19 @@ Pod::Spec.new do |s|
|
|
|
96
96
|
s.dependency "React-utils"
|
|
97
97
|
s.dependency "React-debug"
|
|
98
98
|
|
|
99
|
+
rel_path_from_pods_root_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(Pod::Config.instance.installation_root)
|
|
100
|
+
rel_path_from_pods_to_app = Pathname.new(ENV['APP_PATH']).relative_path_from(File.join(Pod::Config.instance.installation_root, 'Pods'))
|
|
101
|
+
|
|
102
|
+
|
|
99
103
|
s.script_phases = {
|
|
100
104
|
:name => "Generate Legacy Components Interop",
|
|
101
105
|
:script => "
|
|
102
106
|
WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"
|
|
103
107
|
source $WITH_ENVIRONMENT
|
|
104
|
-
${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{
|
|
108
|
+
${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{rel_path_from_pods_to_app} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
|
|
105
109
|
",
|
|
106
110
|
:execution_position => :before_compile,
|
|
107
|
-
:input_files => ["#{
|
|
111
|
+
:input_files => ["#{rel_path_from_pods_root_to_app}/react-native.config.js"],
|
|
108
112
|
:output_files => ["${REACT_NATIVE_PATH}/Libraries/AppDelegate/RCTLegacyInteropComponents.mm"],
|
|
109
113
|
}
|
|
110
114
|
end
|
|
@@ -30,6 +30,7 @@ export type LogData = $ReadOnly<{|
|
|
|
30
30
|
message: Message,
|
|
31
31
|
category: Category,
|
|
32
32
|
componentStack: ComponentStack,
|
|
33
|
+
stack?: string,
|
|
33
34
|
|}>;
|
|
34
35
|
|
|
35
36
|
export type Observer = (
|
|
@@ -198,7 +199,7 @@ export function addLog(log: LogData): void {
|
|
|
198
199
|
// otherwise spammy logs would pause rendering.
|
|
199
200
|
setImmediate(() => {
|
|
200
201
|
try {
|
|
201
|
-
const stack = parseErrorStack(errorForStackTrace?.stack);
|
|
202
|
+
const stack = parseErrorStack(log.stack ?? errorForStackTrace?.stack);
|
|
202
203
|
|
|
203
204
|
appendNewLog(
|
|
204
205
|
new LogBoxLog({
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
import typeof {enable} from 'promise/setimmediate/rejection-tracking';
|
|
12
12
|
|
|
13
|
+
import LogBox from './LogBox/LogBox';
|
|
14
|
+
|
|
13
15
|
type ExtractOptionsType = <P>(((options?: ?P) => void)) => P;
|
|
14
16
|
|
|
15
17
|
let rejectionTrackingOptions: $Call<ExtractOptionsType, enable> = {
|
|
@@ -36,17 +38,29 @@ let rejectionTrackingOptions: $Call<ExtractOptionsType, enable> = {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
const warning =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const warning = `Possible unhandled promise rejection (id: ${id}):\n${
|
|
42
|
+
message ?? ''
|
|
43
|
+
}`;
|
|
44
|
+
if (__DEV__) {
|
|
45
|
+
LogBox.addLog({
|
|
46
|
+
level: 'warn',
|
|
47
|
+
message: {
|
|
48
|
+
content: warning,
|
|
49
|
+
substitutions: [],
|
|
50
|
+
},
|
|
51
|
+
componentStack: [],
|
|
52
|
+
stack,
|
|
53
|
+
category: 'possible_unhandled_promise_rejection',
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
console.warn(warning);
|
|
57
|
+
}
|
|
44
58
|
},
|
|
45
59
|
onHandled: id => {
|
|
46
60
|
const warning =
|
|
47
|
-
`Promise
|
|
61
|
+
`Promise rejection handled (id: ${id})\n` +
|
|
48
62
|
'This means you can ignore any previous messages of the form ' +
|
|
49
|
-
`"Possible
|
|
63
|
+
`"Possible unhandled promise rejection (id: ${id}):"`;
|
|
50
64
|
console.warn(warning);
|
|
51
65
|
},
|
|
52
66
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
#import "RCTTouchHandler.h"
|
|
4
|
+
|
|
5
|
+
#import "RCTAssert.h"
|
|
6
|
+
#import "RCTBridge.h"
|
|
7
|
+
#import "RCTEventDispatcherProtocol.h"
|
|
8
|
+
#import "RCTLog.h"
|
|
9
|
+
#import "RCTSurfaceView.h"
|
|
10
|
+
#import "RCTTouchEvent.h"
|
|
11
|
+
#import "RCTUIManager.h"
|
|
12
|
+
#import "RCTUtils.h"
|
|
13
|
+
#import "UIView+React.h"
|
|
14
|
+
|
|
15
|
+
@interface RCTTouchHandler () <UIGestureRecognizerDelegate>
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
// The touch handler should not be active on tvOS, so tvOS uses this
|
|
19
|
+
// stub implementation that does nothing.
|
|
20
|
+
// Fixes https://github.com/react-native-tvos/react-native-tvos/issues/595
|
|
21
|
+
//
|
|
22
|
+
@implementation RCTTouchHandler
|
|
23
|
+
|
|
24
|
+
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
25
|
+
{
|
|
26
|
+
return [super initWithTarget:nil action:NULL];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)action)
|
|
30
|
+
|
|
31
|
+
- (void)attachToView:(UIView *)view {}
|
|
32
|
+
- (void)detachFromView:(UIView *)view {}
|
|
33
|
+
- (void)cancel {}
|
|
34
|
+
|
|
35
|
+
@end
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
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
|
+
|
|
8
|
+
#import "RCTSurfacePointerHandler.h"
|
|
9
|
+
|
|
10
|
+
#import <React/RCTIdentifierPool.h>
|
|
11
|
+
#import <React/RCTReactTaggedView.h>
|
|
12
|
+
#import <React/RCTUtils.h>
|
|
13
|
+
#import <React/RCTViewComponentView.h>
|
|
14
|
+
|
|
15
|
+
#import "RCTConversions.h"
|
|
16
|
+
#import "RCTTouchableComponentViewProtocol.h"
|
|
17
|
+
|
|
18
|
+
@interface RCTSurfacePointerHandler () <UIGestureRecognizerDelegate>
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
// The touch handler should not be active on tvOS, so tvOS uses this
|
|
22
|
+
// stub implementation that does nothing.
|
|
23
|
+
// Fixes https://github.com/react-native-tvos/react-native-tvos/issues/595
|
|
24
|
+
//
|
|
25
|
+
@implementation RCTSurfacePointerHandler
|
|
26
|
+
|
|
27
|
+
- (instancetype)init
|
|
28
|
+
{
|
|
29
|
+
return [super initWithTarget:nil action:nil];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)action)
|
|
33
|
+
|
|
34
|
+
- (void)attachToView:(UIView *)view {}
|
|
35
|
+
- (void)detachFromView:(UIView *)view {}
|
|
36
|
+
|
|
37
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#import "RCTSurfaceTouchHandler.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTIdentifierPool.h>
|
|
4
|
+
#import <React/RCTUtils.h>
|
|
5
|
+
#import <React/RCTViewComponentView.h>
|
|
6
|
+
|
|
7
|
+
#import "RCTConversions.h"
|
|
8
|
+
#import "RCTSurfacePointerHandler.h"
|
|
9
|
+
#import "RCTTouchableComponentViewProtocol.h"
|
|
10
|
+
|
|
11
|
+
// The touch handler should not be active on tvOS, so tvOS uses this
|
|
12
|
+
// stub implementation that does nothing.
|
|
13
|
+
// Fixes https://github.com/react-native-tvos/react-native-tvos/issues/595
|
|
14
|
+
//
|
|
15
|
+
@interface RCTSurfaceTouchHandler () <UIGestureRecognizerDelegate>
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation RCTSurfaceTouchHandler
|
|
19
|
+
|
|
20
|
+
- (instancetype)init
|
|
21
|
+
{
|
|
22
|
+
return [super initWithTarget:nil action:nil];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)action)
|
|
26
|
+
|
|
27
|
+
- (void)attachToView:(UIView *)view {}
|
|
28
|
+
- (void)detachFromView:(UIView *)view {}
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -56,7 +56,11 @@ Pod::Spec.new do |s|
|
|
|
56
56
|
s.source = source
|
|
57
57
|
s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}"
|
|
58
58
|
s.exclude_files = "**/tests/*",
|
|
59
|
-
"**/android/*"
|
|
59
|
+
"**/android/*"
|
|
60
|
+
s.tvos.exclude_files = "Fabric/**/RCTSurfaceTouchHandler.mm",
|
|
61
|
+
"Fabric/**/RCTSurfacePointerHandler.mm"
|
|
62
|
+
s.ios.exclude_files = "Fabric/**/RCTSurfaceTouchHandlerTV.mm",
|
|
63
|
+
"Fabric/**/RCTSurfacePointerHandlerTV.mm"
|
|
60
64
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
|
61
65
|
s.header_dir = "React"
|
|
62
66
|
s.module_name = "RCTFabric"
|
package/React/Views/RCTTVView.m
CHANGED
|
@@ -200,12 +200,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
200
200
|
// CATransform3D value for minimumRelativeValue
|
|
201
201
|
CATransform3D transMinimumTiltAboutX = CATransform3DIdentity;
|
|
202
202
|
transMinimumTiltAboutX.m34 = 1.0 / 500;
|
|
203
|
-
transMinimumTiltAboutX = CATransform3DRotate(transMinimumTiltAboutX, tiltAngle
|
|
203
|
+
transMinimumTiltAboutX = CATransform3DRotate(transMinimumTiltAboutX, tiltAngle, 1, 0, 0);
|
|
204
204
|
|
|
205
205
|
// CATransform3D value for minimumRelativeValue
|
|
206
206
|
CATransform3D transMaximumTiltAboutX = CATransform3DIdentity;
|
|
207
207
|
transMaximumTiltAboutX.m34 = 1.0 / 500;
|
|
208
|
-
transMaximumTiltAboutX = CATransform3DRotate(transMaximumTiltAboutX, tiltAngle, 1, 0, 0);
|
|
208
|
+
transMaximumTiltAboutX = CATransform3DRotate(transMaximumTiltAboutX, tiltAngle * -1.0, 1, 0, 0);
|
|
209
209
|
|
|
210
210
|
// Set the transform property boundaries for the interpolation
|
|
211
211
|
yTilt.minimumRelativeValue = [NSValue valueWithCATransform3D:transMinimumTiltAboutX];
|
package/React-Core.podspec
CHANGED
|
@@ -100,13 +100,15 @@ Pod::Spec.new do |s|
|
|
|
100
100
|
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
|
|
101
101
|
end
|
|
102
102
|
ss.exclude_files = exclude_files
|
|
103
|
-
ss.ios.exclude_files = "React/**/RCTTV*.*"
|
|
103
|
+
ss.ios.exclude_files = "React/**/RCTTV*.*",
|
|
104
|
+
"React/Base/RCTTouchHandlerTV.m"
|
|
104
105
|
ss.tvos.exclude_files = "React/Modules/RCTClipboard*",
|
|
105
106
|
"React/Views/RCTDatePicker*",
|
|
106
107
|
"React/Views/RCTPicker*",
|
|
107
108
|
"React/Views/RefreshControl/*",
|
|
108
109
|
"React/Views/RCTSlider*",
|
|
109
|
-
"React/Views/RCTSwitch*"
|
|
110
|
+
"React/Views/RCTSwitch*",
|
|
111
|
+
"React/Base/RCTTouchHandler.m"
|
|
110
112
|
ss.private_header_files = "React/Cxx*/*.h"
|
|
111
113
|
end
|
|
112
114
|
|
package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java
CHANGED
|
@@ -204,6 +204,11 @@ import java.util.Map;
|
|
|
204
204
|
mDefaultValue = defaultValue;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
public ColorPropSetter(ReactPropGroup prop, Method setter, int index, int defaultValue) {
|
|
208
|
+
super(prop, "mixed", setter, index);
|
|
209
|
+
mDefaultValue = defaultValue;
|
|
210
|
+
}
|
|
211
|
+
|
|
207
212
|
@Override
|
|
208
213
|
protected Object getValueOrDefault(Object value, Context context) {
|
|
209
214
|
if (value == null) {
|
|
@@ -331,6 +336,10 @@ import java.util.Map;
|
|
|
331
336
|
super(prop, "mixed", setter);
|
|
332
337
|
}
|
|
333
338
|
|
|
339
|
+
public BoxedColorPropSetter(ReactPropGroup prop, Method setter, int index) {
|
|
340
|
+
super(prop, "mixed", setter, index);
|
|
341
|
+
}
|
|
342
|
+
|
|
334
343
|
@Override
|
|
335
344
|
protected @Nullable Object getValueOrDefault(Object value, Context context) {
|
|
336
345
|
if (value != null) {
|
|
@@ -463,7 +472,11 @@ import java.util.Map;
|
|
|
463
472
|
}
|
|
464
473
|
} else if (propTypeClass == int.class) {
|
|
465
474
|
for (int i = 0; i < names.length; i++) {
|
|
466
|
-
|
|
475
|
+
if ("Color".equals(annotation.customType())) {
|
|
476
|
+
props.put(names[i], new ColorPropSetter(annotation, method, i, annotation.defaultInt()));
|
|
477
|
+
} else {
|
|
478
|
+
props.put(names[i], new IntPropSetter(annotation, method, i, annotation.defaultInt()));
|
|
479
|
+
}
|
|
467
480
|
}
|
|
468
481
|
} else if (propTypeClass == float.class) {
|
|
469
482
|
for (int i = 0; i < names.length; i++) {
|
|
@@ -476,7 +489,11 @@ import java.util.Map;
|
|
|
476
489
|
}
|
|
477
490
|
} else if (propTypeClass == Integer.class) {
|
|
478
491
|
for (int i = 0; i < names.length; i++) {
|
|
479
|
-
|
|
492
|
+
if ("Color".equals(annotation.customType())) {
|
|
493
|
+
props.put(names[i], new BoxedColorPropSetter(annotation, method, i));
|
|
494
|
+
} else {
|
|
495
|
+
props.put(names[i], new BoxedIntPropSetter(annotation, method, i));
|
|
496
|
+
}
|
|
480
497
|
}
|
|
481
498
|
} else {
|
|
482
499
|
throw new RuntimeException(
|
|
@@ -74,19 +74,35 @@ static Class getViewManagerFromComponentName(const std::string &componentName)
|
|
|
74
74
|
return nil;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
static std::
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
static Class getViewManagerClass(const std::string &componentName, RCTBridge *bridge)
|
|
78
|
+
{
|
|
79
|
+
Class viewManager = getViewManagerFromComponentName(componentName);
|
|
80
|
+
if (viewManager != nil) {
|
|
81
|
+
return viewManager;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// If all the heuristics fail, let's try to retrieve the view manager from the bridge/bridgeProxy
|
|
85
|
+
if (bridge != nil) {
|
|
86
|
+
return [[bridge moduleForName:RCTNSStringFromString(componentName)] class];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return nil;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static const std::shared_ptr<void> constructCoordinator(
|
|
93
|
+
const ContextContainer::Shared &contextContainer,
|
|
94
|
+
const ComponentDescriptor::Flavor &flavor)
|
|
80
95
|
{
|
|
81
|
-
auto componentName = *std::static_pointer_cast<std::string const>(flavor);
|
|
82
|
-
Class viewManagerClass = getViewManagerFromComponentName(componentName);
|
|
83
|
-
assert(viewManagerClass);
|
|
84
96
|
auto optionalBridge = contextContainer->find<std::shared_ptr<void>>("Bridge");
|
|
85
97
|
RCTBridge *bridge;
|
|
86
98
|
if (optionalBridge) {
|
|
87
99
|
bridge = unwrapManagedObjectWeakly(optionalBridge.value());
|
|
88
100
|
}
|
|
89
101
|
|
|
102
|
+
auto componentName = *std::static_pointer_cast<std::string const>(flavor);
|
|
103
|
+
Class viewManagerClass = getViewManagerClass(componentName, bridge);
|
|
104
|
+
assert(viewManagerClass);
|
|
105
|
+
|
|
90
106
|
auto optionalEventDispatcher = contextContainer->find<std::shared_ptr<void>>("RCTEventDispatcher");
|
|
91
107
|
RCTEventDispatcher *eventDispatcher;
|
|
92
108
|
if (optionalEventDispatcher) {
|
|
@@ -92,6 +92,10 @@ using namespace facebook::react;
|
|
|
92
92
|
if (props.isObject()) {
|
|
93
93
|
NSDictionary<NSString *, id> *convertedProps = convertFollyDynamicToId(props);
|
|
94
94
|
[_componentData setProps:convertedProps forView:view];
|
|
95
|
+
|
|
96
|
+
if ([view respondsToSelector:@selector(didSetProps:)]) {
|
|
97
|
+
[view performSelector:@selector(didSetProps:) withObject:[convertedProps allKeys]];
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tvos",
|
|
3
|
-
"version": "0.72.6-
|
|
3
|
+
"version": "0.72.6-1",
|
|
4
4
|
"bin": "./cli.js",
|
|
5
5
|
"description": "A framework for building native apps using React",
|
|
6
6
|
"license": "MIT",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
83
|
-
"@react-native-community/cli": "11.3.
|
|
84
|
-
"@react-native-community/cli-platform-android": "11.3.
|
|
85
|
-
"@react-native-community/cli-platform-ios": "11.3.
|
|
83
|
+
"@react-native-community/cli": "11.3.10",
|
|
84
|
+
"@react-native-community/cli-platform-android": "11.3.10",
|
|
85
|
+
"@react-native-community/cli-platform-ios": "11.3.10",
|
|
86
86
|
"@react-native/assets-registry": "^0.72.0",
|
|
87
87
|
"@react-native/codegen": "^0.72.7",
|
|
88
88
|
"@react-native/gradle-plugin": "^0.72.11",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
const yargs = require('yargs');
|
|
13
13
|
const fs = require('fs');
|
|
14
|
+
const p = require('path');
|
|
14
15
|
|
|
15
16
|
const CONFIG_FILE_NAME = 'react-native.config.js';
|
|
16
17
|
const PROJECT_FIELD = 'project';
|
|
@@ -93,7 +94,11 @@ function extractComponentsNames(reactNativeConfig) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
function generateRCTLegacyInteropComponents() {
|
|
96
|
-
const
|
|
97
|
+
const cwd = process.cwd();
|
|
98
|
+
const configFilePath = p.join(cwd, appRoot, CONFIG_FILE_NAME);
|
|
99
|
+
console.log(
|
|
100
|
+
`Looking for a react-native.config.js file at ${configFilePath}...`,
|
|
101
|
+
);
|
|
97
102
|
let reactNativeConfig = null;
|
|
98
103
|
try {
|
|
99
104
|
reactNativeConfig = require(configFilePath);
|
|
@@ -107,7 +112,7 @@ function generateRCTLegacyInteropComponents() {
|
|
|
107
112
|
console.log('Skip LegacyInterop generation');
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
110
|
-
|
|
115
|
+
console.log(`Components found: ${componentNames}`);
|
|
111
116
|
let componentsArray = componentNames.map(name => `\t\t\t@"${name}",`);
|
|
112
117
|
// Remove the last comma
|
|
113
118
|
if (componentsArray.length > 0) {
|
|
@@ -118,6 +123,7 @@ function generateRCTLegacyInteropComponents() {
|
|
|
118
123
|
|
|
119
124
|
const filePath = `${outputPath}/${OUTPUT_FILE_NAME}`;
|
|
120
125
|
fs.writeFileSync(filePath, fileBody(componentsArray.join('\n')));
|
|
126
|
+
console.log(`${filePath} updated!`);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
generateRCTLegacyInteropComponents();
|
package/template/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { View, ScrollViewProps, HostComponent, TVParallaxProperties } from 'react-native';
|
|
3
3
|
|
|
4
4
|
declare module 'react-native' {
|
|
5
5
|
interface ViewProps {
|
|
6
6
|
/**
|
|
7
7
|
* TV next focus down (see documentation for the View component).
|
|
8
8
|
*/
|
|
9
|
-
nextFocusDown?: number,
|
|
9
|
+
nextFocusDown?: number | undefined,
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* TV next focus forward (see documentation for the View component).
|
|
13
13
|
*
|
|
14
14
|
* @platform android
|
|
15
15
|
*/
|
|
16
|
-
nextFocusForward?: number,
|
|
16
|
+
nextFocusForward?: number | undefined,
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* TV next focus left (see documentation for the View component).
|
|
20
20
|
*/
|
|
21
|
-
nextFocusLeft?: number,
|
|
21
|
+
nextFocusLeft?: number | undefined,
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* TV next focus right (see documentation for the View component).
|
|
25
25
|
*/
|
|
26
|
-
nextFocusRight?: number,
|
|
26
|
+
nextFocusRight?: number | undefined,
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* TV next focus up (see documentation for the View component).
|
|
30
30
|
*/
|
|
31
|
-
nextFocusUp?: number,
|
|
31
|
+
nextFocusUp?: number | undefined,
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface NativeMethods {
|
|
@@ -48,15 +48,15 @@ declare module 'react-native' {
|
|
|
48
48
|
|
|
49
49
|
export type HWEvent = {
|
|
50
50
|
eventType: 'up' | 'down' | 'right' | 'left' | 'longUp' | 'longDown' | 'longRight' | 'longLeft' | 'blur' | 'focus' | 'pan' | string;
|
|
51
|
-
eventKeyAction?: -1 | 1 | 0 | number;
|
|
52
|
-
tag?: number;
|
|
51
|
+
eventKeyAction?: -1 | 1 | 0 | number | undefined;
|
|
52
|
+
tag?: number | undefined;
|
|
53
53
|
body?: {
|
|
54
|
-
state:
|
|
54
|
+
state: 'Began' | 'Changed' | 'Ended',
|
|
55
55
|
x: number,
|
|
56
56
|
y: number,
|
|
57
57
|
velocityx: number,
|
|
58
58
|
velocityy: number
|
|
59
|
-
}
|
|
59
|
+
} | undefined
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export class TVEventHandler {
|
|
@@ -72,11 +72,11 @@ declare module 'react-native' {
|
|
|
72
72
|
* If the view should be "visible". display "flex" if visible, otherwise "none".
|
|
73
73
|
* Defaults to true
|
|
74
74
|
*/
|
|
75
|
-
enabled?: boolean;
|
|
75
|
+
enabled?: boolean | undefined;
|
|
76
76
|
/**
|
|
77
77
|
* Array of `Component`s to register as destinations with `UIFocusGuide`
|
|
78
78
|
*/
|
|
79
|
-
destinations?: (null | number | React.Component<any, any> | React.ComponentClass<any>)[];
|
|
79
|
+
destinations?: (null | number | React.Component<any, any> | React.ComponentClass<any>)[] | undefined;
|
|
80
80
|
/**
|
|
81
81
|
* If true, `TVFocusGuide` will automatically manage focus for you.
|
|
82
82
|
* It will redirect the focus to the first focusable child on the first visit.
|
|
@@ -87,27 +87,27 @@ declare module 'react-native' {
|
|
|
87
87
|
*
|
|
88
88
|
* @default false
|
|
89
89
|
*/
|
|
90
|
-
autoFocus?: boolean;
|
|
90
|
+
autoFocus?: boolean | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Enables focus trapping for the focus guide (see README).
|
|
93
93
|
*/
|
|
94
|
-
trapFocusUp?: boolean;
|
|
94
|
+
trapFocusUp?: boolean | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* Enables focus trapping for the focus guide (see README).
|
|
97
97
|
*/
|
|
98
|
-
trapFocusDown?: boolean;
|
|
98
|
+
trapFocusDown?: boolean | undefined;
|
|
99
99
|
/**
|
|
100
100
|
* Enables focus trapping for the focus guide (see README).
|
|
101
101
|
*/
|
|
102
|
-
trapFocusLeft?: boolean;
|
|
102
|
+
trapFocusLeft?: boolean | undefined;
|
|
103
103
|
/**
|
|
104
104
|
* Enables focus trapping for the focus guide (see README).
|
|
105
105
|
*/
|
|
106
|
-
trapFocusRight?: boolean;
|
|
106
|
+
trapFocusRight?: boolean | undefined;
|
|
107
107
|
/**
|
|
108
108
|
* @deprecated Don't use it, no longer necessary.
|
|
109
109
|
*/
|
|
110
|
-
safePadding?: 'both' | 'vertical' | 'horizontal' | null;
|
|
110
|
+
safePadding?: 'both' | 'vertical' | 'horizontal' | null | undefined;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export type FocusGuideMethods = {
|
|
@@ -129,25 +129,25 @@ declare module 'react-native' {
|
|
|
129
129
|
* The duration of the scroll animation when a swipe is detected.
|
|
130
130
|
* Default value is 0.3 s
|
|
131
131
|
*/
|
|
132
|
-
scrollDuration?: number;
|
|
132
|
+
scrollDuration?: number | undefined;
|
|
133
133
|
/**
|
|
134
134
|
* Scrolling distance when a swipe is detected
|
|
135
135
|
* Default value is half the visible height (vertical scroller)
|
|
136
136
|
* or width (horizontal scroller)
|
|
137
137
|
*/
|
|
138
|
-
pageSize?: number;
|
|
138
|
+
pageSize?: number | undefined;
|
|
139
139
|
/**
|
|
140
140
|
* If true, will scroll to start when focus moves out past the beginning
|
|
141
141
|
* of the scroller
|
|
142
142
|
* Defaults to true
|
|
143
143
|
*/
|
|
144
|
-
snapToStart?: boolean;
|
|
144
|
+
snapToStart?: boolean | undefined;
|
|
145
145
|
/**
|
|
146
146
|
* If true, will scroll to end when focus moves out past the end of the
|
|
147
147
|
* scroller
|
|
148
148
|
* Defaults to true
|
|
149
149
|
*/
|
|
150
|
-
snapToEnd?: boolean;
|
|
150
|
+
snapToEnd?: boolean | undefined;
|
|
151
151
|
/**
|
|
152
152
|
* Called when the scroller comes into focus (e.g. for highlighting)
|
|
153
153
|
*/
|
|
@@ -170,7 +170,7 @@ declare module 'react-native' {
|
|
|
170
170
|
*
|
|
171
171
|
* @platform ios
|
|
172
172
|
*/
|
|
173
|
-
hasTVPreferredFocus?: boolean;
|
|
173
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* *(Apple TV only)* Object with properties to control Apple TV parallax effects.
|
|
@@ -186,7 +186,7 @@ declare module 'react-native' {
|
|
|
186
186
|
*
|
|
187
187
|
* @platform ios
|
|
188
188
|
*/
|
|
189
|
-
tvParallaxProperties?: TVParallaxProperties;
|
|
189
|
+
tvParallaxProperties?: TVParallaxProperties | undefined;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
}
|