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

Skip to content

Commit 96c33b5

Browse files
committed
feat(iframe): support [email protected]
1 parent 3fa6d07 commit 96c33b5

8 files changed

+29
-15
lines changed

packages/iframe-plugin/docs/iframe-plugin.htmliframeprops.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface HTMLIframeProps<WebViewProps = any> extends IframeConfig
1818
| Property | Type | Description |
1919
| --- | --- | --- |
2020
| [htmlAttribs](./iframe-plugin.htmliframeprops.htmlattribs.md) | Record&lt;string, string&gt; | Html attributes for this iframe node. |
21-
| [onLinkPress?](./iframe-plugin.htmliframeprops.onlinkpress.md) | RenderersPropsBase\['a'\]\['onPress'\] | <i>(Optional)</i> Handle link press events. |
21+
| [onLinkPress?](./iframe-plugin.htmliframeprops.onlinkpress.md) | RenderersProps\['a'\]\['onPress'\] | <i>(Optional)</i> Handle link press events. |
2222
| [scaleFactor](./iframe-plugin.htmliframeprops.scalefactor.md) | number | When scalesPageToFit is enabled, scales the WebView zoom level to make sure the viewport fits contentWidth. |
2323
| [source](./iframe-plugin.htmliframeprops.source.md) | { uri?: string; html?: string; } | The source for the iframe. |
2424
| [style](./iframe-plugin.htmliframeprops.style.md) | StyleProp&lt;ViewStyle&gt; | Container style. |

packages/iframe-plugin/docs/iframe-plugin.htmliframeprops.onlinkpress.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Handle link press events.
99
<b>Signature:</b>
1010

1111
```typescript
12-
onLinkPress?: RenderersPropsBase['a']['onPress'];
12+
onLinkPress?: RenderersProps['a']['onPress'];
1313
```

packages/iframe-plugin/docs/iframe-plugin.usehtmliframeprops.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ Extract props for the HTMLIframe component from renderer function arguments. Thi
99
<b>Signature:</b>
1010

1111
```typescript
12-
export default function useHtmlIframeProps({ key, style, tnode }: CustomTagRendererProps<TBlock>, iframeConfig?: IframeConfig): HTMLIframeProps | null;
12+
export default function useHtmlIframeProps({ key, style, tnode }: CustomRendererProps<TBlock>, iframeConfig?: IframeConfig): (HTMLIframeProps & {
13+
key?: any;
14+
}) | null;
1315
```
1416

1517
## Parameters
1618

1719
| Parameter | Type | Description |
1820
| --- | --- | --- |
19-
| { key, style, tnode } | CustomTagRendererProps&lt;TBlock&gt; | |
21+
| { key, style, tnode } | CustomRendererProps&lt;TBlock&gt; | |
2022
| iframeConfig | [IframeConfig](./iframe-plugin.iframeconfig.md) | Override config options. |
2123

2224
<b>Returns:</b>
2325

24-
[HTMLIframeProps](./iframe-plugin.htmliframeprops.md) \| null
26+
([HTMLIframeProps](./iframe-plugin.htmliframeprops.md) &amp; { key?: any; }) \| null
2527

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
import { ComponentType } from 'react';
88
import { CustomBlockRenderer } from 'react-native-render-html';
9-
import { CustomTagRendererProps } from 'react-native-render-html';
9+
import { CustomRendererProps } from 'react-native-render-html';
1010
import { HTMLContentModel } from 'react-native-render-html';
1111
import { HTMLElementModel } from '@native-html/transient-render-engine';
1212
import { default as React_2 } from 'react';
13-
import { RenderersPropsBase } from 'react-native-render-html';
13+
import { RenderersProps } from 'react-native-render-html';
1414
import { StyleProp } from 'react-native';
1515
import type { TBlock } from '@native-html/transient-render-engine';
1616
import { ViewStyle } from 'react-native';
@@ -21,7 +21,7 @@ export function HTMLIframe({ WebView, webViewProps: userWebViewProps, source, st
2121
// @public
2222
export interface HTMLIframeProps<WebViewProps = any> extends IframeConfig {
2323
htmlAttribs: Record<string, string>;
24-
onLinkPress?: RenderersPropsBase['a']['onPress'];
24+
onLinkPress?: RenderersProps['a']['onPress'];
2525
scaleFactor: number;
2626
source: {
2727
uri?: string;
@@ -49,7 +49,9 @@ const IframeRenderer: CustomBlockRenderer;
4949
export default IframeRenderer;
5050

5151
// @public
52-
export function useHtmlIframeProps({ key, style, tnode }: CustomTagRendererProps<TBlock>, iframeConfig?: IframeConfig): HTMLIframeProps | null;
52+
export function useHtmlIframeProps({ key, style, tnode }: CustomRendererProps<TBlock>, iframeConfig?: IframeConfig): (HTMLIframeProps & {
53+
key?: any;
54+
}) | null;
5355

5456

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

packages/iframe-plugin/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"peerDependencies": {
7070
"react": ">= 16.8.0",
7171
"react-native": ">= 0.59.0",
72-
"react-native-render-html": ">= 6.0.0-alpha.25 || >= 6.0.0-beta.0 || 6.x"
72+
"react-native-render-html": ">= 6.0.0-beta.0 || 6.x"
7373
},
7474
"author": "Jules Sam. Randolph <[email protected]> (https://github.com/jsamr)",
7575
"homepage": "https://github.com/native-html/plugins/tree/master/packages/iframe-plugin#readme",

packages/iframe-plugin/src/HTMLIframe.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
useWebshell
88
} from '@formidable-webview/webshell';
99
import { StyleProp, ViewStyle } from 'react-native';
10-
import { RenderersPropsBase } from 'react-native-render-html';
10+
import { RenderersProps } from 'react-native-render-html';
1111
import { linkPressTargetToOnDOMLinkPressArgs } from '@native-html/plugins-core';
1212

1313
/**
@@ -78,7 +78,7 @@ export interface HTMLIframeProps<WebViewProps = any> extends IframeConfig {
7878
/**
7979
* Handle link press events.
8080
*/
81-
onLinkPress?: RenderersPropsBase['a']['onPress'];
81+
onLinkPress?: RenderersProps['a']['onPress'];
8282

8383
/**
8484
* Html attributes for this iframe node.

packages/iframe-plugin/src/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
import { IframeConfig } from './HTMLIframe';
12
export { default, iframeModel } from './IframeRenderer';
23
export { default as useHtmlIframeProps } from './useHtmlIframeProps';
34
export { default as HTMLIframe } from './HTMLIframe';
45
export type { HTMLIframeProps, IframeConfig } from './HTMLIframe';
6+
7+
declare module 'react-native-render-html' {
8+
interface RenderersProps {
9+
/**
10+
* Configuration for `@native-html/iframe-plugin` iframe renderer.
11+
*/
12+
iframe?: IframeConfig;
13+
}
14+
}

packages/iframe-plugin/src/useHtmlIframeProps.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Dimensions } from 'react-native';
22
import {
3-
CustomTagRendererProps,
3+
CustomRendererProps,
44
useDocumentMetadata,
55
useSharedProps,
66
useNormalizedUrl,
@@ -29,9 +29,9 @@ const defaultIframeConfig: IframeConfig = {
2929
* @public
3030
*/
3131
export default function useHtmlIframeProps(
32-
{ key, style, tnode }: CustomTagRendererProps<TBlock>,
32+
{ key, style, tnode }: CustomRendererProps<TBlock>,
3333
iframeConfig?: IframeConfig
34-
): HTMLIframeProps | null {
34+
): (HTMLIframeProps & { key?: any }) | null {
3535
const {
3636
WebView,
3737
defaultWebViewProps,

0 commit comments

Comments
 (0)