UNPKG

@npm_fluentco/adflow-react-native-sdk

Version:
40 lines (33 loc) 1.45 kB
// src/WebviewFabricViewNativeComponent.ts import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type { HostComponent, ViewProps } from 'react-native'; import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes'; import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes'; // ---------- Native Props ---------- export interface NativeProps extends ViewProps { // Pass internal viewId in every event viewId: string; onAdShow?: DirectEventHandler<{ shown: boolean; viewId: string }>; onInternalAdLaunched?: DirectEventHandler<{ launched: boolean; viewId: string }>; onHeightChanged?: DirectEventHandler<{ height: Int32; viewId: string }>; onError?: DirectEventHandler<{ message: string; viewId: string; }>; // Other optional props isScrollingEnabled?: boolean; wrapperName?: string; wrapperVersion?: string; } // ---------- Native Commands ---------- interface NativeCommands { setParams: ( viewRef: React.ElementRef<HostComponent<NativeProps>>, paramsJson: string ) => void; } export const Commands = codegenNativeCommands<NativeCommands>({ supportedCommands: ['setParams'], }); // ---------- Export Native Component ---------- export default codegenNativeComponent<NativeProps>( 'WebviewFabricView' ) as HostComponent<NativeProps>;