Skip to content

Commit

Permalink
Merge branch 'main' into text-input-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Mar 16, 2022
2 parents f22e1f3 + bbeb50e commit caab17c
Show file tree
Hide file tree
Showing 219 changed files with 5,108 additions and 1,029 deletions.
6 changes: 2 additions & 4 deletions .circleci/Dockerfiles/Dockerfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# and build a Android application that can be used to run the
# tests specified in the scripts/ directory.
#
FROM reactnativecommunity/react-native-android:5.2
FROM reactnativecommunity/react-native-android:5.4

LABEL Description="React Native Android Test Image"
LABEL maintainer="Héctor Ramos <hector@fb.com>"
Expand Down Expand Up @@ -53,6 +53,4 @@ ADD . /app

RUN yarn

RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog

RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1
RUN ./gradlew :ReactAndroid:assembleDebug
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ executors:
reactnativeandroid:
<<: *defaults
docker:
- image: reactnativecommunity/react-native-android:5.2
- image: reactnativecommunity/react-native-android:5.4
resource_class: "large"
environment:
- TERM: "dumb"
Expand Down
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ untyped-import
untyped-type-import

[version]
^0.172.0
^0.173.0
2 changes: 1 addition & 1 deletion .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ untyped-import
untyped-type-import

[version]
^0.172.0
^0.173.0
7 changes: 7 additions & 0 deletions Libraries/ActionSheetIOS/ActionSheetIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ const ActionSheetIOS = {
successCallback,
);
},

dismissActionSheet: () => {
invariant(RCTActionSheetManager, "ActionSheetManager doesn't exist");
if (typeof RCTActionSheetManager.dismissActionSheet === 'function') {
RCTActionSheetManager.dismissActionSheet();
}
},
};

module.exports = ActionSheetIOS;
1 change: 1 addition & 0 deletions Libraries/ActionSheetIOS/NativeActionSheetManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface Spec extends TurboModule {
|}) => void,
successCallback: (completed: boolean, activityType: ?string) => void,
) => void;
+dismissActionSheet?: () => void;
}

export default (TurboModuleRegistry.get<Spec>('ActionSheetManager'): ?Spec);
2 changes: 1 addition & 1 deletion Libraries/Blob/React-RCTBlob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}

s.dependency "RCT-Folly", folly_version
Expand Down
8 changes: 7 additions & 1 deletion Libraries/Blob/URL.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ export class URLSearchParams {
}
const last = this._searchParams.length - 1;
return this._searchParams.reduce((acc, curr, index) => {
return acc + curr.join('=') + (index === last ? '' : '&');
return (
acc +
encodeURIComponent(curr[0]) +
'=' +
encodeURIComponent(curr[1]) +
(index === last ? '' : '&')
);
}, '');
}
}
Expand Down
7 changes: 6 additions & 1 deletion Libraries/Components/StatusBar/StatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,12 @@ class StatusBar extends React.Component<Props> {
if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) {
NativeStatusBarManagerAndroid.setHidden(mergedProps.hidden.value);
}
if (!oldProps || oldProps.translucent !== mergedProps.translucent) {
// Activities are not translucent by default, so always set if true.
if (
!oldProps ||
oldProps.translucent !== mergedProps.translucent ||
mergedProps.translucent
) {
NativeStatusBarManagerAndroid.setTranslucent(mergedProps.translucent);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Core/ExceptionsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
* @flow strict
*/

'use strict';
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Image/React-RCTImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}

s.dependency "RCT-Folly", folly_version
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LinkingIOS/React-RCTLinking.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}

s.dependency "React-Codegen", version
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LogBox/Data/LogBoxData.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @flow strict
* @format
*/

Expand Down
2 changes: 1 addition & 1 deletion Libraries/LogBox/Data/LogBoxLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @flow strict
* @format
*/

Expand Down
2 changes: 1 addition & 1 deletion Libraries/LogBox/Data/LogBoxSymbolication.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @flow strict
* @format
*/

Expand Down
2 changes: 1 addition & 1 deletion Libraries/LogBox/Data/parseLogBoxLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @flow strict
* @format
*/

Expand Down
23 changes: 2 additions & 21 deletions Libraries/LogBox/LogBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict
* @format
*/

Expand Down Expand Up @@ -75,24 +75,6 @@ if (__DEV__) {
consoleErrorImpl = registerError;
consoleWarnImpl = registerWarning;

if ((console: any).disableYellowBox === true) {
LogBoxData.setDisabled(true);
console.warn(
'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.',
);
}

(Object.defineProperty: any)(console, 'disableYellowBox', {
configurable: true,
get: () => LogBoxData.isDisabled(),
set: value => {
LogBoxData.setDisabled(value);
console.warn(
'console.disableYellowBox has been deprecated and will be removed in a future release. Please use LogBox.ignoreAllLogs(value) instead.',
);
},
});

if (Platform.isTesting) {
LogBoxData.setDisabled(true);
}
Expand All @@ -115,7 +97,6 @@ if (__DEV__) {
// After uninstalling: original > LogBox (noop) > OtherErrorHandler
consoleErrorImpl = originalConsoleError;
consoleWarnImpl = originalConsoleWarn;
delete (console: any).disableLogBox;
},

isInstalled(): boolean {
Expand Down Expand Up @@ -153,7 +134,7 @@ if (__DEV__) {
return typeof args[0] === 'string' && args[0].startsWith('(ADVICE)');
};

const isWarningModuleWarning = (...args: any) => {
const isWarningModuleWarning = (...args: Array<mixed>) => {
return typeof args[0] === 'string' && args[0].startsWith('Warning: ');
};

Expand Down
1 change: 0 additions & 1 deletion Libraries/LogBox/__tests__/LogBox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('LogBox', () => {
console.error = jest.fn();
console.log = jest.fn();
console.warn = jest.fn();
console.disableYellowBox = false;
});

afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/NativeAnimation/React-RCTAnimation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}

s.dependency "RCT-Folly", folly_version
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/React-RCTNetwork.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}
s.frameworks = "MobileCoreServices"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}
s.framework = "UserNotifications"

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Settings/React-RCTSettings.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}

s.dependency "RCT-Folly", folly_version
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Vibration/React-RCTVibration.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
}
s.frameworks = "AudioToolbox"

Expand Down
6 changes: 0 additions & 6 deletions React/Base/RCTConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,3 @@ RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollec
*/
RCT_EXTERN BOOL RCTExperimentGetPreemptiveViewAllocationDisabled(void);
RCT_EXTERN void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value);

/*
* Interop layer keep view hierarchy.
*/
RCT_EXTERN BOOL RCTGetInteropLayerKeepViewHierarchy(void);
RCT_EXTERN void RCTSetInteropLayerKeepViewHierarchy(BOOL value);
15 changes: 0 additions & 15 deletions React/Base/RCTConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,3 @@ void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value)
{
RCTExperimentPreemptiveViewAllocationDisabled = value;
}

/*
* Preemptive View Allocation
*/
static BOOL RCTInteropLayerKeepViewHierarchy = NO;

BOOL RCTGetInteropLayerKeepViewHierarchy()
{
return RCTInteropLayerKeepViewHierarchy;
}

void RCTSetInteropLayerKeepViewHierarchy(BOOL value)
{
RCTInteropLayerKeepViewHierarchy = value;
}
5 changes: 1 addition & 4 deletions React/Base/RCTJavaScriptLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@

extern NSString *const RCTJavaScriptLoaderErrorDomain;

extern const UInt32 RCT_BYTECODE_ALIGNMENT;

UInt32 RCTReadUInt32LE(NSData *script, UInt32 offset);
bool RCTIsBytecodeBundle(NSData *script);
extern const uint32_t RCT_BYTECODE_ALIGNMENT;

NS_ENUM(NSInteger){
RCTJavaScriptLoaderErrorNoScriptURL = 1,
Expand Down
28 changes: 11 additions & 17 deletions React/Base/RCTJavaScriptLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@

NSString *const RCTJavaScriptLoaderErrorDomain = @"RCTJavaScriptLoaderErrorDomain";

const UInt32 RCT_BYTECODE_ALIGNMENT = 4;
UInt32 RCTReadUInt32LE(NSData *script, UInt32 offset)
{
return [script length] < offset + 4 ? 0 : CFSwapInt32LittleToHost(*(((uint32_t *)[script bytes]) + offset / 4));
}

bool RCTIsBytecodeBundle(NSData *script)
{
static const UInt32 BYTECODE_BUNDLE_MAGIC_NUMBER = 0xffe7c3c3;
return (
[script length] > 8 && RCTReadUInt32LE(script, 0) == BYTECODE_BUNDLE_MAGIC_NUMBER &&
RCTReadUInt32LE(script, 4) > 0);
}
const uint32_t RCT_BYTECODE_ALIGNMENT = 4;

@interface RCTSource () {
@public
Expand All @@ -47,12 +35,18 @@ @implementation RCTSource

static RCTSource *RCTSourceCreate(NSURL *url, NSData *data, int64_t length) NS_RETURNS_RETAINED
{
using facebook::react::ScriptTag;
facebook::react::BundleHeader header;
[data getBytes:&header length:sizeof(header)];

RCTSource *source = [RCTSource new];
source->_url = url;
// Multipart responses may give us an unaligned view into the buffer. This ensures memory is aligned.
source->_data = (RCTIsBytecodeBundle(data) && ((long)[data bytes] % RCT_BYTECODE_ALIGNMENT))
? [[NSData alloc] initWithData:data]
: data;
if (parseTypeFromHeader(header) == ScriptTag::MetroHBCBundle && ((long)[data bytes] % RCT_BYTECODE_ALIGNMENT)) {
source->_data = [[NSData alloc] initWithData:data];
} else {
source->_data = data;
}
source->_length = length;
source->_filesChangedCount = RCTSourceFilesChangedCountNotBuiltByBundler;
return source;
Expand Down Expand Up @@ -177,7 +171,7 @@ + (NSData *)attemptSynchronousLoadOfBundleAtURL:(NSURL *)scriptURL

facebook::react::ScriptTag tag = facebook::react::parseTypeFromHeader(header);
switch (tag) {
case facebook::react::ScriptTag::HBCBundle:
case facebook::react::ScriptTag::MetroHBCBundle:
case facebook::react::ScriptTag::RAMBundle:
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
// `RCTRootViewSizeFlexibilityNone` is the RCTRootView's default.
RCTSurfaceSizeMeasureMode sizeMeasureMode = convertToSurfaceSizeMeasureMode(RCTRootViewSizeFlexibilityNone);

id<RCTSurfaceProtocol> surface = [[self class] createSurfaceWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
[surface start];
if (self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) {
// Nothing specific to do.
}
self = [super initWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties
sizeMeasureMode:sizeMeasureMode];

RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
id<RCTSurfaceProtocol> surface = [[self class] createSurfaceWithBridge:bridge
moduleName:moduleName
initialProperties:initialProperties];
[surface start];
return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode];
if (self = [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) {
[surface start];
}
return self;
}

- (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
Expand Down
Loading

0 comments on commit caab17c

Please sign in to comment.