view
Declares the view a module contributes, rendered in JSX:
view: view<SliderProps>({ events: ['change'] }). Natively, view()
returns how to make it and its props by name.
Usage
Declare a custom native slider view.
// Declare a custom native slider view.
import { defineModule, view } from 'kuito';
type SliderProps = {
value: number;
min?: number;
max?: number;
onChange?: (value: number) => void;
};
export default defineModule('Slider', {
view: view<SliderProps>({ events: ['change'] }),
ios: { class: 'KuitoSliderModule' },
android: { class: 'dev.kuito.runtime.modules.slider.KuitoSliderModule' },
});Signatures
<P extends NativeViewSpec<P>, M extends NativeViewMethods<M> = Record<never, never>>(_declaration?: ViewDeclaration): Primitive<NativeViewProps<P, M>>Type parameters
| Name | Constraint | Default |
|---|---|---|
P | NativeViewSpec<P> | — |
M | NativeViewMethods<M> | Record<never, never> |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
_declaration | ViewDeclaration | No | — Default: {} |
Returns
Primitive<NativeViewProps<P, M>>
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.