UNPKG

@react-native-ohos/sample-package

Version:

react native harmony sample package

51 lines 2.36 kB
import React from 'react'; import { ViewProps, HostComponent, ProcessedColorValue } from 'react-native'; import type { Float, DirectEventHandler, BubblingEventHandler, WithDefault, Int32, Double } from 'react-native/Libraries/Types/CodegenTypes'; export interface OutgoingAndIncomingData { intTest: Int32; intWithDefault?: WithDefault<Int32, 42>; floatTest: Float; floatWithDefaultTest?: WithDefault<Float, 42.5>; doubleTest: Double; doubleWithDefaultTest?: WithDefault<Double, 42.5>; stringTest: string; stringWithDefaultTest?: WithDefault<string, 'foobar'>; booleanTest: boolean; booleanWithDefaultTest?: WithDefault<boolean, true>; arrayTest: string[]; stringEnumTest?: WithDefault<'foo' | 'bar', 'foo'>; } export interface OutgoingData extends OutgoingAndIncomingData { readOnlyArrayTest: ReadonlyArray<string>; colorTest: ProcessedColorValue; } export interface IncomingDataCAPI extends OutgoingAndIncomingData { readOnlyArrayTest: string[]; colorTest: string; } export declare type SupportedCommandArgs = { intTest: Int32; floatTest: Float; doubleTest: Double; stringTest: string; booleanTest: boolean; }; export interface GeneratedSampleViewNativeProps extends ViewProps, OutgoingData { onDirectEvent: DirectEventHandler<IncomingDataCAPI>; onBubblingEvent: BubblingEventHandler<IncomingDataCAPI>; onReceivedCommandArgs: DirectEventHandler<SupportedCommandArgs>; } declare type NativeType = HostComponent<GeneratedSampleViewNativeProps>; interface NativeCommands { emitNativeEvent: (viewRef: React.ElementRef<NativeType>, // codegen restriction: viewRef must be the first argument eventType: string) => void; emitCommandArgs: (viewRef: React.ElementRef<NativeType>, intTest: Int32, floatTest: Float, doubleTest: Double, stringTest: string, booleanTest: boolean) => void; } export declare type ArgsOfEmitCommandArgs = Parameters<NativeCommands['emitCommandArgs']> extends [any, ...infer Rest] ? Rest : never; export declare const Commands: NativeCommands; declare const _default: HostComponent<GeneratedSampleViewNativeProps>; /** * codegen restriction: the result of codegenNativeComponent must be a default export */ export default _default; //# sourceMappingURL=CAPINativeComponent.d.ts.map