(props, state)
| 66 | }; |
| 67 | |
| 68 | const constrain = (props, state) => { |
| 69 | const { length, minSize, type } = props; |
| 70 | let { from, size, itemsPerRow } = state; |
| 71 | size = Math.max(size, minSize); |
| 72 | let mod = size % itemsPerRow; |
| 73 | if (mod) size += itemsPerRow - mod; |
| 74 | if (size > length) size = length; |
| 75 | from = |
| 76 | type === 'simple' || !from ? 0 : Math.max(Math.min(from, length - size), 0); |
| 77 | |
| 78 | if ((mod = from % itemsPerRow)) { |
| 79 | from -= mod; |
| 80 | size += mod; |
| 81 | } |
| 82 | |
| 83 | if (from === state.from && size === state.size) return state; |
| 84 | |
| 85 | return { ...state, from, size }; |
| 86 | }; |
| 87 | |
| 88 | export default class ReactList extends Component { |
| 89 | static displayName = 'ReactList'; |
no outgoing calls
no test coverage detected
searching dependent graphs…