Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1878 Background Selector on render update stops search input on mobile #1879

Merged
merged 1 commit into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions web/client/components/background/BackgroundSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ const BackgroundSelector = React.createClass({
this.props.onLayerChange('tempLayer', {});
this.props.onStartChange(0);
},
componentWillUpdate(nextProps) {
if (this.props.size.width !== nextProps.size.width
|| this.props.size.height !== nextProps.size.height) {
this.props.onStartChange(0);
}
},
getThumb(layer) {
return this.props.thumbs[layer.source] && this.props.thumbs[layer.source][layer.name] || layer.thumbURL || this.props.thumbs.unknown;
},
Expand Down
4 changes: 2 additions & 2 deletions web/client/components/background/PreviewList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const PreviewList = React.createClass({
},
render() {
let iconButtons = [].concat(this.props.icons);
iconButtons = iconButtons.slice(this.props.start, this.props.start + this.props.length);
iconButtons = this.props.pagination ? iconButtons.slice(this.props.start, this.props.start + this.props.length) : iconButtons;
if (this.props.pagination) {
if (this.props.start !== 0) {
iconButtons.unshift(<PaginationButton key="pagination_0" vertical={this.props.vertical} side={this.props.vertical ? this.props.width : this.props.height} direction={false} onClick={ () => { this.props.onStartChange(this.props.start - 1); }} />);
}
if (this.props.start + this.props.length !== this.props.icons.length) {
if (this.props.start + this.props.length < this.props.icons.length) {
iconButtons.push(<PaginationButton key="pagination_1" vertical={this.props.vertical} side={this.props.vertical ? this.props.width : this.props.height} direction={true} onClick={ () => { this.props.onStartChange(this.props.start + 1); } } />);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ describe("test the BackgroundSelector", () => {
const node = ReactDOM.findDOMNode(backgroundSelector);
expect(node).toExist();

backgroundSelector.componentWillUpdate({size: {width: 1000, height: 400}, drawerEnabled: false});
backgroundSelector.componentWillUpdate({size: {width: 900, height: 500}, drawerEnabled: false});
backgroundSelector.componentWillUpdate({size: {width: 1000, height: 500}, drawerEnabled: true});
backgroundSelector.componentWillUpdate({size: {width: 1000, height: 500}, drawerEnabled: false});

const icons = backgroundSelector.getIcons(5, 5, 5, false);
expect(icons.length).toBeGreaterThan(0);

Expand Down