Skip to content

Commit

Permalink
Migrating from createRef to useRef (#51)
Browse files Browse the repository at this point in the history
* [bug/picker/createRefvsUseRef] useRef

* [bug/picker/createRef] adding build files
  • Loading branch information
MaxwellKendall authored Jul 31, 2020
1 parent ff2af92 commit 4d7ab56
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions components/Picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Created by Kevin Li 8/16/17
*/

import React, { createRef, useState, useEffect } from 'react';
import React, { useRef, useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

Expand All @@ -27,9 +27,6 @@ const propTypes = {
children: PropTypes.node
};

const pickerRef = createRef();
const buttonRef = createRef();

const defaultSort = (a, b, selectedOption) => {
// if no sort fn is provided, sort active element to lowest index
if (a.name === selectedOption) return -1;
Expand All @@ -51,6 +48,8 @@ const Picker = ({
children,
dropdownDirection = 'right'
}) => {
const pickerRef = useRef(null);
const buttonRef = useRef(null);
const [expanded, setExpanded] = useState(false);
const [dimensions, setDimensions] = useState({
top: 0,
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
}</script><link href="main.21eaf7f95f1e00097853.css" rel="stylesheet"><style>#root[hidden],
#docs-root[hidden] {
display: none !important;
}</style></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><pre id="error-message" class="sb-heading"></pre><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><div id="docs-root"></div><script src="runtime~main.aba3732430a22714413b.bundle.js"></script><script src="vendors~main.aba3732430a22714413b.bundle.js"></script><script src="main.aba3732430a22714413b.bundle.js"></script></body></html>
}</style></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><pre id="error-message" class="sb-heading"></pre><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><div id="docs-root"></div><script src="runtime~main.0d34792f748d2b6cd4f9.bundle.js"></script><script src="vendors~main.0d34792f748d2b6cd4f9.bundle.js"></script><script src="main.0d34792f748d2b6cd4f9.bundle.js"></script></body></html>

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/main.0d34792f748d2b6cd4f9.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/main.aba3732430a22714413b.bundle.js.map

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4d7ab56

Please sign in to comment.