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
- * @flow
8
- */
9
-
10
-import type {InspectorData, TouchedViewDataAtPoint} from './ReactNativeTypes';
11
-import type {TransitionTypes} from 'react/src/ReactTransitionType';
12
-
13
-// Modules provided by RN:
14
-import {
15
- ReactNativeViewConfigRegistry,
16
- UIManager,
17
- deepFreezeAndThrowOnMutationInDev,
18
- createPublicInstance,
19
- type PublicRootInstance,
20
-} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
21
-
22
-import {create, diff} from './ReactNativeAttributePayload';
23
-import {
24
- precacheFiberNode,
25
- uncacheFiberNode,
26
- updateFiberProps,
27
- getClosestInstanceFromNode,
28
-} from './ReactNativeComponentTree';
29
-import ReactNativeFiberHostComponent from './ReactNativeFiberHostComponent';
30
-
31
-import {
32
- DefaultEventPriority,
33
- NoEventPriority,
34
- type EventPriority,
35
-} from 'react-reconciler/src/ReactEventPriorities';
36
-import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
37
-
38
-import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
39
-
40
-import {REACT_CONTEXT_TYPE} from 'shared/ReactSymbols';
41
-import type {ReactContext} from 'shared/ReactTypes';
42
-
43
-import {
44
- getInspectorDataForViewTag,
45
- getInspectorDataForViewAtPoint,
46
- getInspectorDataForInstance,
47
-} from './ReactNativeFiberInspector';
48
-
49
-export {default as rendererVersion} from 'shared/ReactVersion'; // TODO: Consider exporting the react-native version.
50
-export const rendererPackageName = 'react-native-renderer';
51
-export const extraDevToolsConfig = {
52
- getInspectorDataForInstance,
53
- getInspectorDataForViewTag,
54
- getInspectorDataForViewAtPoint,
55
-};
56
-
57
-const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
58
-
59
-export type Type = string;
60
-export type Props = Object;
61
-export type Container = {
62
- containerTag: number,
63
- publicInstance: PublicRootInstance | null,
64
-};
65
-export type Instance = ReactNativeFiberHostComponent;
66
-export type TextInstance = number;
67
-export type HydratableInstance = Instance | TextInstance;
68
-export type PublicInstance = Instance;
69
-export type HostContext = $ReadOnly<{
70
- isInAParentText: boolean,
71
-}>;
72
-export type UpdatePayload = Object; // Unused
73
-export type ChildSet = void; // Unused
74
-
75
-export type TimeoutHandle = TimeoutID;
76
-export type NoTimeout = -1;
77
-export type TransitionStatus = mixed;
78
-
79
-export type RendererInspectionConfig = $ReadOnly<{
80
- getInspectorDataForInstance?: (instance: Fiber | null) => InspectorData,
81
- // Deprecated. Replaced with getInspectorDataForViewAtPoint.
82
- getInspectorDataForViewTag?: (tag: number) => Object,
83
- getInspectorDataForViewAtPoint?: (
84
- inspectedView: Object,
85
- locationX: number,
86
- locationY: number,
87
- callback: (viewData: TouchedViewDataAtPoint) => mixed,
88
- ) => void,
89
-}>;
90
-
91
-// Counter for uniquely identifying views.
92
-// % 10 === 1 means it is a rootTag.
93
-// % 2 === 0 means it is a Fabric tag.
94
-let nextReactTag = 3;
95
-function allocateTag() {
96
- let tag = nextReactTag;
97
- if (tag % 10 === 1) {
98
- tag += 2;
99
- }
100
- nextReactTag = tag + 2;
101
- return tag;
102
-}
103
-
104
-function recursivelyUncacheFiberNode(node: Instance | TextInstance) {
105
- if (typeof node === 'number') {
106
- // Leaf node (eg text)
107
- uncacheFiberNode(node);
108
- } else {
109
- uncacheFiberNode((node: any)._nativeTag);
110
-
111
- (node: any)._children.forEach(recursivelyUncacheFiberNode);
112
- }
113
-}
114
-
115
-export * from 'react-reconciler/src/ReactFiberConfigWithNoPersistence';
116
-export * from 'react-reconciler/src/ReactFiberConfigWithNoHydration';
117
-export * from 'react-reconciler/src/ReactFiberConfigWithNoScopes';
118
-export * from 'react-reconciler/src/ReactFiberConfigWithNoTestSelectors';
119
-export * from 'react-reconciler/src/ReactFiberConfigWithNoMicrotasks';
120
-export * from 'react-reconciler/src/ReactFiberConfigWithNoResources';
121
-export * from 'react-reconciler/src/ReactFiberConfigWithNoSingletons';
122
-
123
-export function appendInitialChild(
124
- parentInstance: Instance,
125
- child: Instance | TextInstance,
126
-): void {
127
- parentInstance._children.push(child);
128
-}
129
-
130
-export function createInstance(
131
- type: string,
132
- props: Props,
133
- rootContainerInstance: Container,
134
- hostContext: HostContext,
135
- internalInstanceHandle: Object,
136
-): Instance {
137
- const tag = allocateTag();
138
- const viewConfig = getViewConfigForType(type);
139
-
140
- if (__DEV__) {
141
- for (const key in viewConfig.validAttributes) {
142
- if (props.hasOwnProperty(key)) {
143
- deepFreezeAndThrowOnMutationInDev(props[key]);
144
- }
145
- }
146
- }
147
-
148
- const updatePayload = create(props, viewConfig.validAttributes);
149
-
150
- UIManager.createView(
151
- tag, // reactTag
152
- viewConfig.uiViewClassName, // viewName
153
- rootContainerInstance.containerTag, // rootTag
154
- updatePayload, // props
155
- );
156
-
157
- const component = new ReactNativeFiberHostComponent(
158
- tag,
159
- viewConfig,
160
- internalInstanceHandle,
161
- );
162
-
163
- precacheFiberNode(internalInstanceHandle, tag);
164
- updateFiberProps(tag, props);
165
-
166
- // Not sure how to avoid this cast. Flow is okay if the component is defined
167
- // in the same file but if it's external it can't see the types.
168
- return ((component: any): Instance);
169
-}
170
-
171
-export function cloneMutableInstance(
172
- instance: Instance,
173
- keepChildren: boolean,
174
-): Instance {
175
- throw new Error('Not yet implemented.');
176
-}
177
-
178
-export function createTextInstance(
179
- text: string,
180
- rootContainerInstance: Container,
181
- hostContext: HostContext,
182
- internalInstanceHandle: Object,
183
-): TextInstance {
184
- if (!hostContext.isInAParentText) {
185
- throw new Error('Text strings must be rendered within a <Text> component.');
186
- }
187
-
188
- const tag = allocateTag();
189
-
190
- UIManager.createView(
191
- tag, // reactTag
192
- 'RCTRawText', // viewName
193
- rootContainerInstance.containerTag, // rootTag
194
- {text: text}, // props
195
- );
196
-
197
- precacheFiberNode(internalInstanceHandle, tag);
198
-
199
- return tag;
200
-}
201
-
202
-export function cloneMutableTextInstance(
203
- textInstance: TextInstance,
204
-): TextInstance {
205
- throw new Error('Not yet implemented.');
206
-}
207
-
208
-export type FragmentInstanceType = null;
209
-
210
-export function createFragmentInstance(
211
- fragmentFiber: Fiber,
212
-): FragmentInstanceType {
213
- return null;
214
-}
215
-
216
-export function updateFragmentInstanceFiber(
217
- fragmentFiber: Fiber,
218
- instance: FragmentInstanceType,
219
-): void {
220
- // Noop
221
-}
222
-
223
-export function commitNewChildToFragmentInstance(
224
- child: PublicInstance,
225
- fragmentInstance: FragmentInstanceType,
226
-): void {
227
- // Noop
228
-}
229
-
230
-export function deleteChildFromFragmentInstance(
231
- child: PublicInstance,
232
- fragmentInstance: FragmentInstanceType,
233
-): void {
234
- // Noop
235
-}
236
-
237
-export function finalizeInitialChildren(
238
- parentInstance: Instance,
239
- type: string,
240
- props: Props,
241
- hostContext: HostContext,
242
-): boolean {
243
- // Don't send a no-op message over the bridge.
244
- if (parentInstance._children.length === 0) {
245
- return false;
246
- }
247
-
248
- // Map from child objects to native tags.
249
- // Either way we need to pass a copy of the Array to prevent it from being frozen.
250
- const nativeTags = parentInstance._children.map(child =>
251
- typeof child === 'number'
252
- ? child // Leaf node (eg text)
253
- : child._nativeTag,
254
- );
255
-
256
- UIManager.setChildren(
257
- parentInstance._nativeTag, // containerTag
258
- nativeTags, // reactTags
259
- );
260
-
261
- return false;
262
-}
263
-
264
-export function getRootHostContext(
265
- rootContainerInstance: Container,
266
-): HostContext {
267
- return {isInAParentText: false};
268
-}
269
-
270
-export function getChildHostContext(
271
- parentHostContext: HostContext,
272
- type: string,
273
-): HostContext {
274
- const prevIsInAParentText = parentHostContext.isInAParentText;
275
- const isInAParentText =
276
- type === 'AndroidTextInput' || // Android
277
- type === 'RCTMultilineTextInputView' || // iOS
278
- type === 'RCTSelectableText' ||
279
- type === 'RCTSinglelineTextInputView' || // iOS
280
- type === 'RCTText' ||
281
- type === 'RCTVirtualText';
282
-
283
- if (prevIsInAParentText !== isInAParentText) {
284
- return {isInAParentText};
285
- } else {
286
- return parentHostContext;
287
- }
288
-}
289
-
290
-export function getPublicInstance(instance: Instance): PublicInstance {
291
- // $FlowExpectedError[prop-missing] For compatibility with Fabric
292
- if (instance.canonical != null) {
293
- if (instance.canonical.publicInstance == null) {
294
- // $FlowExpectedError[incompatible-use]
295
- instance.canonical.publicInstance = createPublicInstance(
296
- // $FlowExpectedError[incompatible-use]
297
- instance.canonical.nativeTag,
298
- // $FlowExpectedError[incompatible-use]
299
- instance.canonical.viewConfig,
300
- // $FlowExpectedError[incompatible-use]
301
- instance.canonical.internalInstanceHandle,
302
- // $FlowExpectedError[incompatible-use]
303
- instance.canonical.publicRootInstance ?? null,
304
- );
305
- // This was only necessary to create the public instance.
306
- // $FlowExpectedError[prop-missing]
307
- instance.canonical.publicRootInstance = null;
308
- }
309
-
310
- // $FlowExpectedError[prop-missing]
311
- // $FlowExpectedError[incompatible-return]
312
- return instance.canonical.publicInstance;
313
- }
314
-
315
- return instance;
316
-}
317
-
318
-export function prepareForCommit(containerInfo: Container): null | Object {
319
- // Noop
320
- return null;
321
-}
322
-
323
-export function resetAfterCommit(containerInfo: Container): void {
324
- // Noop
325
-}
326
-
327
-export const isPrimaryRenderer = true;
328
-export const warnsIfNotActing = true;
329
-
330
-export const scheduleTimeout = setTimeout;
331
-export const cancelTimeout = clearTimeout;
332
-export const noTimeout: -1 = -1;
333
-
334
-export function shouldSetTextContent(type: string, props: Props): boolean {
335
- // TODO (bvaughn) Revisit this decision.
336
- // Always returning false simplifies the createInstance() implementation,
337
- // But creates an additional child Fiber for raw text children.
338
- // No additional native views are created though.
339
- // It's not clear to me which is better so I'm deferring for now.
340
- // More context @ github.com/facebook/react/pull/8560#discussion_r92111303
341
- return false;
342
-}
343
-
344
-let currentUpdatePriority: EventPriority = NoEventPriority;
345
-export function setCurrentUpdatePriority(newPriority: EventPriority): void {
346
- currentUpdatePriority = newPriority;
347
-}
348
-
349
-export function getCurrentUpdatePriority(): EventPriority {
350
- return currentUpdatePriority;
351
-}
352
-
353
-export function resolveUpdatePriority(): EventPriority {
354
- if (currentUpdatePriority !== NoEventPriority) {
355
- return currentUpdatePriority;
356
- }
357
- return DefaultEventPriority;
358
-}
359
-
360
-export function trackSchedulerEvent(): void {}
361
-
362
-export function resolveEventType(): null | string {
363
- return null;
364
-}
365
-
366
-export function resolveEventTimeStamp(): number {
367
- return -1.1;
368
-}
369
-
370
-export function shouldAttemptEagerTransition(): boolean {
371
- return false;
372
-}
373
-
374
-// -------------------
375
-// Mutation
376
-// -------------------
377
-
378
-export const supportsMutation = true;
379
-
380
-export function appendChild(
381
- parentInstance: Instance,
382
- child: Instance | TextInstance,
383
-): void {
384
- const childTag = typeof child === 'number' ? child : child._nativeTag;
385
- const children = parentInstance._children;
386
- const index = children.indexOf(child);
387
-
388
- if (index >= 0) {
389
- children.splice(index, 1);
390
- children.push(child);
391
-
392
- UIManager.manageChildren(
393
- parentInstance._nativeTag, // containerTag
394
- [index], // moveFromIndices
395
- [children.length - 1], // moveToIndices
396
- [], // addChildReactTags
397
- [], // addAtIndices
398
- [], // removeAtIndices
399
- );
400
- } else {
401
- children.push(child);
402
-
403
- UIManager.manageChildren(
404
- parentInstance._nativeTag, // containerTag
405
- [], // moveFromIndices
406
- [], // moveToIndices
407
- [childTag], // addChildReactTags
408
- [children.length - 1], // addAtIndices
409
- [], // removeAtIndices
410
- );
411
- }
412
-}
413
-
414
-export function appendChildToContainer(
415
- parentInstance: Container,
416
- child: Instance | TextInstance,
417
-): void {
418
- const childTag = typeof child === 'number' ? child : child._nativeTag;
419
- UIManager.setChildren(
420
- parentInstance.containerTag, // containerTag
421
- [childTag], // reactTags
422
- );
423
-}
424
-
425
-export function commitTextUpdate(
426
- textInstance: TextInstance,
427
- oldText: string,
428
- newText: string,
429
-): void {
430
- UIManager.updateView(
431
- textInstance, // reactTag
432
- 'RCTRawText', // viewName
433
- {text: newText}, // props
434
- );
435
-}
436
-
437
-export function commitMount(
438
- instance: Instance,
439
- type: string,
440
- newProps: Props,
441
- internalInstanceHandle: Object,
442
-): void {
443
- // Noop
444
-}
445
-
446
-export function commitUpdate(
447
- instance: Instance,
448
- type: string,
449
- oldProps: Props,
450
- newProps: Props,
451
- internalInstanceHandle: Object,
452
-): void {
453
- const viewConfig = instance.viewConfig;
454
-
455
- updateFiberProps(instance._nativeTag, newProps);
456
-
457
- const updatePayload = diff(oldProps, newProps, viewConfig.validAttributes);
458
-
459
- // Avoid the overhead of bridge calls if there's no update.
460
- // This is an expensive no-op for Android, and causes an unnecessary
461
- // view invalidation for certain components (eg RCTTextInput) on iOS.
462
- if (updatePayload != null) {
463
- UIManager.updateView(
464
- instance._nativeTag, // reactTag
465
- viewConfig.uiViewClassName, // viewName
466
- updatePayload, // props
467
- );
468
- }
469
-}
470
-
471
-export function insertBefore(
472
- parentInstance: Instance,
473
- child: Instance | TextInstance,
474
- beforeChild: Instance | TextInstance,
475
-): void {
476
- const children = (parentInstance: any)._children;
477
- const index = children.indexOf(child);
478
-
479
- // Move existing child or add new child?
480
- if (index >= 0) {
481
- children.splice(index, 1);
482
- const beforeChildIndex = children.indexOf(beforeChild);
483
- children.splice(beforeChildIndex, 0, child);
484
-
485
- UIManager.manageChildren(
486
- (parentInstance: any)._nativeTag, // containerID
487
- [index], // moveFromIndices
488
- [beforeChildIndex], // moveToIndices
489
- [], // addChildReactTags
490
- [], // addAtIndices
491
- [], // removeAtIndices
492
- );
493
- } else {
494
- const beforeChildIndex = children.indexOf(beforeChild);
495
- children.splice(beforeChildIndex, 0, child);
496
-
497
- const childTag = typeof child === 'number' ? child : child._nativeTag;
498
-
499
- UIManager.manageChildren(
500
- (parentInstance: any)._nativeTag, // containerID
501
- [], // moveFromIndices
502
- [], // moveToIndices
503
- [childTag], // addChildReactTags
504
- [beforeChildIndex], // addAtIndices
505
- [], // removeAtIndices
506
- );
507
- }
508
-}
509
-
510
-export function insertInContainerBefore(
511
- parentInstance: Container,
512
- child: Instance | TextInstance,
513
- beforeChild: Instance | TextInstance,
514
-): void {
515
- // TODO (bvaughn): Remove this check when...
516
- // We create a wrapper object for the container in ReactNative render()
517
- // Or we refactor to remove wrapper objects entirely.
518
- // For more info on pros/cons see PR #8560 description.
519
- if (typeof parentInstance === 'number') {
520
- throw new Error('Container does not support insertBefore operation');
521
- }
522
-}
523
-
524
-export function removeChild(
525
- parentInstance: Instance,
526
- child: Instance | TextInstance,
527
-): void {
528
- recursivelyUncacheFiberNode(child);
529
- const children = parentInstance._children;
530
- const index = children.indexOf(child);
531
-
532
- children.splice(index, 1);
533
-
534
- UIManager.manageChildren(
535
- parentInstance._nativeTag, // containerID
536
- [], // moveFromIndices
537
- [], // moveToIndices
538
- [], // addChildReactTags
539
- [], // addAtIndices
540
- [index], // removeAtIndices
541
- );
542
-}
543
-
544
-export function removeChildFromContainer(
545
- parentInstance: Container,
546
- child: Instance | TextInstance,
547
-): void {
548
- recursivelyUncacheFiberNode(child);
549
- UIManager.manageChildren(
550
- parentInstance.containerTag, // containerID
551
- [], // moveFromIndices
552
- [], // moveToIndices
553
- [], // addChildReactTags
554
- [], // addAtIndices
555
- [0], // removeAtIndices
556
- );
557
-}
558
-
559
-export function resetTextContent(instance: Instance): void {
560
- // Noop
561
-}
562
-
563
-export function hideInstance(instance: Instance): void {
564
- const viewConfig = instance.viewConfig;
565
- const updatePayload = create(
566
- {style: {display: 'none'}},
567
- viewConfig.validAttributes,
568
- );
569
- UIManager.updateView(
570
- instance._nativeTag,
571
- viewConfig.uiViewClassName,
572
- updatePayload,
573
- );
574
-}
575
-
576
-export function hideTextInstance(textInstance: TextInstance): void {
577
- throw new Error('Not yet implemented.');
578
-}
579
-
580
-export function unhideInstance(instance: Instance, props: Props): void {
581
- const viewConfig = instance.viewConfig;
582
- const updatePayload = diff(
583
- {...props, style: [props.style, {display: 'none'}]},
584
- props,
585
- viewConfig.validAttributes,
586
- );
587
- UIManager.updateView(
588
- instance._nativeTag,
589
- viewConfig.uiViewClassName,
590
- updatePayload,
591
- );
592
-}
593
-
594
-export function applyViewTransitionName(
595
- instance: Instance,
596
- name: string,
597
- className: ?string,
598
-): void {
599
- // Not yet implemented
600
-}
601
-
602
-export function restoreViewTransitionName(
603
- instance: Instance,
604
- props: Props,
605
-): void {
606
- // Not yet implemented
607
-}
608
-
609
-export function cancelViewTransitionName(
610
- instance: Instance,
611
- name: string,
612
- props: Props,
613
-): void {
614
- // Not yet implemented
615
-}
616
-
617
-export function cancelRootViewTransitionName(rootContainer: Container): void {
618
- // Not yet implemented
619
-}
620
-
621
-export function restoreRootViewTransitionName(rootContainer: Container): void {
622
- // Not yet implemented
623
-}
624
-
625
-export function cloneRootViewTransitionContainer(
626
- rootContainer: Container,
627
-): Instance {
628
- throw new Error('Not implemented.');
629
-}
630
-
631
-export function removeRootViewTransitionClone(
632
- rootContainer: Container,
633
- clone: Instance,
634
-): void {
635
- throw new Error('Not implemented.');
636
-}
637
-
638
-export type InstanceMeasurement = null;
639
-
640
-export function measureInstance(instance: Instance): InstanceMeasurement {
641
- // This heuristic is better implemented at the native layer.
642
- return null;
643
-}
644
-
645
-export function measureClonedInstance(instance: Instance): InstanceMeasurement {
646
- return null;
647
-}
648
-
649
-export function wasInstanceInViewport(
650
- measurement: InstanceMeasurement,
651
-): boolean {
652
- return true;
653
-}
654
-
655
-export function hasInstanceChanged(
656
- oldMeasurement: InstanceMeasurement,
657
- newMeasurement: InstanceMeasurement,
658
-): boolean {
659
- return false;
660
-}
661
-
662
-export function hasInstanceAffectedParent(
663
- oldMeasurement: InstanceMeasurement,
664
- newMeasurement: InstanceMeasurement,
665
-): boolean {
666
- return false;
667
-}
668
-
669
-export function startViewTransition(
670
- suspendedState: null | SuspendedState,
671
- rootContainer: Container,
672
- transitionTypes: null | TransitionTypes,
673
- mutationCallback: () => void,
674
- layoutCallback: () => void,
675
- afterMutationCallback: () => void,
676
- spawnedWorkCallback: () => void,
677
- passiveCallback: () => mixed,
678
- errorCallback: mixed => void,
679
- blockedCallback: string => void, // Profiling-only
680
- finishedAnimation: () => void, // Profiling-only
681
-): null | RunningViewTransition {
682
- mutationCallback();
683
- layoutCallback();
684
- // Skip afterMutationCallback(). We don't need it since we're not animating.
685
- spawnedWorkCallback();
686
- if (enableProfilerTimer) {
687
- finishedAnimation();
688
- }
689
- // Skip passiveCallback(). Spawned work will schedule a task.
690
- return null;
691
-}
692
-
693
-export type RunningViewTransition = null;
694
-
695
-export function startGestureTransition(
696
- suspendedState: null | SuspendedState,
697
- rootContainer: Container,
698
- timeline: GestureTimeline,
699
- rangeStart: number,
700
- rangeEnd: number,
701
- transitionTypes: null | TransitionTypes,
702
- mutationCallback: () => void,
703
- animateCallback: () => void,
704
- errorCallback: mixed => void,
705
- finishedAnimation: () => void, // Profiling-only
706
-): null | RunningViewTransition {
707
- mutationCallback();
708
- animateCallback();
709
- if (enableProfilerTimer) {
710
- finishedAnimation();
711
- }
712
- return null;
713
-}
714
-
715
-export function stopViewTransition(transition: RunningViewTransition) {}
716
-
717
-export function addViewTransitionFinishedListener(
718
- transition: RunningViewTransition,
719
- callback: () => void,
720
-) {
721
- callback();
722
-}
723
-
724
-export type ViewTransitionInstance = null | {name: string, ...};
725
-
726
-export function createViewTransitionInstance(
727
- name: string,
728
-): ViewTransitionInstance {
729
- return null;
730
-}
731
-
732
-export type GestureTimeline = null;
733
-
734
-export function getCurrentGestureOffset(provider: GestureTimeline): number {
735
- throw new Error(
736
- 'startGestureTransition is not yet supported in React Native.',
737
- );
738
-}
739
-
740
-export function clearContainer(container: Container): void {
741
- // TODO Implement this for React Native
742
- // UIManager does not expose a "remove all" type method.
743
-}
744
-
745
-export function unhideTextInstance(
746
- textInstance: TextInstance,
747
- text: string,
748
-): void {
749
- throw new Error('Not yet implemented.');
750
-}
751
-
752
-export {getClosestInstanceFromNode as getInstanceFromNode};
753
-
754
-export function beforeActiveInstanceBlur(internalInstanceHandle: Object) {
755
- // noop
756
-}
757
-
758
-export function afterActiveInstanceBlur() {
759
- // noop
760
-}
761
-
762
-export function preparePortalMount(portalInstance: Instance): void {
763
- // noop
764
-}
765
-
766
-export function detachDeletedInstance(node: Instance): void {
767
- // noop
768
-}
769
-
770
-export function requestPostPaintCallback(callback: (time: number) => void) {
771
- // noop
772
-}
773
-
774
-export function maySuspendCommit(type: Type, props: Props): boolean {
775
- return false;
776
-}
777
-
778
-export function maySuspendCommitOnUpdate(
779
- type: Type,
780
- oldProps: Props,
781
- newProps: Props,
782
-): boolean {
783
- return false;
784
-}
785
-
786
-export function maySuspendCommitInSyncRender(
787
- type: Type,
788
- props: Props,
789
-): boolean {
790
- return false;
791
-}
792
-
793
-export function preloadInstance(
794
- instance: Instance,
795
- type: Type,
796
- props: Props,
797
-): boolean {
798
- // Return false to indicate it's already loaded
799
- return true;
800
-}
801
-
802
-export opaque type SuspendedState = null;
803
-
804
-export function startSuspendingCommit(): SuspendedState {
805
- return null;
806
-}
807
-
808
-export function suspendInstance(
809
- state: SuspendedState,
810
- instance: Instance,
811
- type: Type,
812
- props: Props,
813
-): void {}
814
-
815
-export function suspendOnActiveViewTransition(
816
- state: SuspendedState,
817
- container: Container,
818
-): void {}
819
-
820
-export function waitForCommitToBeReady(
821
- state: SuspendedState,
822
- timeoutOffset: number,
823
-): null {
824
- return null;
825
-}
826
-
827
-export function getSuspendedCommitReason(
828
- state: SuspendedState,
829
- rootContainer: Container,
830
-): null | string {
831
- return null;
832
-}
833
-
834
-export const NotPendingTransition: TransitionStatus = null;
835
-export const HostTransitionContext: ReactContext<TransitionStatus> = {
836
- $$typeof: REACT_CONTEXT_TYPE,
837
- Provider: (null: any),
838
- Consumer: (null: any),
839
- _currentValue: NotPendingTransition,
840
- _currentValue2: NotPendingTransition,
841
- _threadCount: 0,
842
-};
843
-
844
-export type FormInstance = Instance;
845
-export function resetFormInstance(form: Instance): void {}