react-native-cross-components
Version:
Beautiful React-Native components using RN Paper by Callstack
1 lines • 5.73 kB
Source Map (JSON)
{"file":"/Users/thomas/Source/react-native-core/source/components/modals/CrossBusyIndicator.tsx","mappings":";;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+CAA4D;AAC5D,6DAA4E;AAC5E,uDAA8C;AAC9C,2DAAmD;AAuDnD;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,eAAK,CAAC,SAG7C;IACC;;OAEG;IACH,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE;YACrC,OAAO;SACR;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;SACvB;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,8BAAC,mBAAI,IAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,IACnC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACnB,8BAAC,2BAAM,CAAC,IAAI;YACV,8BAAC,2BAAM;gBACL,8BAAC,0BAAK,IACN,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAC3C,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAClC,SAAS,EAAE,IAAI,CAAC,SAAS;oBAEzB,8BAAC,mBAAI;wBACH,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,gBAAM,CAAC,sBAAsB,CAAC;4BAC1C,8BAAC,2BAAY,IACX,IAAI,EACF,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,+BAAgB,CAAC,iBAAiB,EAEvD,KAAK,EAAE,gBAAM,CAAC,OAAO,GACrB,CACG;wBACP,8BAAC,mBAAI,IAAC,KAAK,EAAE,gBAAM,CAAC,sBAAsB;4BACxC,8BAAC,mBAAI,IAAC,KAAK,EAAE,gBAAM,CAAC,WAAW,IAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CACpB;4BACN,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAClC,8BAAC,+BAAgB,IAAC,OAAO,EAAE,IAAI,CAAC,SAAS;gCACvC,8BAAC,mBAAI,IACH,MAAM,EAAC,YAAY,EACnB,KAAK,EAAE;wCACL,gBAAM,CAAC,WAAW;wCAClB,EAAE,KAAK,EAAE,eAAM,CAAC,YAAY,EAAE;qCAC/B,IAEA,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,QAAQ,CAC7B,CACU,CACpB,CAAC,CAAC,CAAC,IAAI,CACH,CACF,CACD,CACD,CACG,CACf,CAAC,CAAC,CAAC,IAAI,CACH,CACR,CAAC;IACJ,CAAC;CACF;AAtED,gDAsEC;AAED,kBAAe,kBAAkB,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/source/components/modals/CrossBusyIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, TouchableOpacity } from 'react-native';\nimport { CrossSpinnerType, CrossSpinner } from '../animations/CrossSpinner';\nimport styles, { Colors } from '../../styles';\nimport { Portal, Modal } from 'react-native-paper';\n\n/**\n * Describes the props for {@link CrossBusyIndicator}\n *\n * @export\n * @interface IBusyIndicatorProps\n */\nexport interface IBusyIndicatorProps {\n /**\n * Determines if the indicator is visible\n *\n * @type {boolean}\n * @memberof IBusyIndicatorProps\n */\n isBusy: boolean;\n /**\n * Optional message to show while busy. Defaults to empty string.\n *\n * @type {string}\n * @memberof IBusyIndicatorProps\n */\n message?: string | undefined;\n /**\n * Type of spinner to use\n *\n * @type {CrossSpinnerType}\n * @memberof IBusyIndicatorProps\n */\n type?: CrossSpinnerType | undefined;\n /**\n * Optional test id to assign this component. Default is \"1\"\n *\n * @type {string}\n * @memberof IBusyIndicatorProps\n */\n testID?: string | undefined;\n /**\n * Determines if the modal is cancellable. Otherwise visibility is controlled by {@link isBusy}\n */\n isCancelButtonVisible: boolean;\n /**\n * Optional callback for user cancel event.\n */\n onCancel?: () => void;\n /**\n * Text for cancel button. Default is \"Cancel\"\n */\n cancelText?: string | undefined;\n}\n\ninterface IBusyIndicatorState {\n isModalVisible: boolean;\n}\n\n/**\n * Displays a busy indicator (spinner) when {@link IBusyIndicatorProps.isBusy} is `true`\n *\n * Props are {@link IBusyIndicatorProps}\n */\nexport class CrossBusyIndicator extends React.Component<\n IBusyIndicatorProps,\n IBusyIndicatorState\n> {\n /**\n *\n */\n constructor(props: IBusyIndicatorProps) {\n super(props);\n this.state = { isModalVisible: true };\n this.hideModal = this.hideModal.bind(this);\n }\n\n hideModal() {\n if (!this.props.isCancelButtonVisible) {\n return;\n }\n\n this.setState({ isModalVisible: false });\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n }\n\n render() {\n return (\n <View testID={this.props.testID || '1'}>\n {this.props.isBusy ? (\n <Portal.Host>\n <Portal>\n <Modal\n dismissable={this.props.isCancelButtonVisible}\n visible={this.state.isModalVisible}\n onDismiss={this.hideModal}\n >\n <View>\n <View style={[styles.columnContentTopCenter]}>\n <CrossSpinner\n type={\n this.props.type || CrossSpinnerType.MaterialIndicator\n }\n style={styles.spinner}\n />\n </View>\n <View style={styles.columnContentTopCenter}>\n <Text style={styles.textSpinner}>\n {this.props.message || ''}\n </Text>\n {this.props.isCancelButtonVisible ? (\n <TouchableOpacity onPress={this.hideModal}>\n <Text\n testID=\"cancelText\"\n style={[\n styles.textSpinner,\n { color: Colors.CancelButton },\n ]}\n >\n {this.props.cancelText || 'Cancel'}\n </Text>\n </TouchableOpacity>\n ) : null}\n </View>\n </View>\n </Modal>\n </Portal>\n </Portal.Host>\n ) : null}\n </View>\n );\n }\n}\n\nexport default CrossBusyIndicator;\n"],"version":3}