Skip to content

Commit cd169ca

Browse files
committed
docs: add a reference to useWebshell hook
1 parent 1325968 commit cd169ca

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

apps/website/docs/getting-started.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ object of options to their constructor. Sometimes, a feature options object
6565
might not have required fields, and you can skip the constructor argument if
6666
you are OK with the defaults.
6767

68+
:::tip
69+
If you are developing functional components, you
70+
can use the hook variant instead: <APIReference reference="useWebshell" type="function" />
71+
72+
:::
73+
6874
In the bellow snippet,
6975
we are creating a component which augments <WebView /> with the two features
7076
previously mentioned, but of course any number of features could be instantiated!

apps/website/typedoc-sidebars.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = [
3131
"api/interfaces/linkpressoptions",
3232
"api/interfaces/linkpresstarget",
3333
"api/interfaces/minimalwebviewprops",
34+
"api/interfaces/usewebshellparams",
3435
"api/interfaces/visualviewportdimensions",
3536
"api/interfaces/webhandle",
3637
"api/interfaces/webhandlerdefinition",
@@ -82,7 +83,8 @@ module.exports = [
8283
"label": "Functions",
8384
"items": [
8485
"api/functions/makewebshell",
85-
"api/functions/useautoheight"
86+
"api/functions/useautoheight",
87+
"api/functions/usewebshell"
8688
]
8789
}
8890
];

packages/webshell/etc/webshell.api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { ComponentPropsWithoutRef } from 'react';
88
import type { ComponentType } from 'react';
99
import type { ElementRef } from 'react';
1010
import type { ForwardRefExoticComponent } from 'react';
11+
import * as React_2 from 'react';
1112
import type { Ref } from 'react';
1213
import type { RefAttributes } from 'react';
1314

@@ -337,6 +338,18 @@ export type PropsSpecs<N extends string, P> = {
337338
// @public
338339
export function useAutoheight<S extends WebshellProps<MinimalWebViewProps, [ExtractFeatureFromClass<typeof HandleHTMLDimensionsFeature>]>>(params: AutoheightParams<S>): AutoheightState<S>;
339340

341+
// @public
342+
export function useWebshell<C extends ComponentType<any>, F extends Feature<{}, {}, {}>[]>({ features, props: webshellProps, webViewRef }: UseWebshellParams<React_2.ComponentProps<C>, F>): React_2.ComponentProps<C> & {
343+
ref: ElementRef<C>;
344+
};
345+
346+
// @public
347+
export interface UseWebshellParams<W extends MinimalWebViewProps, F extends Feature<{}, {}, {}>[]> {
348+
features: F;
349+
props: WebshellProps<W, F>;
350+
webViewRef?: ElementRef<any>;
351+
}
352+
340353
// @public
341354
export interface VisualViewportDimensions {
342355
isLegacy: boolean;

0 commit comments

Comments
 (0)