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

picker, album fixes. protected level, cache-control header #213

Merged
merged 2 commits into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 11 additions & 4 deletions packages/aws-amplify-react/dist/Storage/S3Album.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ var S3Album = function (_Component) {
var theme = _this.props.theme || _AmplifyTheme2['default'];
_this.state = {
theme: theme,
items: []
items: [],
ts: new Date().getTime()
};

_awsAmplify.Hub.listen('window', _this, 'S3Album');
Expand Down Expand Up @@ -155,6 +156,7 @@ var S3Album = function (_Component) {
onError(err);
}
});
this.setState({ ts: new Date().getTime() });
}

return handlePick;
Expand Down Expand Up @@ -340,8 +342,11 @@ var S3Album = function (_Component) {

var _props4 = this.props,
picker = _props4.picker,
translateItem = _props4.translateItem;
var items = this.state.items;
translateItem = _props4.translateItem,
level = _props4.level;
var _state = this.state,
items = _state.items,
ts = _state.ts;


var pickerTitle = this.props.pickerTitle || 'Pick';
Expand All @@ -357,6 +362,7 @@ var S3Album = function (_Component) {
style: theme.albumText,
selected: item.selected,
translate: translateItem,
level: level,
onClick: function () {
function onClick() {
return _this5.handleClick(item);
Expand All @@ -371,6 +377,7 @@ var S3Album = function (_Component) {
style: theme.albumPhoto,
selected: item.selected,
translate: translateItem,
level: level,
onClick: function () {
function onClick() {
return _this5.handleClick(item);
Expand All @@ -389,7 +396,7 @@ var S3Album = function (_Component) {
list
),
picker ? _react2['default'].createElement(_Widget.Picker, {
key: 'picker',
key: ts,
title: pickerTitle,
accept: 'image/*, text/*',
onPick: this.handlePick,
Expand Down
4 changes: 4 additions & 0 deletions packages/aws-amplify-react/dist/Widget/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ var Picker = function (_Component) {
var that = this;

var file = e.target.files[0];
if (!file) {
return;
}

var name = file.name,
size = file.size,
type = file.type;
Expand Down
12 changes: 8 additions & 4 deletions packages/aws-amplify-react/src/Storage/S3Album.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export default class S3Album extends Component {
const theme = this.props.theme || AmplifyTheme;
this.state = {
theme: theme,
items: []
items: [],
ts: new Date().getTime()
};

Hub.listen('window', this, 'S3Album');
Expand Down Expand Up @@ -99,6 +100,7 @@ export default class S3Album extends Component {
logger.debug('handle pick error', err);
if (onError) { onError(err); }
});
this.setState({ ts: new Date().getTime() });
}

handleClick(item) {
Expand Down Expand Up @@ -205,8 +207,8 @@ export default class S3Album extends Component {
}

render() {
const { picker, translateItem } = this.props;
const { items } = this.state;
const { picker, translateItem, level } = this.props;
const { items, ts } = this.state;

const pickerTitle = this.props.pickerTitle || 'Pick';

Expand All @@ -221,6 +223,7 @@ export default class S3Album extends Component {
style={theme.albumText}
selected={item.selected}
translate={translateItem}
level={level}
onClick={() => this.handleClick(item)}
/>
: <S3Image
Expand All @@ -230,6 +233,7 @@ export default class S3Album extends Component {
style={theme.albumPhoto}
selected={item.selected}
translate={translateItem}
level={level}
onClick={() => this.handleClick(item)}
/>
});
Expand All @@ -239,7 +243,7 @@ export default class S3Album extends Component {
{list}
</div>
{ picker? <Picker
key="picker"
key={ts}
title={pickerTitle}
accept="image/*, text/*"
onPick={this.handlePick}
Expand Down
2 changes: 2 additions & 0 deletions packages/aws-amplify-react/src/Widget/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export default class Picker extends Component {
var that = this;

const file = e.target.files[0];
if (!file) { return; }

const { name, size, type } = file;
logger.debug(file);

Expand Down
Loading