import { requireNativeComponent, UIManager } from 'react-native'; import { LINKING_ERROR } from '../constants/FWErrorMessage'; const NativeComponentName = 'FWStoryBlock'; // Use global cache to avoid duplicate registration declare global { var __FWStoryBlock: any; } if (!global.__FWStoryBlock) { global.__FWStoryBlock = UIManager.getViewManagerConfig(NativeComponentName) != null ? requireNativeComponent(NativeComponentName) : () => { throw new Error(LINKING_ERROR); }; } const FWStoryBlock = global.__FWStoryBlock; export default FWStoryBlock;