react-native-screens
Version:
Native navigation primitives for your React Native app.
38 lines (31 loc) • 819 B
text/typescript
;
import type { ComponentRef } from 'react';
import type { View } from 'react-native';
/* eslint-disable */
type LocalGlobal = typeof global & Record<string, unknown>;
export function isFabric() {
return !!(global as LocalGlobal).RN$Bridgeless;
}
export type HostInstance = {
__internalInstanceHandle: Record<string, any>;
__nativeTag: number;
_viewConfig: Record<string, unknown>;
};
export function getShadowNodeWrapperAndTagFromRef(
ref: ComponentRef<typeof View> | null,
): {
shadowNodeWrapper: any;
tag: number;
} {
if (!ref) {
return {
shadowNodeWrapper: null,
tag: -1,
};
}
const internalRef = ref as unknown as HostInstance;
return {
shadowNodeWrapper: internalRef.__internalInstanceHandle.stateNode.node,
tag: internalRef.__nativeTag,
};
}