Skip to content

Commit

Permalink
Fix #216 (#218)
Browse files Browse the repository at this point in the history
* Revert "fix: Removed defaultProps to support react 19 (#211)"

This reverts commit 7f3daef.

* fix issue #216 cause app to freeze
  • Loading branch information
bluebill1049 authored Dec 16, 2024
1 parent 08da269 commit 449d739
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/devToolUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const DevToolUI: React.FC<DevtoolUIProps> = ({
background: 'none',
...styles?.button,
}}
type="button"
>
<Logo actions={actions} />
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/formStateTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const FormStateTable = ({
onClick={() => {
setShowFormState(!showFormState);
}}
type="button"
>
<span
style={{
Expand Down
2 changes: 2 additions & 0 deletions src/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const Panel = ({ control, control: { _fields } }: { control: Control }) => {
}}
title="Update values and state the form"
onClick={() => setData({})}
type="button"
>
♺ REFRESH
</Button>
Expand All @@ -162,6 +163,7 @@ const Panel = ({ control, control: { _fields } }: { control: Control }) => {
onClick={() => {
actions.setCollapse(!state.isCollapse);
}}
type="button"
>
{state.isCollapse ? '[-] COLLAPSE' : '[+] EXPAND'}
</Button>
Expand Down
2 changes: 2 additions & 0 deletions src/panelTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const PanelTable = ({
textAlign: 'center',
marginRight: 8,
}}
type="button"
>
{collapse ? '+' : '-'}
</Button>
Expand All @@ -114,6 +115,7 @@ const PanelTable = ({
? {}
: { cursor: 'not-allowed', background: colors.lightBlue }),
}}
type="button"
>
{isNative ? 'Native' : 'Custom'}
</Button>
Expand Down
12 changes: 1 addition & 11 deletions src/styled.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import styled from '@emotion/styled';

import colors from './colors';
Expand All @@ -8,16 +7,7 @@ export const paraGraphDefaultStyle = {
lineHeight: '20px',
};

interface ButtonBaseProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
}

const ButtonBase = ({ type = 'button', ...props }: ButtonBaseProps) => {
return <ButtonBase type={type} {...props} />;
};

const Button = styled(ButtonBase)<{ hideBackground?: boolean }>`
const Button = styled.button<{ hideBackground?: boolean }>`
appearance: none;
margin: 0;
border: 0;
Expand Down

0 comments on commit 449d739

Please sign in to comment.