Skip to content

Commit 46c4fb8

Browse files
committed
Merge branch 'main' into tts-span
2 parents c2adbb8 + 358b7a4 commit 46c4fb8

File tree

18 files changed

+641
-422
lines changed

18 files changed

+641
-422
lines changed

IntegrationTests/TimersTest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TimersTest extends React.Component<Props, State> {
3939
};
4040

4141
setTimeout(fn: () => void, time: number): TimeoutID {
42-
const id = setTimeout(() => {
42+
const id: TimeoutID = setTimeout(() => {
4343
this._timeoutIDs.delete(id);
4444
fn();
4545
}, time);
@@ -70,7 +70,7 @@ class TimersTest extends React.Component<Props, State> {
7070
}
7171

7272
setImmediate(fn: () => void): ImmediateID {
73-
const id = setImmediate(() => {
73+
const id: any = setImmediate(() => {
7474
this._immediateIDs.delete(id);
7575
fn();
7676
});
@@ -81,7 +81,7 @@ class TimersTest extends React.Component<Props, State> {
8181
}
8282

8383
requestAnimationFrame(fn: () => void): AnimationFrameID {
84-
const id = requestAnimationFrame(() => {
84+
const id: AnimationFrameID = requestAnimationFrame(() => {
8585
this._animationFrameIDs.delete(id);
8686
fn();
8787
});

Libraries/Animated/AnimatedImplementation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ const parallel = function (
415415
});
416416
},
417417

418-
_startNativeLoop: function () {
418+
_startNativeLoop: function (): empty {
419419
throw new Error(
420420
'Loops run using the native driver cannot contain Animated.parallel animations',
421421
);

Libraries/BatchedBridge/MessageQueue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ class MessageQueue {
252252
// folly-convertible. As a special case, if a prop value is a
253253
// function it is permitted here, and special-cased in the
254254
// conversion.
255-
const isValidArgument = (val: mixed) => {
255+
const isValidArgument = (val: mixed): boolean => {
256256
switch (typeof val) {
257257
case 'undefined':
258258
case 'boolean':

Libraries/BugReporting/getReactData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function copyWithSetImpl(
165165
path: Array<string | number>,
166166
idx: number,
167167
value: any,
168-
) {
168+
): any {
169169
if (idx >= path.length) {
170170
return value;
171171
}

Libraries/Core/Timers/JSTimers.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ const JSTimers = {
242242
* @param {function} func Callback to be invoked before the end of the
243243
* current JavaScript execution loop.
244244
*/
245-
queueReactNativeMicrotask: function (func: Function, ...args: any) {
245+
queueReactNativeMicrotask: function (func: Function, ...args: any): number {
246246
const id = _allocateCallback(
247247
() => func.apply(undefined, args),
248248
'queueReactNativeMicrotask',
@@ -254,7 +254,7 @@ const JSTimers = {
254254
/**
255255
* @param {function} func Callback to be invoked every frame.
256256
*/
257-
requestAnimationFrame: function (func: Function) {
257+
requestAnimationFrame: function (func: Function): any | number {
258258
const id = _allocateCallback(func, 'requestAnimationFrame');
259259
createTimer(id, 1, Date.now(), /* recurring */ false);
260260
return id;
@@ -265,16 +265,19 @@ const JSTimers = {
265265
* with time remaining in frame.
266266
* @param {?object} options
267267
*/
268-
requestIdleCallback: function (func: Function, options: ?Object) {
268+
requestIdleCallback: function (
269+
func: Function,
270+
options: ?Object,
271+
): any | number {
269272
if (requestIdleCallbacks.length === 0) {
270273
setSendIdleEvents(true);
271274
}
272275

273276
const timeout = options && options.timeout;
274-
const id = _allocateCallback(
277+
const id: number = _allocateCallback(
275278
timeout != null
276279
? (deadline: any) => {
277-
const timeoutId = requestIdleCallbackTimeouts[id];
280+
const timeoutId: number = requestIdleCallbackTimeouts[id];
278281
if (timeoutId) {
279282
JSTimers.clearTimeout(timeoutId);
280283
delete requestIdleCallbackTimeouts[id];
@@ -287,8 +290,8 @@ const JSTimers = {
287290
requestIdleCallbacks.push(id);
288291

289292
if (timeout != null) {
290-
const timeoutId = JSTimers.setTimeout(() => {
291-
const index = requestIdleCallbacks.indexOf(id);
293+
const timeoutId: number = JSTimers.setTimeout(() => {
294+
const index: number = requestIdleCallbacks.indexOf(id);
292295
if (index > -1) {
293296
requestIdleCallbacks.splice(index, 1);
294297
_callTimer(id, global.performance.now(), true);
@@ -345,7 +348,7 @@ const JSTimers = {
345348
* This is called from the native side. We are passed an array of timerIDs,
346349
* and
347350
*/
348-
callTimers: function (timersToCall: Array<number>) {
351+
callTimers: function (timersToCall: Array<number>): any | void {
349352
invariant(
350353
timersToCall.length !== 0,
351354
'Cannot call `callTimers` with an empty list of IDs.',

Libraries/Lists/ViewabilityHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class ViewabilityHelper {
234234
}
235235
this._viewableIndices = viewableIndices;
236236
if (this._config.minimumViewTime) {
237-
const handle = setTimeout(() => {
237+
const handle: TimeoutID = setTimeout(() => {
238238
/* $FlowFixMe[incompatible-call] (>=0.63.0 site=react_native_fb) This
239239
* comment suppresses an error found when Flow v0.63 was deployed. To
240240
* see the error delete this comment and run Flow. */

Libraries/LogBox/Data/LogBoxData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const observers: Set<{observer: Observer, ...}> = new Set();
6868
const ignorePatterns: Set<IgnorePattern> = new Set();
6969
let appInfo: ?() => AppInfo = null;
7070
let logs: LogBoxLogs = new Set();
71-
let updateTimeout = null;
71+
let updateTimeout: $FlowFixMe | null = null;
7272
let _isDisabled = false;
7373
let _selectedIndex = -1;
7474

Libraries/vendor/emitter/__tests__/EventEmitter-test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* @oncall react_native
1010
*/
1111

12+
import type {EventSubscription} from '../EventEmitter';
13+
1214
import EventEmitter from '../EventEmitter';
1315

1416
describe('listeners', () => {
@@ -309,15 +311,18 @@ describe('event emission', () => {
309311
const listenerA = jest.fn(() => {
310312
results.push('A');
311313
});
312-
const listenerB = jest.fn(() => {
314+
const listenerB: JestMockFn<Array<mixed>, void> = jest.fn(() => {
313315
results.push('B');
314316
subscriptionB.remove();
315317
});
316318
const listenerC = jest.fn(() => {
317319
results.push('C');
318320
});
319321
emitter.addListener('A', listenerA);
320-
const subscriptionB = emitter.addListener('A', listenerB);
322+
const subscriptionB: EventSubscription = emitter.addListener(
323+
'A',
324+
listenerB,
325+
);
321326
emitter.addListener('A', listenerC);
322327

323328
emitter.emit('A');

ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public class ReactFeatureFlags {
3737
*/
3838
public static boolean enableBridgelessArchitecture = false;
3939

40+
/**
41+
* Does the bridgeless architecture log soft exceptions. Could be useful for tracking down issues.
42+
*/
43+
public static volatile boolean enableBridgelessArchitectureSoftExceptions = false;
44+
4045
/**
4146
* After TurboModules and Fabric are enabled, we need to ensure that the legacy NativeModule isn't
4247
* isn't used. So, turn this flag on to trigger warnings whenever the legacy NativeModule system

packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ function getParamObjCType(
295295
function getReturnObjCType(
296296
methodName: string,
297297
nullableTypeAnnotation: Nullable<NativeModuleReturnTypeAnnotation>,
298-
) {
298+
): string {
299299
const [typeAnnotation, nullable] = unwrapNullable(nullableTypeAnnotation);
300300

301301
function wrapIntoNullableIfNeeded(generatedType: string) {

0 commit comments

Comments
 (0)