@prosperitainova/dumbo-react-native
Version:
Dumbo for React Native Library
107 lines (105 loc) • 2.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AcceptTerms = void 0;
var _react = _interopRequireDefault(require("react"));
var _BottomToolbar = require("../BottomToolbar");
var _DocumentViewer = require("../DocumentViewer");
var _Modal = require("../Modal");
var _Text = require("../Text");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/** Props for AcceptTerms component */
/**
* AcceptTerms component for showing the accept legal terms flow
*
* {@link https://github.com/carbon-design-system/carbon-react-native/blob/main/example/src/Views/AcceptsTerms.tsx | Example code}
*/
class AcceptTerms extends _react.default.Component {
state = {
showDisagree: false
};
agree = () => {
const {
resultsCallback
} = this.props;
if (typeof resultsCallback === 'function') {
resultsCallback(true);
}
};
disagree = () => {
const {
resultsCallback
} = this.props;
if (typeof resultsCallback === 'function') {
resultsCallback(false);
}
};
disagreeMain = () => {
this.setState({
showDisagree: true
});
};
get disagreeModal() {
const {
textStrings
} = this.props;
const {
showDisagree
} = this.state;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
open: showDisagree,
title: textStrings?.modalTitle || '',
secondaryActionOnPress: this.disagree,
secondaryActionText: textStrings?.modalSecondaryAction || '',
primaryActionOnPress: () => this.setState({
showDisagree: false
}),
primaryActionText: textStrings?.modalPrimaryAction || '',
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
text: textStrings?.modalBody || ''
})
});
}
get footer() {
const {
textStrings
} = this.props;
const items = [{
text: textStrings?.disagree || '',
alignItem: 'left',
onPress: this.disagreeMain
}, {
text: textStrings?.agree || '',
alignItem: 'right',
textType: 'heading-compact-02',
onPress: this.agree
}];
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BottomToolbar.BottomToolbar, {
items: items
});
}
render() {
const {
componentProps,
style,
title,
source,
disableContainerPadding,
forceView
} = this.props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DocumentViewer.DocumentViewer, {
title: title,
source: source,
style: style,
componentProps: componentProps,
disableContainerPadding: disableContainerPadding,
forceView: forceView,
navigationFooter: this.footer,
renderChildComponent: this.disagreeModal
});
}
}
exports.AcceptTerms = AcceptTerms;
//# sourceMappingURL=index.js.map