You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-14 19:02:33 +03:00
improve member name
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -65,7 +65,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
|||||||
autocompleter: Autocompleter;
|
autocompleter: Autocompleter;
|
||||||
queryRequested: string;
|
queryRequested: string;
|
||||||
debounceCompletionsRequest: NodeJS.Timeout;
|
debounceCompletionsRequest: NodeJS.Timeout;
|
||||||
container: React.RefObject<HTMLDivElement>;
|
containerRef: React.RefObject<HTMLDivElement>;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -90,7 +90,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
|||||||
forceComplete: false,
|
forceComplete: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.container = React.createRef();
|
this.containerRef = React.createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -268,12 +268,12 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
|||||||
this._applyNewProps(prevProps.query, prevProps.room);
|
this._applyNewProps(prevProps.query, prevProps.room);
|
||||||
// this is the selected completion, so scroll it into view if needed
|
// this is the selected completion, so scroll it into view if needed
|
||||||
const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`];
|
const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`];
|
||||||
if (selectedCompletion && this.container.current) {
|
if (selectedCompletion && this.containerRef.current) {
|
||||||
const domNode = ReactDOM.findDOMNode(selectedCompletion);
|
const domNode = ReactDOM.findDOMNode(selectedCompletion);
|
||||||
const offsetTop = domNode && domNode.offsetTop;
|
const offsetTop = domNode && domNode.offsetTop;
|
||||||
if (offsetTop > this.container.current.scrollTop + this.container.current.offsetHeight ||
|
if (offsetTop > this.containerRef.current.scrollTop + this.containerRef.current.offsetHeight ||
|
||||||
offsetTop < this.container.current.scrollTop) {
|
offsetTop < this.containerRef.current.scrollTop) {
|
||||||
this.container.current.scrollTop = offsetTop - this.container.current.offsetTop;
|
this.containerRef.current.scrollTop = offsetTop - this.containerRef.current.offsetTop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
|||||||
}).filter((completion) => !!completion);
|
}).filter((completion) => !!completion);
|
||||||
|
|
||||||
return !this.state.hide && renderedCompletions.length > 0 ? (
|
return !this.state.hide && renderedCompletions.length > 0 ? (
|
||||||
<div className="mx_Autocomplete" ref={this.container}>
|
<div className="mx_Autocomplete" ref={this.containerRef}>
|
||||||
{ renderedCompletions }
|
{ renderedCompletions }
|
||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user