Skip to content

Commit

Permalink
pass pipeline item to unity view
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaconC committed Oct 28, 2024
1 parent 7148100 commit 7c1899e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 5 additions & 13 deletions src/entities/unityView/ui/Unity.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import { useEffect, useRef } from 'react';
import { FC, useEffect, useRef } from 'react';

import UnityView from '@azesmway/react-native-unity';

import { UnityProps } from './types';

interface IMessage {
gameObject: string;
methodName: string;
message: string;
}

interface Props {
config: {
config: {
radius: number;
width: number;
height: number;
};
deviceType: 'mobile' | 'tablet';
};
}
const Unity = (config: Props) => {
const Unity: FC<UnityProps> = ({ title, config }) => {
const unityRef = useRef<UnityView>(null);

useEffect(() => {
if (unityRef?.current) {
if (unityRef.current) {
const message: IMessage = {
gameObject: 'gameObject',
methodName: 'methodName',
Expand Down
8 changes: 8 additions & 0 deletions src/entities/unityView/ui/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type UnityConfig = {
file: string | null;
};

export type UnityProps = {
title?: string;
config: UnityConfig;
};
2 changes: 1 addition & 1 deletion src/features/pass-survey/ui/ActivityItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export function ActivityItem({
case 'Unity':
item = (
<Box flex={1}>
<UnityView config={pipelineItem.payload} />
<UnityView config={pipelineItem.payload} title={pipelineItem.id} />
</Box>
);
break;
Expand Down

0 comments on commit 7c1899e

Please sign in to comment.