handle drag n drop

This commit is contained in:
2026-03-02 09:09:00 +01:00
parent f3b645ac53
commit 22067c4904
8 changed files with 195 additions and 96 deletions

View File

@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
import type { FlutterEvent, FlutterTimelineState } from "@/lib/flutter-bridge";
declare global {
interface Window {
@@ -28,8 +29,8 @@ declare global {
}
type FlutterViewProps = {
state: Record<string, unknown>;
onEvent: (event: { type: string; payload?: Record<string, unknown> }) => void;
state: FlutterTimelineState;
onEvent: (event: FlutterEvent) => void;
className?: string;
height?: number;
};
@@ -60,10 +61,7 @@ export function FlutterView({
window.__zendegi__ = {
getState: () => JSON.stringify(stateRef.current),
onEvent: (json: string) => {
const event = JSON.parse(json) as {
type: string;
payload?: Record<string, unknown>;
};
const event = JSON.parse(json) as FlutterEvent;
onEventRef.current(event);
},
};