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AE,gBAAM,CAAC,cAAc,CAAC;oBAG/C,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,gBAAM,CAAC,sBAAsB,CAAC;wBAC1C,8BAAC,2BAAY,kBACX,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,mBAAmB,EAC5C,KAAK,EAAE,gBAAM,CAAC,OAAO,IACjB,IAAI,CAAC,KAAK,CAAC,YAAY,EAC3B,CACG;oBAEP,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,gBAAM,CAAC,sBAAsB,CAAC;wBAC1C,8BAAC,mBAAI,IACH,KAAK,EACD,CAAC,gBAAM,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAGhD,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CACpB;wBACN,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAClC,8BAAC,+BAAgB,IAAC,OAAO,EAAE,IAAI,CAAC,QAAQ;4BACtC,8BAAC,mBAAI,IACH,MAAM,EAAC,YAAY,EACnB,KAAK,EAAE;oCACL,gBAAM,CAAC,WAAW;oCAClB,EAAE,KAAK,EAAE,eAAM,CAAC,YAAY,EAAE;oCAC9B,IAAI,CAAC,KAAK,CAAC,eAAe;iCAC3B,IAEA,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,QAAQ,CAC7B,CACU,CACpB,CAAC,CAAC,CAAC,IAAI,CACH,CACF,CACD,CACH,CACR,CAAC;IACJ,CAAC;CACF;AA3ED,gDA2EC;AAED,kBAAe,kBAAkB,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/source/components/modals/CrossBusyIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport {\n  View,\n  Text,\n  TouchableOpacity,\n  StyleProp,\n  ViewStyle,\n  TextStyle\n} from 'react-native';\nimport { Colors } from '../../styles';\nimport Modal from 'react-native-modal';\nimport {\n  CrossSpinnerType,\n  CrossSpinner,\n  ICrossSpinnerProps,\n} from '../animations/CrossSpinner';\nimport styles from '../../styles';\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   * Optional custom style for the {@link cancelText}\n   */\n  cancelTextStyle?: StyleProp<TextStyle> | undefined;\n  /**\n   * Optional custom style for the modal view\n   */\n  modalStyle?: StyleProp<ViewStyle> | undefined;\n  /**\n   * Optional custom style for the inner view, contained in the modal\n   */\n  innerViewStyle?: StyleProp<ViewStyle> | undefined;\n  /**\n   * Optional custom style for the {@link message}\n   */\n  messageStyle?: StyleProp<TextStyle> | undefined;\n  /**\n   * Optional properties to configure the spinner\n   *\n   * See {@link ICrossSpinnerProps}\n   */\n  spinnerProps?: ICrossSpinnerProps | undefined;\n}\n\n/**\n * @description\n * Displays a modal with busy indicator (spinner) and message when {@link IBusyIndicatorProps.isBusy} is `true`\n *\n * Properties are {@link IBusyIndicatorProps}\n *\n * Also supports cancelling the modal using properties\n * {@link IBusyIndicatorProps.isCancelButtonVisible},\n * {@link IBusyIndicatorProps.cancelText} and\n * {@link IBusyIndicatorProps.onCancel}.\n * This does however not hide the modal.\n *\n * Modal with cancel\n * @example\n *\n ```\n  <CrossBusyIndicator\n          key=\"busy1\"\n          testID=\"busy1\"\n          isBusy={this.state.isBusy}\n          type={CrossSpinnerType.PacmanIndicator}\n          isCancelButtonVisible={true}\n          message=\"Loading..\"\n          onCancel={() => this.setState({ isBusy: false })}\n        />\n```\n* Non cancellable and custom styles\n* @example\n```\n        <CrossBusyIndicator\n          key=\"busy2\"\n          testID=\"busy2\"\n          spinnerProps={{\n            color: 'red',\n            type: CrossSpinnerType.WaveIndicator\n          }}\n          messageStyle={{color: 'red'}}\n          isBusy={this.state.isBusy2}\n          isCancelButtonVisible={false}\n          message=\"Resistance is futile\"\n        />\n```\n */\nexport class CrossBusyIndicator extends React.Component<IBusyIndicatorProps> {\n  constructor(props: IBusyIndicatorProps) {\n    super(props);\n    this.onCancel = this.onCancel.bind(this);\n  }\n\n  onCancel() {\n    if (!this.props.isCancelButtonVisible) {\n      return;\n    }\n\n    if (this.props.onCancel) {\n      this.props.onCancel();\n    }\n  }\n\n  render() {\n    return (\n      <View testID={this.props.testID || '1'}>\n        <Modal\n          style={\n            this.props.modalStyle\n              ? [styles.absoluteCentered, this.props.modalStyle]\n              : styles.absoluteCentered\n          }\n          isVisible={this.props.isBusy}\n          onDismiss={this.onCancel}\n        >\n          <View\n            style={\n              this.props.innerViewStyle\n                ? [\n                    styles.container,\n                    styles.paddingDefault,\n                    this.props.innerViewStyle,\n                  ]\n                : [styles.container, styles.paddingDefault]\n            }\n          >\n            <View style={[styles.columnContentTopCenter]}>\n              <CrossSpinner\n                type={this.props.type || 'MaterialIndicator'}\n                style={styles.spinner}\n                {...this.props.spinnerProps}\n              />\n            </View>\n\n            <View style={[styles.columnContentTopCenter]}>\n              <Text\n                style={\n                    [styles.textSpinner, this.props.messageStyle]\n                }\n              >\n                {this.props.message || ''}\n              </Text>\n              {this.props.isCancelButtonVisible ? (\n                <TouchableOpacity onPress={this.onCancel}>\n                  <Text\n                    testID='cancelText'\n                    style={[\n                      styles.textSpinner,\n                      { color: Colors.CancelButton },\n                      this.props.cancelTextStyle,\n                    ]}\n                  >\n                    {this.props.cancelText || 'Cancel'}\n                  </Text>\n                </TouchableOpacity>\n              ) : null}\n            </View>\n          </View>\n        </Modal>\n      </View>\n    );\n  }\n}\n\nexport default CrossBusyIndicator;\n"],"version":3}