UNPKG

@prosperitainova/dumbo-react-native

Version:
101 lines (99 loc) 2.54 kB
"use strict"; import React from 'react'; import { BottomToolbar } from '../BottomToolbar'; import { DocumentViewer } from '../DocumentViewer'; import { Modal } from '../Modal'; import { Text } from '../Text'; /** Props for AcceptTerms component */ import { jsx as _jsx } from "react/jsx-runtime"; /** * 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} */ export class AcceptTerms extends React.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__*/_jsx(Modal, { open: showDisagree, title: textStrings?.modalTitle || '', secondaryActionOnPress: this.disagree, secondaryActionText: textStrings?.modalSecondaryAction || '', primaryActionOnPress: () => this.setState({ showDisagree: false }), primaryActionText: textStrings?.modalPrimaryAction || '', children: /*#__PURE__*/_jsx(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__*/_jsx(BottomToolbar, { items: items }); } render() { const { componentProps, style, title, source, disableContainerPadding, forceView } = this.props; return /*#__PURE__*/_jsx(DocumentViewer, { title: title, source: source, style: style, componentProps: componentProps, disableContainerPadding: disableContainerPadding, forceView: forceView, navigationFooter: this.footer, renderChildComponent: this.disagreeModal }); } } //# sourceMappingURL=index.js.map