Fix scrolling to inspected element
Summary: When the `Scrollable` component was introduced, this functionality regressed because the `ref` was no longer set on the right component. changelog: Fix scrolling to inspected element in Layout plugin Reviewed By: mweststrate Differential Revision: D21979475 fbshipit-source-id: f84d515cb1593a33d1ae0e93a01681b6e11aa623
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fb0af47c31
commit
d6c97b48d3
@@ -13,7 +13,7 @@ import {BackgroundProperty} from 'csstype';
|
|||||||
|
|
||||||
type Props = {children: React.ReactNode; background?: BackgroundProperty<any>};
|
type Props = {children: React.ReactNode; background?: BackgroundProperty<any>};
|
||||||
|
|
||||||
const Scrollable: React.FC<Props> = styled('div')<Props>(({background}) => ({
|
const Scrollable = styled.div<Props>(({background}) => ({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
|
|||||||
@@ -702,11 +702,8 @@ export class Elements extends PureComponent<ElementsProps, ElementsState> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Scrollable>
|
<Scrollable ref={this._outerRef}>
|
||||||
<ElementsContainer
|
<ElementsContainer onKeyDown={this.onKeyDown} tabIndex={0}>
|
||||||
onKeyDown={this.onKeyDown}
|
|
||||||
tabIndex={0}
|
|
||||||
ref={this._outerRef}>
|
|
||||||
{this.state.flatElements.map(this.buildRow)}
|
{this.state.flatElements.map(this.buildRow)}
|
||||||
</ElementsContainer>
|
</ElementsContainer>
|
||||||
</Scrollable>
|
</Scrollable>
|
||||||
|
|||||||
Reference in New Issue
Block a user