react-native-tvos 0.73.0-0rc2 → 0.73.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.
- package/Libraries/AppDelegate/RCTAppDelegate.mm +2 -2
- package/Libraries/AppDelegate/RCTLegacyInteropComponents.mm +5 -1
- package/Libraries/Components/TabBarIOS/RCTTabBarItemNativeComponent.js +1 -1
- package/Libraries/Components/TabBarIOS/RCTTabBarNativeComponent.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/README.md +21 -3
- package/React/Base/RCTVersion.m +2 -2
- package/React/DevSupport/RCTInspectorDevServerHelper.mm +60 -4
- package/React/Fabric/RCTThirdPartyFabricComponentsProvider.h +33 -0
- package/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm +32 -0
- package/React/Views/SafeAreaView/RCTSafeAreaView.m +6 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +1 -4
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +70 -5
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +0 -10
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +33 -38
- package/ReactAndroid/src/main/jni/react/fabric/Binding.h +5 -1
- package/ReactAndroid/src/main/jni/react/fabric/JFabricUIManager.cpp +3 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +29 -0
- package/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +134 -0
- package/ReactCommon/react/renderer/components/rncore/EventEmitters.h +171 -0
- package/ReactCommon/react/renderer/components/rncore/Props.cpp +157 -0
- package/ReactCommon/react/renderer/components/rncore/Props.h +394 -0
- package/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +257 -0
- package/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +26 -0
- package/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +111 -0
- package/ReactCommon/react/renderer/components/rncore/States.cpp +18 -0
- package/ReactCommon/react/renderer/components/rncore/States.h +141 -0
- package/ReactCommon/react/renderer/components/view/propsConversions.h +1 -2
- package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +0 -1
- package/package.json +9 -9
- package/scripts/cocoapods/codegen.rb +5 -16
- package/scripts/cocoapods/codegen_utils.rb +1 -0
- package/scripts/cocoapods/utils.rb +2 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/android/build.gradle +2 -2
- package/template/ios/Podfile +23 -20
- package/template/package.json +2 -2
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
#import <React/RCTSurfaceHostingProxyRootView.h>
|
|
24
24
|
#import <React/RCTSurfacePresenter.h>
|
|
25
25
|
#import <ReactCommon/RCTContextContainerHandling.h>
|
|
26
|
-
#if
|
|
26
|
+
#if USE_HERMES
|
|
27
27
|
#import <ReactCommon/RCTHermesInstance.h>
|
|
28
28
|
#else
|
|
29
29
|
#import <ReactCommon/RCTJscInstance.h>
|
|
@@ -295,7 +295,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|
|
295
295
|
|
|
296
296
|
- (std::shared_ptr<facebook::react::JSEngineInstance>)createJSEngineInstance
|
|
297
297
|
{
|
|
298
|
-
#if
|
|
298
|
+
#if USE_HERMES
|
|
299
299
|
return std::make_shared<facebook::react::RCTHermesInstance>(_reactNativeConfig, nullptr);
|
|
300
300
|
#else
|
|
301
301
|
return std::make_shared<facebook::react::RCTJscInstance>();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
/*
|
|
2
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
4
|
*
|
|
@@ -11,7 +12,10 @@
|
|
|
11
12
|
|
|
12
13
|
+ (NSArray<NSString *> *)legacyInteropComponents
|
|
13
14
|
{
|
|
14
|
-
return @[
|
|
15
|
+
return @[
|
|
16
|
+
@"RNTMyLegacyNativeView",
|
|
17
|
+
@"RNTMyNativeView"
|
|
18
|
+
];
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
@end
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
|
|
13
|
+
const requireNativeComponent = require('../../ReactNative/requireNativeComponent').default;
|
|
14
14
|
|
|
15
15
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
16
16
|
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
|
|
13
|
+
const requireNativeComponent = require('../../ReactNative/requireNativeComponent').default;
|
|
14
14
|
|
|
15
15
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
16
16
|
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
package/README.md
CHANGED
|
@@ -40,10 +40,10 @@ You should also install `yarn` globally, as it should be used instead of `npm` f
|
|
|
40
40
|
|
|
41
41
|
## Build changes
|
|
42
42
|
|
|
43
|
-
- _Native layer for Apple TV_: React Native Xcode projects all now have Apple TV build targets, with names ending in the string '-tvOS'.
|
|
43
|
+
- _Native layer for Apple TV_: React Native Xcode projects all now have Apple TV build targets, with names ending in the string '-tvOS'. Changes in the React Native podspecs in 0.73 now require that your application `Podfile` only have one target. This repo supports either an iOS target or a tvOS target, but both targets should not be active at the same time. The new app template now has the iOS target commented out.
|
|
44
44
|
- _Maven artifacts for Android TV_: In 0.71, the React Native Android prebuilt archives are published to Maven instead of being included in the NPM. We are following the same model, except that the Maven artifacts will be in group `io.github.react-native-tvos` instead of `com.facebook.react`. The `@react-native/gradle-plugin` module has been upgraded so that the Android dependencies will be detected correctly during build.
|
|
45
45
|
|
|
46
|
-
## New
|
|
46
|
+
## _(New)_ Project creation using the Expo CLI
|
|
47
47
|
|
|
48
48
|
> _Pitfall:_ Make sure you do not globally install `react-native` or `react-native-tvos`. If you have done this the wrong way, you may get error messages like `ld: library not found for -lPods-TestApp-tvOS`.
|
|
49
49
|
|
|
@@ -70,7 +70,25 @@ npx expo run:ios --scheme MyApp --device "iPhone 15"
|
|
|
70
70
|
npx expo run:android --device tv_api_31
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
See [this document](https://docs.expo.dev/bare/using-expo-cli/) for more details on Expo CLI functionality. (Note that many of these features require that Expo SDK modules be built into your app
|
|
73
|
+
See [this document](https://docs.expo.dev/bare/using-expo-cli/) for more details on Expo CLI functionality. (Note that many of these features require that Expo SDK modules be built into your app. Expo SDK support requires a different project configuration as described below.)
|
|
74
|
+
|
|
75
|
+
## _(New)_ Using the Expo SDK with TV apps
|
|
76
|
+
|
|
77
|
+
Starting with the Expo SDK 50 preview, and react-native-tvos 0.73.x, it will be possible to create Expo apps, and build them for TV via a new config plugin.
|
|
78
|
+
|
|
79
|
+
This functionality will be new in Expo SDK 50, and will be considered an experimental feature for now.
|
|
80
|
+
|
|
81
|
+
The fastest way to generate a new project is described in the [TV Example](https://github.com/expo/examples/tree/master/with-tv) in the Expo examples repo.
|
|
82
|
+
|
|
83
|
+
Besides most of the core Expo modules, these also work on TV:
|
|
84
|
+
|
|
85
|
+
- expo-av
|
|
86
|
+
- expo-image
|
|
87
|
+
- expo-localization
|
|
88
|
+
- expo-updates
|
|
89
|
+
|
|
90
|
+
TV does NOT support dev client (dev menu, dev launcher) at this time.
|
|
91
|
+
TV does NOT support Expo Router at this time.
|
|
74
92
|
|
|
75
93
|
## Code changes
|
|
76
94
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -23,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
|
|
23
23
|
__rnVersion = @{
|
|
24
24
|
RCTVersionMajor: @(0),
|
|
25
25
|
RCTVersionMinor: @(73),
|
|
26
|
-
RCTVersionPatch: @(
|
|
27
|
-
RCTVersionPrerelease: @"
|
|
26
|
+
RCTVersionPatch: @(1),
|
|
27
|
+
RCTVersionPrerelease: @"0",
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
return __rnVersion;
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
#import <React/RCTDefines.h>
|
|
16
16
|
#import <React/RCTInspectorPackagerConnection.h>
|
|
17
17
|
|
|
18
|
+
#import <CommonCrypto/CommonCrypto.h>
|
|
19
|
+
|
|
18
20
|
static NSString *const kDebuggerMsgDisable = @"{ \"id\":1,\"method\":\"Debugger.disable\" }";
|
|
19
21
|
|
|
20
22
|
static NSString *getServerHost(NSURL *bundleURL)
|
|
@@ -40,16 +42,65 @@ static NSString *getServerHost(NSURL *bundleURL)
|
|
|
40
42
|
return [NSString stringWithFormat:@"%@:%@", host, port];
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
static NSString *getSHA256(NSString *string)
|
|
46
|
+
{
|
|
47
|
+
const char *str = string.UTF8String;
|
|
48
|
+
unsigned char result[CC_SHA256_DIGEST_LENGTH];
|
|
49
|
+
CC_SHA256(str, (CC_LONG)strlen(str), result);
|
|
50
|
+
|
|
51
|
+
return [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
|
52
|
+
result[0],
|
|
53
|
+
result[1],
|
|
54
|
+
result[2],
|
|
55
|
+
result[3],
|
|
56
|
+
result[4],
|
|
57
|
+
result[5],
|
|
58
|
+
result[6],
|
|
59
|
+
result[7],
|
|
60
|
+
result[8],
|
|
61
|
+
result[9],
|
|
62
|
+
result[10],
|
|
63
|
+
result[11],
|
|
64
|
+
result[12],
|
|
65
|
+
result[13],
|
|
66
|
+
result[14],
|
|
67
|
+
result[15],
|
|
68
|
+
result[16],
|
|
69
|
+
result[17],
|
|
70
|
+
result[18],
|
|
71
|
+
result[19]];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Returns an opaque ID which is stable for the current combination of device and app, stable across installs,
|
|
75
|
+
// and unique across devices.
|
|
76
|
+
static NSString *getInspectorDeviceId()
|
|
77
|
+
{
|
|
78
|
+
// A bundle ID uniquely identifies a single app throughout the system. [Source: Apple docs]
|
|
79
|
+
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
|
|
80
|
+
|
|
81
|
+
// An alphanumeric string that uniquely identifies a device to the app's vendor. [Source: Apple docs]
|
|
82
|
+
NSString *identifierForVendor = [[UIDevice currentDevice] identifierForVendor].UUIDString;
|
|
83
|
+
|
|
84
|
+
NSString *rawDeviceId = [NSString stringWithFormat:@"apple-%@-%@", identifierForVendor, bundleId];
|
|
85
|
+
|
|
86
|
+
return getSHA256(rawDeviceId);
|
|
87
|
+
}
|
|
88
|
+
|
|
43
89
|
static NSURL *getInspectorDeviceUrl(NSURL *bundleURL)
|
|
44
90
|
{
|
|
45
91
|
NSString *escapedDeviceName = [[[UIDevice currentDevice] name]
|
|
46
92
|
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
|
47
93
|
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier]
|
|
48
94
|
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
|
49
|
-
|
|
95
|
+
|
|
96
|
+
NSString *escapedInspectorDeviceId = [getInspectorDeviceId()
|
|
97
|
+
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
|
98
|
+
|
|
99
|
+
return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@&device=%@",
|
|
50
100
|
getServerHost(bundleURL),
|
|
51
101
|
escapedDeviceName,
|
|
52
|
-
escapedAppName
|
|
102
|
+
escapedAppName,
|
|
103
|
+
escapedInspectorDeviceId]];
|
|
53
104
|
}
|
|
54
105
|
|
|
55
106
|
@implementation RCTInspectorDevServerHelper
|
|
@@ -70,8 +121,13 @@ static void sendEventToAllConnections(NSString *event)
|
|
|
70
121
|
NSString *appId = [[[NSBundle mainBundle] bundleIdentifier]
|
|
71
122
|
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
|
72
123
|
|
|
73
|
-
|
|
74
|
-
|
|
124
|
+
NSString *escapedInspectorDeviceId = [getInspectorDeviceId()
|
|
125
|
+
stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
|
|
126
|
+
|
|
127
|
+
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/open-debugger?appId=%@&device=%@",
|
|
128
|
+
getServerHost(bundleURL),
|
|
129
|
+
appId,
|
|
130
|
+
escapedInspectorDeviceId]];
|
|
75
131
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
|
76
132
|
[request setHTTPMethod:@"POST"];
|
|
77
133
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by GenerateRCTThirdPartyFabricComponentsProviderH
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma GCC diagnostic push
|
|
12
|
+
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
|
|
13
|
+
|
|
14
|
+
#import <React/RCTComponentViewProtocol.h>
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name);
|
|
21
|
+
|
|
22
|
+
#ifndef RCT_DYNAMIC_FRAMEWORKS
|
|
23
|
+
|
|
24
|
+
Class<RCTComponentViewProtocol> RNTMyNativeViewCls(void) __attribute__((used)); // AppSpecs
|
|
25
|
+
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#ifdef __cplusplus
|
|
29
|
+
}
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#pragma GCC diagnostic pop
|
|
33
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by GenerateRCTThirdPartyFabricComponentsProviderCpp
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// OSS-compatibility layer
|
|
12
|
+
|
|
13
|
+
#import "RCTThirdPartyFabricComponentsProvider.h"
|
|
14
|
+
|
|
15
|
+
#import <string>
|
|
16
|
+
#import <unordered_map>
|
|
17
|
+
|
|
18
|
+
Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name) {
|
|
19
|
+
static std::unordered_map<std::string, Class (*)(void)> sFabricComponentsClassMap = {
|
|
20
|
+
#ifndef RCT_DYNAMIC_FRAMEWORKS
|
|
21
|
+
|
|
22
|
+
{"RNTMyNativeView", RNTMyNativeViewCls}, // AppSpecs
|
|
23
|
+
#endif
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
auto p = sFabricComponentsClassMap.find(name);
|
|
27
|
+
if (p != sFabricComponentsClassMap.end()) {
|
|
28
|
+
auto classFunc = p->second;
|
|
29
|
+
return classFunc();
|
|
30
|
+
}
|
|
31
|
+
return nil;
|
|
32
|
+
}
|
|
@@ -57,7 +57,12 @@ static BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIE
|
|
|
57
57
|
|
|
58
58
|
- (void)setSafeAreaInsets:(UIEdgeInsets)safeAreaInsets
|
|
59
59
|
{
|
|
60
|
-
|
|
60
|
+
// Relayout with different padding may result in a close but slightly different result, amplified by Yoga rounding to
|
|
61
|
+
// physical pixel grid. To avoid infinite relayout, allow one physical pixel of difference, along with small amount of
|
|
62
|
+
// extra tolerance for FP error.
|
|
63
|
+
CGFloat tolerance = 1.0 / RCTScreenScale() + 0.01;
|
|
64
|
+
|
|
65
|
+
if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, tolerance)) {
|
|
61
66
|
return;
|
|
62
67
|
}
|
|
63
68
|
|
|
@@ -1278,14 +1278,12 @@ public class ReactInstanceManager {
|
|
|
1278
1278
|
uiManager.stopSurface(surfaceId);
|
|
1279
1279
|
} else {
|
|
1280
1280
|
FLog.w(ReactConstants.TAG, "Failed to stop surface, UIManager has already gone away");
|
|
1281
|
-
reactRoot.getRootViewGroup().removeAllViews();
|
|
1282
1281
|
}
|
|
1283
1282
|
} else {
|
|
1284
1283
|
ReactSoftExceptionLogger.logSoftException(
|
|
1285
1284
|
TAG,
|
|
1286
1285
|
new RuntimeException(
|
|
1287
1286
|
"detachRootViewFromInstance called with ReactRootView with invalid id"));
|
|
1288
|
-
reactRoot.getRootViewGroup().removeAllViews();
|
|
1289
1287
|
}
|
|
1290
1288
|
} else {
|
|
1291
1289
|
reactContext
|
|
@@ -1294,8 +1292,7 @@ public class ReactInstanceManager {
|
|
|
1294
1292
|
.unmountApplicationComponentAtRootTag(reactRoot.getRootViewTag());
|
|
1295
1293
|
}
|
|
1296
1294
|
|
|
1297
|
-
|
|
1298
|
-
reactRoot.getRootViewGroup().setId(View.NO_ID);
|
|
1295
|
+
clearReactRoot(reactRoot);
|
|
1299
1296
|
}
|
|
1300
1297
|
|
|
1301
1298
|
@ThreadConfined(UI)
|
|
@@ -9,6 +9,7 @@ package com.facebook.react.devsupport;
|
|
|
9
9
|
|
|
10
10
|
import android.net.Uri;
|
|
11
11
|
import android.os.AsyncTask;
|
|
12
|
+
import android.provider.Settings;
|
|
12
13
|
import androidx.annotation.NonNull;
|
|
13
14
|
import androidx.annotation.Nullable;
|
|
14
15
|
import com.facebook.common.logging.FLog;
|
|
@@ -30,6 +31,9 @@ import com.facebook.react.packagerconnection.Responder;
|
|
|
30
31
|
import com.facebook.react.util.RNLog;
|
|
31
32
|
import java.io.File;
|
|
32
33
|
import java.io.IOException;
|
|
34
|
+
import java.io.UnsupportedEncodingException;
|
|
35
|
+
import java.security.MessageDigest;
|
|
36
|
+
import java.security.NoSuchAlgorithmException;
|
|
33
37
|
import java.util.HashMap;
|
|
34
38
|
import java.util.Locale;
|
|
35
39
|
import java.util.Map;
|
|
@@ -244,13 +248,73 @@ public class DevServerHelper {
|
|
|
244
248
|
mPackagerConnectionSettings.getDebugServerHost());
|
|
245
249
|
}
|
|
246
250
|
|
|
251
|
+
private static String getSHA256(String string) {
|
|
252
|
+
MessageDigest digest = null;
|
|
253
|
+
try {
|
|
254
|
+
digest = MessageDigest.getInstance("SHA-256");
|
|
255
|
+
} catch (NoSuchAlgorithmException e) {
|
|
256
|
+
throw new AssertionError("Could not get standard SHA-256 algorithm", e);
|
|
257
|
+
}
|
|
258
|
+
digest.reset();
|
|
259
|
+
byte[] result;
|
|
260
|
+
try {
|
|
261
|
+
result = digest.digest(string.getBytes("UTF-8"));
|
|
262
|
+
} catch (UnsupportedEncodingException e) {
|
|
263
|
+
throw new AssertionError("This environment doesn't support UTF-8 encoding", e);
|
|
264
|
+
}
|
|
265
|
+
return String.format(
|
|
266
|
+
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
|
267
|
+
result[0],
|
|
268
|
+
result[1],
|
|
269
|
+
result[2],
|
|
270
|
+
result[3],
|
|
271
|
+
result[4],
|
|
272
|
+
result[5],
|
|
273
|
+
result[6],
|
|
274
|
+
result[7],
|
|
275
|
+
result[8],
|
|
276
|
+
result[9],
|
|
277
|
+
result[10],
|
|
278
|
+
result[11],
|
|
279
|
+
result[12],
|
|
280
|
+
result[13],
|
|
281
|
+
result[14],
|
|
282
|
+
result[15],
|
|
283
|
+
result[16],
|
|
284
|
+
result[17],
|
|
285
|
+
result[18],
|
|
286
|
+
result[19]);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Returns an opaque ID which is stable for the current combination of device and app, stable
|
|
290
|
+
// across installs, and unique across devices.
|
|
291
|
+
private String getInspectorDeviceId() {
|
|
292
|
+
// Every Android app has a unique application ID that looks like a Java or Kotlin package name,
|
|
293
|
+
// such as com.example.myapp. This ID uniquely identifies your app on the device and in the
|
|
294
|
+
// Google Play Store.
|
|
295
|
+
// [Source: Android docs]
|
|
296
|
+
String packageName = mPackageName;
|
|
297
|
+
|
|
298
|
+
// A 64-bit number expressed as a hexadecimal string, which is either:
|
|
299
|
+
// * unique to each combination of app-signing key, user, and device (API level >= 26), or
|
|
300
|
+
// * randomly generated when the user first sets up the device and should remain constant for
|
|
301
|
+
// the lifetime of the user's device (API level < 26).
|
|
302
|
+
// [Source: Android docs]
|
|
303
|
+
String androidId = Settings.Secure.ANDROID_ID;
|
|
304
|
+
|
|
305
|
+
String rawDeviceId = String.format(Locale.US, "android-%s-%s", packageName, androidId);
|
|
306
|
+
|
|
307
|
+
return getSHA256(rawDeviceId);
|
|
308
|
+
}
|
|
309
|
+
|
|
247
310
|
private String getInspectorDeviceUrl() {
|
|
248
311
|
return String.format(
|
|
249
312
|
Locale.US,
|
|
250
|
-
"http://%s/inspector/device?name=%s&app=%s",
|
|
313
|
+
"http://%s/inspector/device?name=%s&app=%s&device=%s",
|
|
251
314
|
mPackagerConnectionSettings.getInspectorServerHost(),
|
|
252
|
-
AndroidInfoHelpers.getFriendlyDeviceName(),
|
|
253
|
-
mPackageName)
|
|
315
|
+
Uri.encode(AndroidInfoHelpers.getFriendlyDeviceName()),
|
|
316
|
+
Uri.encode(mPackageName),
|
|
317
|
+
Uri.encode(getInspectorDeviceId()));
|
|
254
318
|
}
|
|
255
319
|
|
|
256
320
|
public void downloadBundleFromURL(
|
|
@@ -425,9 +489,10 @@ public class DevServerHelper {
|
|
|
425
489
|
String requestUrl =
|
|
426
490
|
String.format(
|
|
427
491
|
Locale.US,
|
|
428
|
-
"http://%s/open-debugger?appId=%s",
|
|
492
|
+
"http://%s/open-debugger?appId=%s&device=%s",
|
|
429
493
|
mPackagerConnectionSettings.getInspectorServerHost(),
|
|
430
|
-
Uri.encode(mPackageName)
|
|
494
|
+
Uri.encode(mPackageName),
|
|
495
|
+
Uri.encode(getInspectorDeviceId()));
|
|
431
496
|
Request request =
|
|
432
497
|
new Request.Builder().url(requestUrl).method("POST", RequestBody.create(null, "")).build();
|
|
433
498
|
|
|
@@ -40,6 +40,7 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
40
40
|
.put(KeyEvent.KEYCODE_MEDIA_PREVIOUS, "previous")
|
|
41
41
|
.put(KeyEvent.KEYCODE_MEDIA_REWIND, "rewind")
|
|
42
42
|
.put(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, "fastForward")
|
|
43
|
+
.put(KeyEvent.KEYCODE_MEDIA_RECORD, "record")
|
|
43
44
|
.put(KeyEvent.KEYCODE_MEDIA_STOP, "stop")
|
|
44
45
|
.put(KeyEvent.KEYCODE_MEDIA_NEXT, "next")
|
|
45
46
|
.put(KeyEvent.KEYCODE_MEDIA_PREVIOUS, "previous")
|
|
@@ -48,6 +49,7 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
48
49
|
.put(KeyEvent.KEYCODE_DPAD_DOWN, "down")
|
|
49
50
|
.put(KeyEvent.KEYCODE_DPAD_LEFT, "left")
|
|
50
51
|
.put(KeyEvent.KEYCODE_INFO, "info")
|
|
52
|
+
.put(KeyEvent.KEYCODE_CAPTIONS, "captions")
|
|
51
53
|
.put(KeyEvent.KEYCODE_MENU, "menu")
|
|
52
54
|
.put(KeyEvent.KEYCODE_0, "0")
|
|
53
55
|
.put(KeyEvent.KEYCODE_1, "1")
|
package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java
CHANGED
|
@@ -75,16 +75,6 @@ public abstract class ReactTextAnchorViewManager<T extends View, C extends React
|
|
|
75
75
|
view.setAdjustFontSizeToFit(adjustsFontSizeToFit);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
@ReactProp(name = ViewProps.ALLOW_FONT_SCALING, defaultBoolean = true)
|
|
79
|
-
public void setAllowFontScaling(ReactTextView view, boolean allowFontScaling) {
|
|
80
|
-
view.setAllowFontScaling(allowFontScaling);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@ReactProp(name = ViewProps.MAX_FONT_SIZE_MULTIPLIER, defaultFloat = Float.NaN)
|
|
84
|
-
public void setMaxFontSizeMultiplier(ReactTextView view, float maxFontSizeMultiplier) {
|
|
85
|
-
view.setMaxFontSizeMultiplier(maxFontSizeMultiplier);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
78
|
@ReactProp(name = ViewProps.FONT_SIZE)
|
|
89
79
|
public void setFontSize(ReactTextView view, float fontSize) {
|
|
90
80
|
view.setFontSize(fontSize);
|
|
@@ -58,6 +58,8 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
58
58
|
private int mNumberOfLines;
|
|
59
59
|
private TextUtils.TruncateAt mEllipsizeLocation;
|
|
60
60
|
private boolean mAdjustsFontSizeToFit;
|
|
61
|
+
private float mFontSize = Float.NaN;
|
|
62
|
+
private float mLetterSpacing = Float.NaN;
|
|
61
63
|
private int mLinkifyMaskType;
|
|
62
64
|
private boolean mNotifyOnInlineViewLayout;
|
|
63
65
|
private boolean mTextIsSelectable;
|
|
@@ -65,12 +67,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
65
67
|
private ReactViewBackgroundManager mReactBackgroundManager;
|
|
66
68
|
private Spannable mSpanned;
|
|
67
69
|
|
|
68
|
-
/**
|
|
69
|
-
* Used to collect some text size affecting attributes to fix some text cut-off issues when users
|
|
70
|
-
* adjust text size and font weight to the max value in system font settings.
|
|
71
|
-
*/
|
|
72
|
-
private TextAttributes mTextAttributes;
|
|
73
|
-
|
|
74
70
|
public ReactTextView(Context context) {
|
|
75
71
|
super(context);
|
|
76
72
|
|
|
@@ -102,7 +98,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
102
98
|
mEllipsizeLocation = TextUtils.TruncateAt.END;
|
|
103
99
|
|
|
104
100
|
mSpanned = null;
|
|
105
|
-
mTextAttributes = new TextAttributes();
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
/* package */ void recycleView() {
|
|
@@ -592,6 +587,29 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
592
587
|
mAdjustsFontSizeToFit = adjustsFontSizeToFit;
|
|
593
588
|
}
|
|
594
589
|
|
|
590
|
+
public void setFontSize(float fontSize) {
|
|
591
|
+
mFontSize =
|
|
592
|
+
mAdjustsFontSizeToFit
|
|
593
|
+
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize))
|
|
594
|
+
: (float) Math.ceil(PixelUtil.toPixelFromDIP(fontSize));
|
|
595
|
+
|
|
596
|
+
applyTextAttributes();
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
public void setLetterSpacing(float letterSpacing) {
|
|
600
|
+
if (Float.isNaN(letterSpacing)) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
float letterSpacingPixels = PixelUtil.toPixelFromDIP(letterSpacing);
|
|
605
|
+
|
|
606
|
+
// `letterSpacingPixels` and `getEffectiveFontSize` are both in pixels,
|
|
607
|
+
// yielding an accurate em value.
|
|
608
|
+
mLetterSpacing = letterSpacingPixels / mFontSize;
|
|
609
|
+
|
|
610
|
+
applyTextAttributes();
|
|
611
|
+
}
|
|
612
|
+
|
|
595
613
|
public void setEllipsizeLocation(TextUtils.TruncateAt ellipsizeLocation) {
|
|
596
614
|
mEllipsizeLocation = ellipsizeLocation;
|
|
597
615
|
}
|
|
@@ -607,8 +625,6 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
607
625
|
? null
|
|
608
626
|
: mEllipsizeLocation;
|
|
609
627
|
setEllipsize(ellipsizeLocation);
|
|
610
|
-
|
|
611
|
-
applyTextAttributes();
|
|
612
628
|
}
|
|
613
629
|
|
|
614
630
|
@Override
|
|
@@ -664,37 +680,16 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
664
680
|
return super.dispatchHoverEvent(event);
|
|
665
681
|
}
|
|
666
682
|
|
|
667
|
-
public void setLetterSpacing(float letterSpacing) {
|
|
668
|
-
mTextAttributes.setLetterSpacing(letterSpacing);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
public void setAllowFontScaling(boolean allowFontScaling) {
|
|
672
|
-
if (mTextAttributes.getAllowFontScaling() != allowFontScaling) {
|
|
673
|
-
mTextAttributes.setAllowFontScaling(allowFontScaling);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
public void setFontSize(float fontSize) {
|
|
678
|
-
mTextAttributes.setFontSize(fontSize);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
public void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
|
|
682
|
-
if (maxFontSizeMultiplier != mTextAttributes.getMaxFontSizeMultiplier()) {
|
|
683
|
-
mTextAttributes.setMaxFontSizeMultiplier(maxFontSizeMultiplier);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
683
|
private void applyTextAttributes() {
|
|
688
|
-
//
|
|
689
|
-
//
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
684
|
+
// Workaround for an issue where text can be cut off with an ellipsis when
|
|
685
|
+
// using certain font sizes and padding. Sets the provided text size and
|
|
686
|
+
// letter spacing to ensure consistent rendering and prevent cut-off.
|
|
687
|
+
if (!Float.isNaN(mFontSize)) {
|
|
688
|
+
setTextSize(TypedValue.COMPLEX_UNIT_PX, mFontSize);
|
|
689
|
+
}
|
|
694
690
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
super.setLetterSpacing(effectiveLetterSpacing);
|
|
691
|
+
if (!Float.isNaN(mLetterSpacing)) {
|
|
692
|
+
super.setLetterSpacing(mLetterSpacing);
|
|
698
693
|
}
|
|
699
694
|
}
|
|
700
695
|
}
|
|
@@ -34,7 +34,11 @@ class ReactNativeConfig;
|
|
|
34
34
|
class Scheduler;
|
|
35
35
|
class SurfaceHandlerBinding;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
struct JBinding : public jni::JavaClass<JBinding> {
|
|
38
|
+
constexpr static auto kJavaDescriptor = "Lcom/facebook/react/fabric/Binding;";
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
class Binding : public jni::HybridClass<Binding, JBinding>,
|
|
38
42
|
public SchedulerDelegate,
|
|
39
43
|
public LayoutAnimationStatusDelegate {
|
|
40
44
|
public:
|
|
@@ -13,8 +13,9 @@ namespace facebook::react {
|
|
|
13
13
|
|
|
14
14
|
Binding* JFabricUIManager::getBinding() {
|
|
15
15
|
static const auto bindingField =
|
|
16
|
-
javaClassStatic()->getField<
|
|
16
|
+
javaClassStatic()->getField<JBinding::javaobject>("mBinding");
|
|
17
17
|
|
|
18
|
-
return getFieldValue(bindingField)
|
|
18
|
+
return jni::static_ref_cast<Binding::javaobject>(getFieldValue(bindingField))
|
|
19
|
+
->cthis();
|
|
19
20
|
}
|
|
20
21
|
} // namespace facebook::react
|
|
@@ -17,8 +17,8 @@ namespace facebook::react {
|
|
|
17
17
|
constexpr struct {
|
|
18
18
|
int32_t Major = 0;
|
|
19
19
|
int32_t Minor = 73;
|
|
20
|
-
int32_t Patch =
|
|
21
|
-
std::string_view Prerelease = "
|
|
20
|
+
int32_t Patch = 1;
|
|
21
|
+
std::string_view Prerelease = "0";
|
|
22
22
|
} ReactNativeVersion;
|
|
23
23
|
|
|
24
24
|
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/rncore/ShadowNodes.h>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
|
+
|
|
19
|
+
using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor<ActivityIndicatorViewShadowNode>;
|
|
20
|
+
using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor<AndroidDrawerLayoutShadowNode>;
|
|
21
|
+
using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor<AndroidSwipeRefreshLayoutShadowNode>;
|
|
22
|
+
using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor<PullToRefreshViewShadowNode>;
|
|
23
|
+
using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor<AndroidHorizontalScrollContentViewShadowNode>;
|
|
24
|
+
using SwitchComponentDescriptor = ConcreteComponentDescriptor<SwitchShadowNode>;
|
|
25
|
+
using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor<TraceUpdateOverlayShadowNode>;
|
|
26
|
+
using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor<UnimplementedNativeViewShadowNode>;
|
|
27
|
+
|
|
28
|
+
} // namespace react
|
|
29
|
+
} // namespace facebook
|