Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/react-native-renderer/src/ReactFiberConfigFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
// % 2 === 0 means it is a Fabric tag.
// This means that they never overlap.
let nextReactTag = 2;
export function allocateTag(): number {
const tag = nextReactTag;
nextReactTag += 2;
return tag;
}

type InternalInstanceHandle = Object;

Expand Down Expand Up @@ -184,8 +189,7 @@ export function createInstance(
hostContext: HostContext,
internalInstanceHandle: InternalInstanceHandle,
): Instance {
const tag = nextReactTag;
nextReactTag += 2;
const tag = allocateTag();

const viewConfig = getViewConfigForType(type);

Expand Down Expand Up @@ -235,8 +239,7 @@ export function createTextInstance(
}
}

const tag = nextReactTag;
nextReactTag += 2;
const tag = allocateTag();

const node = createNode(
tag, // reactTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ import type {
GestureTimeline,
} from './ReactFiberConfigFabric';

import {allocateTag} from './ReactFiberConfigFabric';

const {
applyViewTransitionName: fabricApplyViewTransitionName,
createViewTransitionInstance: fabricCreateViewTransitionInstance,
startViewTransition: fabricStartViewTransition,
} = nativeFabricUIManager;

Expand Down Expand Up @@ -196,6 +199,8 @@ export function addViewTransitionFinishedListener(
export function createViewTransitionInstance(
name: string,
): ViewTransitionInstance {
const tag = allocateTag();
fabricCreateViewTransitionInstance(name, tag);
return {
name,
old: new (ViewTransitionPseudoElement: any)('old', name),
Expand Down
1 change: 1 addition & 0 deletions scripts/flow/react-native-host-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ declare const nativeFabricUIManager: {
name: string,
className: ?string,
) => void,
createViewTransitionInstance: (name: string, tag: number) => void,
startViewTransition: (mutationCallback: () => void) => {
finished: Promise<void>,
ready: Promise<void>,
Expand Down
Loading