Skip to content

Commit c362200

Browse files
committed
fix #55
1 parent 0995937 commit c362200

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-ts-tradingview-widgets",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "This is a React component library for TradingView Widgets. TypeScript is fully supported for every component!",
55
"main": "dist/index.js",
66
"scripts": {

src/components/Widget.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { createRef, useEffect } from "react";
1+
import React, { useEffect, useRef } from "react";
22
import Copyright, { CopyrightProps } from "./Copyright";
33

44
interface WidgetProps {
@@ -18,7 +18,7 @@ const Widget: React.FC<WidgetProps> = ({
1818
type,
1919
copyrightProps,
2020
}) => {
21-
const ref: { current: HTMLDivElement | null } = createRef();
21+
const ref = useRef<HTMLDivElement>(null);
2222

2323
useEffect(() => {
2424
let refValue: HTMLDivElement;
@@ -64,15 +64,21 @@ const Widget: React.FC<WidgetProps> = ({
6464
}, [ref, scriptHTML, type, scriptSRC]);
6565

6666
return (
67-
<>
68-
<div ref={ref} id={containerId} />
67+
<div style={{ display: "contents" }}>
68+
{type === "Widget" || type === "MediumWidget" ? (
69+
<div id={containerId}>
70+
<div ref={ref} style={{ display: "contents" }} />
71+
</div>
72+
) : (
73+
<div ref={ref} style={{ display: "contents" }} />
74+
)}
6975
<Copyright
7076
href={copyrightProps.href}
7177
spanText={copyrightProps.spanText}
7278
text={copyrightProps.text}
7379
copyrightStyles={copyrightProps.copyrightStyles}
7480
/>
75-
</>
81+
</div>
7682
);
7783
};
7884

0 commit comments

Comments
 (0)