K
K
kentos2018-09-18 14:48:38
React
kentos, 2018-09-18 14:48:38

How to scroll on a list?

How to scroll on a list?

import React, { Component } from 'react'
import { Form, FormGroup, Label, Input, ListGroup, ListGroupItem } from 'reactstrap'
import './Search.css'

class Search extends Component {
  render() {
    const { onToggleOpen, onInputChanged, places } = this.props;

    this.renderPlaces = place => {
      return (<ListGroupItem className={ 'nav-option hover-option' } cursor={ 'pointer' } key={ place.id } onClick={ () => onToggleOpen(place.id, true) }>{ place.commonName }</ListGroupItem>)
    }

    this.onChange = event => {
      onInputChanged(event.target.value.trim())
    }

    return (
      <div>
        <br/>
        <Label>Выберите место или выберите из предложенных.</Label>
        <Input onChange = { this.onChange.bind(this) }/>
// Выводится список
        <ListGroup>
          { places.slice().map(this.renderPlaces) }
        </ListGroup>
    </div>
    );
  }
}

export default Search;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-09-18
@rockon404

react-window
react-virtualized
If the list size is not expected to be large and performance optimization is not needed, then any custom scroll will suffice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question