react-native 0.77.1 → 0.77.2
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 +1 -1
- package/Libraries/Image/Image.android.js +2 -0
- package/Libraries/Image/ImageViewNativeComponent.js +3 -4
- package/React/Base/RCTVersion.m +1 -1
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -7
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +8 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +9 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +24 -13
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +24 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +1 -43
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +4 -5
- package/package.json +10 -10
- package/react-native.config.js +11 -21
- package/scripts/codegen/generate-artifacts-executor.js +8 -4
- package/scripts/generate-codegen-artifacts.js +6 -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/sdks/hermesc/win64-bin/msvcp140.dll +0 -0
- package/sdks/hermesc/win64-bin/vcruntime140.dll +0 -0
- package/sdks/hermesc/win64-bin/vcruntime140_1.dll +0 -0
|
@@ -133,6 +133,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
|
|
133
133
|
width: undefined,
|
|
134
134
|
height: undefined,
|
|
135
135
|
};
|
|
136
|
+
const defaultSource = resolveAssetSource(props.defaultSource);
|
|
136
137
|
const loadingIndicatorSource = resolveAssetSource(
|
|
137
138
|
props.loadingIndicatorSource,
|
|
138
139
|
);
|
|
@@ -178,6 +179,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
|
|
178
179
|
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
|
179
180
|
* when making Flow check .android.js files. */
|
|
180
181
|
headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
|
|
182
|
+
defaultSource: defaultSource ? defaultSource.uri : null,
|
|
181
183
|
loadingIndicatorSrc: loadingIndicatorSource
|
|
182
184
|
? loadingIndicatorSource.uri
|
|
183
185
|
: null,
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
} from '../StyleSheet/StyleSheet';
|
|
22
22
|
import type {ResolvedAssetSource} from './AssetSourceResolver';
|
|
23
23
|
import type {ImageProps} from './ImageProps';
|
|
24
|
+
import type {ImageSource} from './ImageSource';
|
|
24
25
|
|
|
25
26
|
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
|
|
26
27
|
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
|
|
@@ -42,7 +43,7 @@ type Props = $ReadOnly<{
|
|
|
42
43
|
| ?ResolvedAssetSource
|
|
43
44
|
| ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
|
|
44
45
|
headers?: ?{[string]: string},
|
|
45
|
-
|
|
46
|
+
defaultSource?: ?ImageSource | ?string,
|
|
46
47
|
loadingIndicatorSrc?: ?string,
|
|
47
48
|
}>;
|
|
48
49
|
|
|
@@ -82,9 +83,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|
|
82
83
|
},
|
|
83
84
|
validAttributes: {
|
|
84
85
|
blurRadius: true,
|
|
85
|
-
defaultSource:
|
|
86
|
-
process: require('./resolveAssetSource'),
|
|
87
|
-
},
|
|
86
|
+
defaultSource: true,
|
|
88
87
|
internal_analyticTag: true,
|
|
89
88
|
resizeMethod: true,
|
|
90
89
|
resizeMode: true,
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -101,11 +101,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
101
101
|
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
|
|
102
102
|
[_backedTextInputView.defaultTextAttributes mutableCopy];
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
|
|
106
|
-
eventEmitterWrapper.eventEmitter = _eventEmitter;
|
|
107
|
-
defaultAttributes[RCTAttributedStringEventEmitterKey] = eventEmitterWrapper;
|
|
108
|
-
#endif
|
|
104
|
+
defaultAttributes[RCTAttributedStringEventEmitterKey] = RCTWrapEventEmitter(_eventEmitter);
|
|
109
105
|
|
|
110
106
|
_backedTextInputView.defaultTextAttributes = defaultAttributes;
|
|
111
107
|
}
|
|
@@ -266,10 +262,8 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
266
262
|
if (newTextInputProps.textAttributes != oldTextInputProps.textAttributes) {
|
|
267
263
|
NSMutableDictionary<NSAttributedStringKey, id> *defaultAttributes =
|
|
268
264
|
RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));
|
|
269
|
-
#if !TARGET_OS_MACCATALYST
|
|
270
265
|
defaultAttributes[RCTAttributedStringEventEmitterKey] =
|
|
271
266
|
_backedTextInputView.defaultTextAttributes[RCTAttributedStringEventEmitterKey];
|
|
272
|
-
#endif
|
|
273
267
|
_backedTextInputView.defaultTextAttributes = defaultAttributes;
|
|
274
268
|
}
|
|
275
269
|
|
|
@@ -445,12 +445,18 @@ public class FabricUIManager
|
|
|
445
445
|
|
|
446
446
|
@Override
|
|
447
447
|
public void markActiveTouchForTag(int surfaceId, int reactTag) {
|
|
448
|
-
mMountingManager.getSurfaceManager(surfaceId)
|
|
448
|
+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
|
449
|
+
if (surfaceMountingManager != null) {
|
|
450
|
+
surfaceMountingManager.markActiveTouchForTag(reactTag);
|
|
451
|
+
}
|
|
449
452
|
}
|
|
450
453
|
|
|
451
454
|
@Override
|
|
452
455
|
public void sweepActiveTouchForTag(int surfaceId, int reactTag) {
|
|
453
|
-
mMountingManager.getSurfaceManager(surfaceId)
|
|
456
|
+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
|
457
|
+
if (surfaceMountingManager != null) {
|
|
458
|
+
surfaceMountingManager.sweepActiveTouchForTag(reactTag);
|
|
459
|
+
}
|
|
454
460
|
}
|
|
455
461
|
|
|
456
462
|
/**
|
|
@@ -124,7 +124,7 @@ public constructor(
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
@ReactProp(name = "defaultSource"
|
|
127
|
+
@ReactProp(name = "defaultSource")
|
|
128
128
|
public fun setDefaultSource(view: ReactImageView, source: String?) {
|
|
129
129
|
view.setDefaultSource(source)
|
|
130
130
|
}
|
package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm
CHANGED
|
@@ -446,6 +446,15 @@ void ObjCInteropTurboModule::setInvocationArg(
|
|
|
446
446
|
|
|
447
447
|
if (objCArgType == @encode(id)) {
|
|
448
448
|
id arg = RCTConvertTo<id>(selector, objCArg);
|
|
449
|
+
|
|
450
|
+
// Handle the special case where there is an argument and it must be nil
|
|
451
|
+
// Without this check, the JS side will receive an object.
|
|
452
|
+
// See: discussion at
|
|
453
|
+
// https://github.com/facebook/react-native/pull/49250#issuecomment-2668465893
|
|
454
|
+
if (arg == [NSNull null]) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
|
|
449
458
|
if (arg) {
|
|
450
459
|
[retainedObjectsForInvocation addObject:arg];
|
|
451
460
|
}
|
|
@@ -57,7 +57,7 @@ static jsi::Value convertNSNumberToJSINumber(jsi::Runtime &runtime, NSNumber *va
|
|
|
57
57
|
|
|
58
58
|
static jsi::String convertNSStringToJSIString(jsi::Runtime &runtime, NSString *value)
|
|
59
59
|
{
|
|
60
|
-
return jsi::String::createFromUtf8(runtime, [value UTF8String]
|
|
60
|
+
return jsi::String::createFromUtf8(runtime, [value UTF8String] ? [value UTF8String] : "");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDictionary *value)
|
|
@@ -213,7 +213,11 @@ static jsi::Value createJSRuntimeError(jsi::Runtime &runtime, const std::string
|
|
|
213
213
|
/**
|
|
214
214
|
* Creates JSError with current JS runtime and NSException stack trace.
|
|
215
215
|
*/
|
|
216
|
-
static jsi::JSError convertNSExceptionToJSError(
|
|
216
|
+
static jsi::JSError convertNSExceptionToJSError(
|
|
217
|
+
jsi::Runtime &runtime,
|
|
218
|
+
NSException *exception,
|
|
219
|
+
const std::string &moduleName,
|
|
220
|
+
const std::string &methodName)
|
|
217
221
|
{
|
|
218
222
|
std::string reason = [exception.reason UTF8String];
|
|
219
223
|
|
|
@@ -224,7 +228,8 @@ static jsi::JSError convertNSExceptionToJSError(jsi::Runtime &runtime, NSExcepti
|
|
|
224
228
|
cause.setProperty(
|
|
225
229
|
runtime, "stackReturnAddresses", convertNSArrayToJSIArray(runtime, exception.callStackReturnAddresses));
|
|
226
230
|
|
|
227
|
-
|
|
231
|
+
std::string message = moduleName + "." + methodName + " raised an exception: " + reason;
|
|
232
|
+
jsi::Value error = createJSRuntimeError(runtime, message);
|
|
228
233
|
error.asObject(runtime).setProperty(runtime, "cause", std::move(cause));
|
|
229
234
|
return {runtime, std::move(error)};
|
|
230
235
|
}
|
|
@@ -356,28 +361,34 @@ id ObjCTurboModule::performMethodInvocation(
|
|
|
356
361
|
}
|
|
357
362
|
|
|
358
363
|
if (isSync) {
|
|
359
|
-
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName,
|
|
364
|
+
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
|
|
360
365
|
} else {
|
|
361
|
-
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName,
|
|
366
|
+
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
|
|
362
367
|
}
|
|
363
368
|
|
|
364
369
|
@try {
|
|
365
370
|
[inv invokeWithTarget:strongModule];
|
|
366
371
|
} @catch (NSException *exception) {
|
|
367
|
-
|
|
372
|
+
if (isSync) {
|
|
373
|
+
// We can only convert NSException to JSError in sync method calls.
|
|
374
|
+
// See https://github.com/reactwg/react-native-new-architecture/discussions/276#discussioncomment-12567155
|
|
375
|
+
throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
|
|
376
|
+
} else {
|
|
377
|
+
@throw exception;
|
|
378
|
+
}
|
|
368
379
|
} @finally {
|
|
369
380
|
[retainedObjectsForInvocation removeAllObjects];
|
|
370
381
|
}
|
|
371
382
|
|
|
372
383
|
if (!isSync) {
|
|
373
|
-
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName,
|
|
384
|
+
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
|
|
374
385
|
return;
|
|
375
386
|
}
|
|
376
387
|
|
|
377
388
|
void *rawResult;
|
|
378
389
|
[inv getReturnValue:&rawResult];
|
|
379
390
|
result = (__bridge id)rawResult;
|
|
380
|
-
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName,
|
|
391
|
+
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
|
|
381
392
|
};
|
|
382
393
|
|
|
383
394
|
if (isSync) {
|
|
@@ -419,23 +430,23 @@ void ObjCTurboModule::performVoidMethodInvocation(
|
|
|
419
430
|
}
|
|
420
431
|
|
|
421
432
|
if (shouldVoidMethodsExecuteSync_) {
|
|
422
|
-
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName,
|
|
433
|
+
TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
|
|
423
434
|
} else {
|
|
424
|
-
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName,
|
|
435
|
+
TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
|
|
425
436
|
}
|
|
426
437
|
|
|
427
438
|
@try {
|
|
428
439
|
[inv invokeWithTarget:strongModule];
|
|
429
440
|
} @catch (NSException *exception) {
|
|
430
|
-
throw convertNSExceptionToJSError(runtime, exception);
|
|
441
|
+
throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
|
|
431
442
|
} @finally {
|
|
432
443
|
[retainedObjectsForInvocation removeAllObjects];
|
|
433
444
|
}
|
|
434
445
|
|
|
435
446
|
if (shouldVoidMethodsExecuteSync_) {
|
|
436
|
-
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName,
|
|
447
|
+
TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
|
|
437
448
|
} else {
|
|
438
|
-
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName,
|
|
449
|
+
TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
|
|
439
450
|
}
|
|
440
451
|
|
|
441
452
|
return;
|
|
@@ -52,8 +52,29 @@ BOOL RCTIsAttributedStringEffectivelySame(
|
|
|
52
52
|
NSDictionary<NSAttributedStringKey, id> *insensitiveAttributes,
|
|
53
53
|
const facebook::react::TextAttributes &baseTextAttributes);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
static inline NSData *RCTWrapEventEmitter(const facebook::react::SharedEventEmitter &eventEmitter)
|
|
56
|
+
{
|
|
57
|
+
auto eventEmitterPtr = new std::weak_ptr<const facebook::react::EventEmitter>(eventEmitter);
|
|
58
|
+
return [[NSData alloc] initWithBytesNoCopy:eventEmitterPtr
|
|
59
|
+
length:sizeof(eventEmitterPtr)
|
|
60
|
+
deallocator:^(void *ptrToDelete, NSUInteger) {
|
|
61
|
+
delete (std::weak_ptr<facebook::react::EventEmitter> *)ptrToDelete;
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static inline facebook::react::SharedEventEmitter RCTUnwrapEventEmitter(NSData *data)
|
|
66
|
+
{
|
|
67
|
+
if (data.length == 0) {
|
|
68
|
+
return nullptr;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
auto weakPtr = dynamic_cast<std::weak_ptr<const facebook::react::EventEmitter> *>(
|
|
72
|
+
(std::weak_ptr<const facebook::react::EventEmitter> *)data.bytes);
|
|
73
|
+
if (weakPtr) {
|
|
74
|
+
return weakPtr->lock();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return nullptr;
|
|
78
|
+
}
|
|
58
79
|
|
|
59
80
|
NS_ASSUME_NONNULL_END
|
|
@@ -16,45 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
using namespace facebook::react;
|
|
18
18
|
|
|
19
|
-
@implementation RCTWeakEventEmitterWrapper {
|
|
20
|
-
std::weak_ptr<const EventEmitter> _weakEventEmitter;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
- (void)setEventEmitter:(SharedEventEmitter)eventEmitter
|
|
24
|
-
{
|
|
25
|
-
_weakEventEmitter = eventEmitter;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
- (SharedEventEmitter)eventEmitter
|
|
29
|
-
{
|
|
30
|
-
return _weakEventEmitter.lock();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
- (void)dealloc
|
|
34
|
-
{
|
|
35
|
-
_weakEventEmitter.reset();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
- (BOOL)isEqual:(id)object
|
|
39
|
-
{
|
|
40
|
-
// We consider the underlying EventEmitter as the identity
|
|
41
|
-
if (![object isKindOfClass:[self class]]) {
|
|
42
|
-
return NO;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
auto thisEventEmitter = [self eventEmitter];
|
|
46
|
-
auto otherEventEmitter = [((RCTWeakEventEmitterWrapper *)object) eventEmitter];
|
|
47
|
-
return thisEventEmitter == otherEventEmitter;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
- (NSUInteger)hash
|
|
51
|
-
{
|
|
52
|
-
// We consider the underlying EventEmitter as the identity
|
|
53
|
-
return (NSUInteger)_weakEventEmitter.lock().get();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@end
|
|
57
|
-
|
|
58
19
|
inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight)
|
|
59
20
|
{
|
|
60
21
|
assert(fontWeight > 50);
|
|
@@ -405,10 +366,8 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
|
|
|
405
366
|
{
|
|
406
367
|
auto nsAttributedStringFragment = RCTNSAttributedStringFragmentFromFragment(fragment, placeholderImage);
|
|
407
368
|
|
|
408
|
-
#if !TARGET_OS_MACCATALYST
|
|
409
369
|
if (fragment.parentShadowView.componentHandle) {
|
|
410
|
-
|
|
411
|
-
eventEmitterWrapper.eventEmitter = fragment.parentShadowView.eventEmitter;
|
|
370
|
+
auto eventEmitterWrapper = RCTWrapEventEmitter(fragment.parentShadowView.eventEmitter);
|
|
412
371
|
|
|
413
372
|
NSDictionary<NSAttributedStringKey, id> *additionalTextAttributes =
|
|
414
373
|
@{RCTAttributedStringEventEmitterKey : eventEmitterWrapper};
|
|
@@ -416,7 +375,6 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
|
|
|
416
375
|
[nsAttributedStringFragment addAttributes:additionalTextAttributes
|
|
417
376
|
range:NSMakeRange(0, nsAttributedStringFragment.length)];
|
|
418
377
|
}
|
|
419
|
-
#endif
|
|
420
378
|
|
|
421
379
|
return nsAttributedStringFragment;
|
|
422
380
|
}
|
|
@@ -280,11 +280,10 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
|
|
280
280
|
// after (fraction == 1.0) the last character, then the attribute is valid.
|
|
281
281
|
if (textStorage.length > 0 && (fraction > 0 || characterIndex > 0) &&
|
|
282
282
|
(fraction < 1 || characterIndex < textStorage.length - 1)) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return eventEmitterWrapper.eventEmitter;
|
|
283
|
+
NSData *eventEmitterWrapper = (NSData *)[textStorage attribute:RCTAttributedStringEventEmitterKey
|
|
284
|
+
atIndex:characterIndex
|
|
285
|
+
effectiveRange:NULL];
|
|
286
|
+
return RCTUnwrapEventEmitter(eventEmitterWrapper);
|
|
288
287
|
}
|
|
289
288
|
|
|
290
289
|
return nil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native",
|
|
3
|
-
"version": "0.77.
|
|
3
|
+
"version": "0.77.2",
|
|
4
4
|
"description": "A framework for building native apps using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -108,13 +108,13 @@
|
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
110
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
111
|
-
"@react-native/assets-registry": "0.77.
|
|
112
|
-
"@react-native/codegen": "0.77.
|
|
113
|
-
"@react-native/community-cli-plugin": "0.77.
|
|
114
|
-
"@react-native/gradle-plugin": "0.77.
|
|
115
|
-
"@react-native/js-polyfills": "0.77.
|
|
116
|
-
"@react-native/normalize-colors": "0.77.
|
|
117
|
-
"@react-native/virtualized-lists": "0.77.
|
|
111
|
+
"@react-native/assets-registry": "0.77.2",
|
|
112
|
+
"@react-native/codegen": "0.77.2",
|
|
113
|
+
"@react-native/community-cli-plugin": "0.77.2",
|
|
114
|
+
"@react-native/gradle-plugin": "0.77.2",
|
|
115
|
+
"@react-native/js-polyfills": "0.77.2",
|
|
116
|
+
"@react-native/normalize-colors": "0.77.2",
|
|
117
|
+
"@react-native/virtualized-lists": "0.77.2",
|
|
118
118
|
"abort-controller": "^3.0.0",
|
|
119
119
|
"anser": "^1.4.9",
|
|
120
120
|
"ansi-regex": "^5.0.0",
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
"jest-environment-node": "^29.6.3",
|
|
131
131
|
"jsc-android": "^250231.0.0",
|
|
132
132
|
"memoize-one": "^5.0.0",
|
|
133
|
-
"metro-runtime": "^0.81.
|
|
134
|
-
"metro-source-map": "^0.81.
|
|
133
|
+
"metro-runtime": "^0.81.3",
|
|
134
|
+
"metro-source-map": "^0.81.3",
|
|
135
135
|
"nullthrows": "^1.1.1",
|
|
136
136
|
"pretty-format": "^29.7.0",
|
|
137
137
|
"promise": "^8.3.0",
|
package/react-native.config.js
CHANGED
|
@@ -44,27 +44,11 @@ try {
|
|
|
44
44
|
|
|
45
45
|
const commands = [];
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
commands.push(bundleCommand, startCommand);
|
|
53
|
-
} catch (e) {
|
|
54
|
-
const known =
|
|
55
|
-
e.code === 'MODULE_NOT_FOUND' &&
|
|
56
|
-
e.message.includes('@react-native-community/cli-server-api');
|
|
57
|
-
|
|
58
|
-
if (!known) {
|
|
59
|
-
throw e;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (verbose) {
|
|
63
|
-
console.warn(
|
|
64
|
-
'@react-native-community/cli-server-api not found, the react-native.config.js may be unusable.',
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
47
|
+
const {
|
|
48
|
+
bundleCommand,
|
|
49
|
+
startCommand,
|
|
50
|
+
} = require('@react-native/community-cli-plugin');
|
|
51
|
+
commands.push(bundleCommand, startCommand);
|
|
68
52
|
|
|
69
53
|
const codegenCommand = {
|
|
70
54
|
name: 'codegen',
|
|
@@ -84,12 +68,18 @@ const codegenCommand = {
|
|
|
84
68
|
name: '--outputPath <path>',
|
|
85
69
|
description: 'Path where generated artifacts will be output to.',
|
|
86
70
|
},
|
|
71
|
+
{
|
|
72
|
+
name: '--source <string>',
|
|
73
|
+
description: 'Whether the script is invoked from an `app` or a `library`',
|
|
74
|
+
default: 'app',
|
|
75
|
+
},
|
|
87
76
|
],
|
|
88
77
|
func: (argv, config, args) =>
|
|
89
78
|
require('./scripts/codegen/generate-artifacts-executor').execute(
|
|
90
79
|
args.path,
|
|
91
80
|
args.platform,
|
|
92
81
|
args.outputPath,
|
|
82
|
+
args.source,
|
|
93
83
|
),
|
|
94
84
|
};
|
|
95
85
|
|
|
@@ -899,11 +899,12 @@ function generateFBReactNativeSpecIOS(projectRoot /*: string */) /*: void*/ {
|
|
|
899
899
|
* @parameter projectRoot: the directory with the app source code, where the package.json lives.
|
|
900
900
|
* @parameter baseOutputPath: the base output path for the CodeGen.
|
|
901
901
|
* @parameter targetPlatform: the target platform. Supported values: 'android', 'ios', 'all'.
|
|
902
|
+
* @parameter source: the source that is invoking codegen. Supported values: 'app', 'library'.
|
|
902
903
|
* @throws If it can't find a config file for react-native.
|
|
903
904
|
* @throws If it can't find a CodeGen configuration in the file.
|
|
904
905
|
* @throws If it can't find a cli for the CodeGen.
|
|
905
906
|
*/
|
|
906
|
-
function execute(projectRoot, targetPlatform, baseOutputPath) {
|
|
907
|
+
function execute(projectRoot, targetPlatform, baseOutputPath, source) {
|
|
907
908
|
try {
|
|
908
909
|
codegenLog(`Analyzing ${path.join(projectRoot, 'package.json')}`);
|
|
909
910
|
|
|
@@ -951,9 +952,12 @@ function execute(projectRoot, targetPlatform, baseOutputPath) {
|
|
|
951
952
|
platform,
|
|
952
953
|
);
|
|
953
954
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
if (source === 'app') {
|
|
956
|
+
// These components are only required by apps, not by libraries
|
|
957
|
+
generateRCTThirdPartyComponents(libraries, outputPath);
|
|
958
|
+
generateCustomURLHandlers(libraries, outputPath);
|
|
959
|
+
generateAppDependencyProvider(outputPath);
|
|
960
|
+
}
|
|
957
961
|
|
|
958
962
|
cleanupEmptyFilesAndFolders(outputPath);
|
|
959
963
|
}
|
|
@@ -25,7 +25,12 @@ const argv = yargs
|
|
|
25
25
|
alias: 'outputPath',
|
|
26
26
|
description: 'Path where generated artifacts will be output to.',
|
|
27
27
|
})
|
|
28
|
+
.option('s', {
|
|
29
|
+
alias: 'source',
|
|
30
|
+
description: 'Whether the script is invoked from an `app` or a `library`',
|
|
31
|
+
default: 'app',
|
|
32
|
+
})
|
|
28
33
|
.usage('Usage: $0 -p [path to app] -t [target platform] -o [output path]')
|
|
29
34
|
.demandOption(['p', 't']).argv;
|
|
30
35
|
|
|
31
|
-
executor.execute(argv.path, argv.targetPlatform, argv.outputPath);
|
|
36
|
+
executor.execute(argv.path, argv.targetPlatform, argv.outputPath, argv.source);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|