@dokuhero/react-native-components
Version:
Sets of React Native components that works with dokuhero/react-native-theme and react-i18next
51 lines • 2.37 kB
JavaScript
import * as tslib_1 from "tslib";
import { withLocaleClass } from '@dokuhero/react-18n-ts-helper';
import { withThemeClass } from '@dokuhero/react-native-theme';
import React from 'react';
import { RefreshControl, ScrollView, Text, View } from 'react-native';
import { Icon } from 'react-native-elements';
import { globalStyles } from '../styles';
var FullScreenMessage = /** @class */ (function (_super) {
tslib_1.__extends(FullScreenMessage, _super);
function FullScreenMessage(props) {
var _this = _super.call(this, props) || this;
_this.state = {
refreshing: false
};
return _this;
}
FullScreenMessage.prototype.render = function () {
var _this = this;
var _a = this.props, t = _a.t, message = _a.message, onRefresh = _a.onRefresh, theme = _a.theme, icon = _a.icon, backgroundColor = _a.backgroundColor, textColor = _a.textColor;
return (<ScrollView contentContainerStyle={[
globalStyles.container,
globalStyles.centerize,
{ backgroundColor: backgroundColor || theme.color.white }
]} refreshControl={onRefresh ? (<RefreshControl refreshing={this.state.refreshing} onRefresh={function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
this.setState({ refreshing: true });
return [4 /*yield*/, onRefresh()];
case 1:
_a.sent();
this.setState({ refreshing: false });
return [2 /*return*/];
}
});
}); }}/>) : (undefined)}>
<View>
<Icon name="ios-cafe-outline" type="ionicon" color={textColor || theme.color.whiteReverse} size={40} {...icon}/>
<Text>{message || t('empty')}</Text>
</View>
</ScrollView>);
};
FullScreenMessage = tslib_1.__decorate([
withLocaleClass('common'),
withThemeClass(),
tslib_1.__metadata("design:paramtypes", [Object])
], FullScreenMessage);
return FullScreenMessage;
}(React.Component));
export { FullScreenMessage };
//# sourceMappingURL=FullScreenMessage.js.map