react-native-boxes 1.4.53 → 1.4.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Modal.tsx +22 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.53",
3
+ "version": "1.4.55",
4
4
  "description": "A react native library for rapid development of UI using boxes",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/Modal.tsx CHANGED
@@ -641,11 +641,14 @@ export type ConfirmationDialogProps = {
641
641
  noSheet?: boolean,
642
642
  style?: ViewStyle
643
643
  }
644
-
645
644
  export function ConfirmationDialog(props: ConfirmationDialogProps) {
646
645
 
647
- const confirmText = props.confirmText || 'Confirm'
648
- const cancelText = props.cancelText || 'Cancel'
646
+ return <GenericDialog {...props} cancelText={props.cancelText || 'Cancel'} confirmText={props.confirmText || 'Confirm'} />
647
+ }
648
+ export function GenericDialog(props: ConfirmationDialogProps) {
649
+
650
+ const confirmText = props.confirmText
651
+ const cancelText = props.cancelText
649
652
  const theme = useContext(ThemeContext)
650
653
  const Conatiner = props?.noSheet ? VBox : BottomSheet
651
654
  return (
@@ -665,19 +668,24 @@ export function ConfirmationDialog(props: ConfirmationDialogProps) {
665
668
  padding: theme.dimens.space.lg,
666
669
  textAlign: 'center'
667
670
  }}>{props.message}</TextView>}
668
- <ButtonView aria-label={props.title as string} text={confirmText as string} onPress={() => {
669
- props.onDismiss && props.onDismiss()
670
- props.onConfirm && props.onConfirm()
671
- }} />
672
- <TertiaryButtonView
673
- aria-label={props.title as string}
674
- style={{
675
- marginTop: 0
676
- }}
677
- text={cancelText as string} onPress={() => {
671
+ {
672
+ confirmText && <ButtonView aria-label={props.title as string} text={confirmText as string} onPress={() => {
678
673
  props.onDismiss && props.onDismiss()
679
- props.onCancel && props.onCancel()
674
+ props.onConfirm && props.onConfirm()
680
675
  }} />
676
+ }
677
+ {
678
+ cancelText && <TertiaryButtonView
679
+ aria-label={props.title as string}
680
+ style={{
681
+ marginTop: 0
682
+ }}
683
+ text={cancelText as string} onPress={() => {
684
+ props.onDismiss && props.onDismiss()
685
+ props.onCancel && props.onCancel()
686
+ }} />
687
+ }
688
+
681
689
  </VBox>
682
690
 
683
691
  </Conatiner>