Skip to content

Commit 354fe15

Browse files
committed
fix: Add useRef to global LiveProvider context
This update introduces the useRef hook to the global context of the LiveProvider, allowing for better management of references within the example components. The change fix the example - Custom input with popper positioning
1 parent 7f0b64b commit 354fe15

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs-site/src/components/Example/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { forwardRef, useMemo, useState } from "react";
1+
import React, { forwardRef, useMemo, useRef, useState } from "react";
22
import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
33
import DatePicker, {
44
registerLocale,
@@ -164,6 +164,7 @@ export default class CodeExampleComponent extends React.Component<
164164
// NB any globals added here should also be referenced in ../../examples/.eslintrc
165165
useState,
166166
useMemo,
167+
useRef,
167168
DatePicker,
168169
CalendarContainer,
169170
DateFNS,

docs-site/src/examples/live-provider-globals.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { MiddlewareState as MiddlewareStateType } from "@floating-ui/react"
55
declare global {
66
const useMemo: typeof React.useMemo;
77
const useState: typeof React.useState;
8+
const useRef: typeof React.useRef;
89
const DatePicker: any;
910
const CalendarContainer: any;
1011
const range: any;

0 commit comments

Comments
 (0)