Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52888c5

Browse files
committed
fix: remove null from useHtmlTableProps return signature (dead condition)
1 parent 436a2ac commit 52888c5

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

packages/table-plugin/docs/table-plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
| Function | Description |
1010
| --- | --- |
1111
| [cssRulesFromSpecs(specs)](./table-plugin.cssrulesfromspecs.md) | Create css rules from a specification object. |
12-
| [useHtmlTableProps({ key, style, tnode }, tableConfig)](./table-plugin.usehtmltableprops.md) | Extract props for the HTMLTable component from renderer function arguments. This function is especially usefull for custom table renderers. |
12+
| [useHtmlTableProps({ style, tnode }, tableConfig)](./table-plugin.usehtmltableprops.md) | Extract props for the HTMLTable component from renderer function arguments. This function is especially usefull for custom table renderers. |
1313

1414
## Interfaces
1515

packages/table-plugin/docs/table-plugin.usehtmltableprops.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ Extract props for the HTMLTable component from renderer function arguments. This
99
<b>Signature:</b>
1010

1111
```typescript
12-
export default function useHtmlTableProps({ key, style, tnode }: CustomRendererProps<TBlock>, tableConfig?: TableConfig): (HTMLTableProps & {
13-
key?: string | number;
14-
}) | null;
12+
export default function useHtmlTableProps({ style, tnode }: CustomRendererProps<TBlock>, tableConfig?: TableConfig): HTMLTableProps;
1513
```
1614

1715
## Parameters
1816

1917
| Parameter | Type | Description |
2018
| --- | --- | --- |
21-
| { key, style, tnode } | CustomRendererProps&lt;TBlock&gt; | |
19+
| { style, tnode } | CustomRendererProps&lt;TBlock&gt; | |
2220
| tableConfig | [TableConfig](./table-plugin.tableconfig.md) | Override config options. |
2321

2422
<b>Returns:</b>
2523

26-
([HTMLTableProps](./table-plugin.htmltableprops.md) &amp; { key?: string \| number; }) \| null
24+
[HTMLTableProps](./table-plugin.htmltableprops.md)
2725

packages/table-plugin/etc/table-plugin.api.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ export interface TableStyleSpecs {
110110
}
111111

112112
// @public
113-
export function useHtmlTableProps({ key, style, tnode }: CustomRendererProps<TBlock>, tableConfig?: TableConfig): (HTMLTableProps & {
114-
key?: string | number;
115-
}) | null;
113+
export function useHtmlTableProps({ style, tnode }: CustomRendererProps<TBlock>, tableConfig?: TableConfig): HTMLTableProps;
116114

117115

118116
// (No @packageDocumentation comment for this package)

packages/table-plugin/src/useHtmlTableProps.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type { TBlock } from '@native-html/transient-render-engine';
2222
export default function useHtmlTableProps(
2323
{ style, tnode }: CustomRendererProps<TBlock>,
2424
tableConfig?: TableConfig
25-
): HTMLTableProps | null {
25+
): HTMLTableProps {
2626
const { WebView, defaultWebViewProps, computeEmbeddedMaxWidth } =
2727
useSharedProps();
2828
const contentWidth = useContentWidth();
@@ -56,20 +56,13 @@ export default function useHtmlTableProps(
5656
: null
5757
];
5858

59-
if (__DEV__ && !WebView) {
60-
console.warn(
61-
"@native-html/table-plugin: You must pass a WebView component from react-native-webview as a prop to the HTML component. The table won't be rendered."
62-
);
63-
}
64-
return WebView
65-
? {
66-
...resolvedConfig,
67-
...stats,
68-
html,
69-
sourceBaseUrl: documentBaseUrl,
70-
style: composedStyles,
71-
onLinkPress,
72-
WebView
73-
}
74-
: null;
59+
return {
60+
...resolvedConfig,
61+
...stats,
62+
html,
63+
sourceBaseUrl: documentBaseUrl,
64+
style: composedStyles,
65+
onLinkPress,
66+
WebView
67+
};
7568
}

0 commit comments

Comments
 (0)