mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
Implement view
This commit is contained in:
@@ -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
@@ -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>;
|
||||
@@ -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} />;
|
||||
};
|
||||
Reference in New Issue
Block a user