@@ -12,8 +12,8 @@ import type {
1212 TouchedViewDataAtPoint ,
1313 ViewConfig ,
1414} from './ReactNativeTypes' ;
15- import type { TransitionTypes } from 'react/src/ReactTransitionType' ;
1615import { dispatchEvent } from './ReactFabricEventEmitter' ;
16+ import {
1717import {
1818 NoEventPriority ,
1919 DefaultEventPriority ,
@@ -58,11 +58,6 @@ const {
5858 unstable_ContinuousEventPriority : FabricContinuousPriority ,
5959 unstable_IdleEventPriority : FabricIdlePriority ,
6060 unstable_getCurrentEventPriority : fabricGetCurrentEventPriority ,
61- measureInstance : fabricMeasureInstance ,
62- applyViewTransitionName : fabricApplyViewTransitionName ,
63- startViewTransition : fabricStartViewTransition ,
64- restoreViewTransitionName : fabricRestoreViewTransitionName ,
65- cancelViewTransitionName : fabricCancelViewTransitionName ,
6661} = nativeFabricUIManager ;
6762
6863import { getClosestInstanceFromNode } from './ReactFabricComponentTree' ;
@@ -163,14 +158,17 @@ if (registerEventHandler) {
163158 registerEventHandler ( dispatchEvent ) ;
164159}
165160
161+ export * from 'react-reconciler/src/ReactFiberConfigWithNoMutation' ;
166162export * from 'react-reconciler/src/ReactFiberConfigWithNoHydration' ;
167163export * from 'react-reconciler/src/ReactFiberConfigWithNoScopes' ;
168164export * from 'react-reconciler/src/ReactFiberConfigWithNoTestSelectors' ;
169165export * from 'react-reconciler/src/ReactFiberConfigWithNoResources' ;
170166export * from 'react-reconciler/src/ReactFiberConfigWithNoSingletons' ;
167+ export * from './ReactFiberConfigFabricWithViewTransition' ;
171168
172169// -------------------
173- // ViewTransition
170+ // Mutation
171+ // (not supported)
174172// -------------------
175173
176174function shim ( ...args : any ) : empty {
@@ -208,228 +206,6 @@ export const unhideInstance = shim;
208206export const unhideTextInstance = shim ;
209207export const clearContainer = shim ;
210208
211- export type InstanceMeasurement = {
212- rect : { x : number , y : number , width : number , height : number } ,
213- abs : boolean ,
214- clip : boolean ,
215- view : boolean ,
216- } ;
217-
218- export type RunningViewTransition = {
219- skipTransition ( ) : void ,
220- finished : Promise < void > ,
221- ready : Promise < void > ,
222- ...
223- } ;
224-
225- export type ViewTransitionInstance = null | {
226- name : string ,
227- ...
228- } ;
229-
230- export type GestureTimeline = any ;
231-
232- export function restoreViewTransitionName (
233- instance : Instance ,
234- props : Props ,
235- ) : void {
236- fabricRestoreViewTransitionName ( instance . node ) ;
237- }
238-
239- // Cancel the old and new snapshots of viewTransitionName
240- export function cancelViewTransitionName (
241- instance : Instance ,
242- oldName : string ,
243- props : Props ,
244- ) : void {
245- fabricCancelViewTransitionName ( instance . node , oldName ) ;
246- }
247-
248- export function cancelRootViewTransitionName ( rootContainer : Container ) : void {
249- if ( __DEV__ ) {
250- console . warn ( 'cancelRootViewTransitionName is not implemented' ) ;
251- }
252- }
253-
254- export function restoreRootViewTransitionName ( rootContainer : Container ) : void {
255- if ( __DEV__ ) {
256- console . warn ( 'restoreRootViewTransitionName is not implemented' ) ;
257- }
258- }
259-
260- export function cloneRootViewTransitionContainer (
261- rootContainer : Container ,
262- ) : Instance {
263- if ( __DEV__ ) {
264- console . warn ( 'cloneRootViewTransitionContainer is not implemented' ) ;
265- }
266- // $FlowFixMe[incompatible-return] Return empty stub
267- return null ;
268- }
269-
270- export function removeRootViewTransitionClone (
271- rootContainer : Container ,
272- clone : Instance ,
273- ) : void {
274- if ( __DEV__ ) {
275- console . warn ( 'removeRootViewTransitionClone is not implemented' ) ;
276- }
277- }
278-
279- export function measureInstance ( instance : Instance ) : InstanceMeasurement {
280- const measurement = fabricMeasureInstance ( instance . node ) ;
281- return {
282- rect : {
283- x : measurement . x ,
284- y : measurement . y ,
285- width : measurement . width ,
286- height : measurement . height ,
287- } ,
288- abs : false ,
289- clip : false ,
290- view : true ,
291- } ;
292- }
293-
294- export function measureClonedInstance ( instance : Instance ) : InstanceMeasurement {
295- if ( __DEV__ ) {
296- console . warn ( 'measureClonedInstance is not implemented' ) ;
297- }
298- return {
299- rect : { x : 0 , y : 0 , width : 0 , height : 0 } ,
300- abs : false ,
301- clip : false ,
302- view : true ,
303- } ;
304- }
305-
306- export function wasInstanceInViewport (
307- measurement : InstanceMeasurement ,
308- ) : boolean {
309- return measurement . view ;
310- }
311-
312- export function hasInstanceChanged (
313- oldMeasurement : InstanceMeasurement ,
314- newMeasurement : InstanceMeasurement ,
315- ) : boolean {
316- if ( __DEV__ ) {
317- console . warn ( 'hasInstanceChanged is not implemented' ) ;
318- }
319- return false ;
320- }
321-
322- export function hasInstanceAffectedParent (
323- oldMeasurement : InstanceMeasurement ,
324- newMeasurement : InstanceMeasurement ,
325- ) : boolean {
326- if ( __DEV__ ) {
327- console . warn ( 'hasInstanceAffectedParent is not implemented' ) ;
328- }
329- return false ;
330- }
331-
332- export function startGestureTransition (
333- suspendedState : null | SuspendedState ,
334- rootContainer : Container ,
335- timeline : GestureTimeline ,
336- rangeStart : number ,
337- rangeEnd : number ,
338- transitionTypes : null | TransitionTypes ,
339- mutationCallback : ( ) = > void ,
340- animateCallback : ( ) = > void ,
341- errorCallback : ( error : mixed ) = > void ,
342- finishedAnimation : ( ) = > void ,
343- ) : RunningViewTransition {
344- if ( __DEV__ ) {
345- console . warn ( 'startGestureTransition is not implemented' ) ;
346- }
347- return null ;
348- }
349-
350- export function stopViewTransition ( transition : RunningViewTransition ) : void {
351- if ( __DEV__ ) {
352- console . warn ( 'stopViewTransition is not implemented' ) ;
353- }
354- }
355-
356- export function addViewTransitionFinishedListener (
357- transition : RunningViewTransition ,
358- callback : ( ) = > void ,
359- ) : void {
360- callback ( ) ;
361- }
362-
363- export function createViewTransitionInstance (
364- name : string ,
365- ) : ViewTransitionInstance {
366- return { name} ;
367- }
368-
369- export function getCurrentGestureOffset ( timeline : GestureTimeline ) : number {
370- if ( __DEV__ ) {
371- console . warn ( 'getCurrentGestureOffset is not implemented' ) ;
372- }
373- return 0 ;
374- }
375-
376- export function applyViewTransitionName (
377- instance : Instance ,
378- name : string ,
379- className : ?string ,
380- ) : void {
381- // add view-transition-name to things that might animate for browser
382- fabricApplyViewTransitionName ( instance . node , name , className ) ;
383- }
384-
385- export function startViewTransition (
386- suspendedState : null | SuspendedState ,
387- rootContainer : Container ,
388- transitionTypes : null | TransitionTypes ,
389- mutationCallback : ( ) => void ,
390- layoutCallback : ( ) => void ,
391- afterMutationCallback : ( ) => void ,
392- spawnedWorkCallback : ( ) => void ,
393- passiveCallback : ( ) => mixed ,
394- errorCallback : ( error : mixed ) => void ,
395- blockedCallback : ( name : string ) => void ,
396- finishedAnimation : ( ) => void ,
397- ) : null | RunningViewTransition {
398- const transition = fabricStartViewTransition (
399- // mutation
400- ( ) => {
401- mutationCallback ( ) ; // completeRoot should run here
402- layoutCallback ( ) ;
403- afterMutationCallback ( ) ;
404- } ,
405- ) ;
406-
407- if ( transition == null ) {
408- if ( __DEV__ ) {
409- console . warn (
410- "startViewTransition didn't kick off transition in Fabric, the ViewTransition ReactNativeFeatureFlag might not be enabled." ,
411- ) ;
412- }
413- // Flush remaining work synchronously.
414- mutationCallback ( ) ;
415- layoutCallback ( ) ;
416- // Skip afterMutationCallback(). We don't need it since we're not animating.
417- spawnedWorkCallback ( ) ;
418- // Skip passiveCallback(). Spawned work will schedule a task.
419- return null ;
420- }
421-
422- transition . ready . then ( ( ) => {
423- spawnedWorkCallback ( ) ;
424- } ) ;
425-
426- transition . finished . finally ( ( ) => {
427- passiveCallback ( ) ;
428- } ) ;
429-
430- return transition ;
431- }
432-
433209export function appendInitialChild (
434210 parentInstance : Instance ,
435211 child : Instance | TextInstance ,
0 commit comments