Fix types

This commit is contained in:
Steve Ruiz 2021-08-30 11:49:49 +01:00
parent 64d00dc427
commit b7902f3ce8
3 changed files with 7 additions and 10 deletions

View file

@ -2,21 +2,19 @@ import { useTLContext } from '+hooks'
import * as React from 'react'
import type { TLShapeUtil, TLRenderInfo, TLShape } from '+types'
interface EditingShapeProps<T extends TLShape, M extends Record<string, unknown>>
extends TLRenderInfo {
interface EditingShapeProps<T extends TLShape> extends TLRenderInfo {
shape: T
utils: TLShapeUtil<T>
meta?: M
}
export function EditingTextShape<M extends Record<string, unknown>>({
export function EditingTextShape({
shape,
utils,
isEditing,
isBinding,
isCurrentParent,
meta,
}: EditingShapeProps<TLShape, M>) {
}: EditingShapeProps<TLShape>) {
const {
callbacks: { onTextChange, onTextBlur, onTextFocus, onTextKeyDown, onTextKeyUp },
} = useTLContext()

View file

@ -1,22 +1,20 @@
import * as React from 'react'
import type { TLShapeUtil, TLRenderInfo, TLShape } from '+types'
interface RenderedShapeProps<T extends TLShape, M extends Record<string, unknown>>
extends TLRenderInfo {
interface RenderedShapeProps<T extends TLShape> extends TLRenderInfo {
shape: T
utils: TLShapeUtil<T>
meta?: M
}
export const RenderedShape = React.memo(
function RenderedShape<M extends Record<string, unknown>>({
function RenderedShape({
shape,
utils,
isEditing,
isBinding,
isCurrentParent,
meta,
}: RenderedShapeProps<TLShape, M>) {
}: RenderedShapeProps<TLShape>) {
return utils.render(shape, {
isEditing,
isBinding,

View file

@ -53,6 +53,7 @@ export function TLDraw({ document, currentPageId, onMount, onChange: _onChange }
// Hide indicators when not using the select tool, or when in session
const hideIndicators = !isSelecting || isInSession
// Custom rendering meta, with dark mode for shapes
const meta = React.useMemo(() => ({ isDarkMode }), [isDarkMode])
React.useEffect(() => {