Implement view

This commit is contained in:
2026-04-10 20:12:34 +02:00
parent fd40915bc9
commit 626380bcc4
14 changed files with 126 additions and 30 deletions
+4 -1
View File
@@ -4,8 +4,11 @@ import type {
HybridViewProps,
} from "react-native-nitro-modules";
import type { OmniViewProps } from "../types/view";
import type { OmniPlayer } from "./omni-player.nitro";
export interface Props extends HybridViewProps, OmniViewProps {}
export interface Props extends HybridViewProps, OmniViewProps {
player: OmniPlayer;
}
export type OmniView = HybridView<
Props,
-10
View File
@@ -1,10 +0,0 @@
import { getHostComponent, type HybridRef, type HybridViewMethods } from "react-native-nitro-modules";
import OmniConfig from "../nitrogen/generated/shared/json/OmniViewConfig.json";
import type { Props } from "./specs/omni-view.nitro";
export const OmniView = getHostComponent<Props, HybridViewMethods>(
"OmniView",
() => OmniConfig,
);
export type OmnViewiRef = HybridRef<Props, HybridViewMethods>;
+19
View File
@@ -0,0 +1,19 @@
import {
getHostComponent,
type HybridViewMethods,
} from "react-native-nitro-modules";
import OmniConfig from "../nitrogen/generated/shared/json/OmniViewConfig.json";
import { usePlayer } from "./provider";
import type { OmniPlayer } from "./specs/omni-player.nitro";
import type { Props } from "./specs/omni-view.nitro";
import type { OmniViewProps } from "./types/view";
const NativeView = getHostComponent<Props, HybridViewMethods>(
"OmniView",
() => OmniConfig,
);
export const OmniView = (props: OmniViewProps) => {
const player = usePlayer() as OmniPlayer;
return <NativeView player={player} {...props} />;
};