react-native-ui-lib 7.46.2-snapshot.7306 → 7.46.2-snapshot.7316
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.
package/package.json
CHANGED
|
@@ -161,6 +161,11 @@
|
|
|
161
161
|
"name": "animateTo",
|
|
162
162
|
"type": "ButtonAnimationDirection",
|
|
163
163
|
"description": "the direction of the animation ('left' and 'right' will effect the button's own alignment)"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "customBackground",
|
|
167
|
+
"type": "React.ReactElement",
|
|
168
|
+
"description": "Custom element to render as button background (takes precedence over backgroundColor)"
|
|
164
169
|
}
|
|
165
170
|
],
|
|
166
171
|
"snippet": [
|
|
@@ -356,6 +356,9 @@ declare class Button extends PureComponent<Props, ButtonState> {
|
|
|
356
356
|
verticalAlign?: "auto" | "top" | "bottom" | "middle" | undefined;
|
|
357
357
|
includeFontPadding?: boolean | undefined;
|
|
358
358
|
};
|
|
359
|
+
backgroundElement: {
|
|
360
|
+
overflow: "hidden";
|
|
361
|
+
};
|
|
359
362
|
};
|
|
360
363
|
componentDidUpdate(prevProps: Props): void;
|
|
361
364
|
onLayout: (event: LayoutChangeEvent) => void;
|
|
@@ -407,6 +410,7 @@ declare class Button extends PureComponent<Props, ButtonState> {
|
|
|
407
410
|
left: number;
|
|
408
411
|
right: number;
|
|
409
412
|
};
|
|
413
|
+
renderCustomBackground(): React.JSX.Element | undefined;
|
|
410
414
|
render(): React.JSX.Element;
|
|
411
415
|
}
|
|
412
416
|
export { Button };
|
|
@@ -440,6 +444,7 @@ declare const _default: React.ForwardRefExoticComponent<((import("../touchableOp
|
|
|
440
444
|
getActiveBackgroundColor?: ((backgroundColor: string, props: any) => string) | undefined;
|
|
441
445
|
animateLayout?: boolean | undefined;
|
|
442
446
|
animateTo?: import("./types").ButtonAnimationDirectionProp | undefined;
|
|
447
|
+
customBackground?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
443
448
|
}) | Omit<import("../touchableOpacity").TouchableOpacityProps & import("../../commons/modifiers").CustomModifier & Partial<Record<"bg-transparent" | "bg-black" | "bg-white" | "bg-dark" | "bg-$backgroundDefault" | "bg-$backgroundElevated" | "bg-$backgroundElevatedLight" | "bg-$backgroundNeutralHeavy" | "bg-$backgroundNeutralIdle" | "bg-$backgroundNeutralMedium" | "bg-$backgroundNeutral" | "bg-$backgroundNeutralLight" | "bg-$backgroundPrimaryHeavy" | "bg-$backgroundPrimaryMedium" | "bg-$backgroundPrimaryLight" | "bg-$backgroundGeneralHeavy" | "bg-$backgroundGeneralMedium" | "bg-$backgroundGeneralLight" | "bg-$backgroundSuccessHeavy" | "bg-$backgroundSuccessLight" | "bg-$backgroundWarningHeavy" | "bg-$backgroundWarningLight" | "bg-$backgroundMajorLight" | "bg-$backgroundMajorHeavy" | "bg-$backgroundDangerHeavy" | "bg-$backgroundDangerLight" | "bg-$backgroundDisabled" | "bg-$backgroundDark" | "bg-$backgroundDarkElevated" | "bg-$backgroundDarkActive" | "bg-$backgroundInverted" | "bg-$textDisabled" | "bg-$textDefault" | "bg-$textNeutralHeavy" | "bg-$textNeutral" | "bg-$textNeutralLight" | "bg-$textDefaultLight" | "bg-$textPrimary" | "bg-$textGeneral" | "bg-$textSuccess" | "bg-$textSuccessLight" | "bg-$textMajor" | "bg-$textDanger" | "bg-$textDangerLight" | "bg-$iconDefault" | "bg-$iconNeutral" | "bg-$iconDefaultLight" | "bg-$iconPrimary" | "bg-$iconPrimaryLight" | "bg-$iconGeneral" | "bg-$iconGeneralLight" | "bg-$iconSuccess" | "bg-$iconSuccessLight" | "bg-$iconMajor" | "bg-$iconDanger" | "bg-$iconDangerLight" | "bg-$iconDisabled" | "bg-$outlineDefault" | "bg-$outlineDisabled" | "bg-$outlineDisabledHeavy" | "bg-$outlineNeutral" | "bg-$outlineNeutralHeavy" | "bg-$outlinePrimary" | "bg-$outlinePrimaryMedium" | "bg-$outlineGeneral" | "bg-$outlineWarning" | "bg-$outlineDanger" | "bg-$outlineInverted" | "bg-$black" | "bg-$white" | "bg-grey1" | "bg-grey5" | "bg-grey10" | "bg-grey20" | "bg-grey30" | "bg-grey40" | "bg-grey50" | "bg-grey60" | "bg-grey70" | "bg-grey80" | "bg-blue1" | "bg-blue5" | "bg-blue10" | "bg-blue20" | "bg-blue30" | "bg-blue40" | "bg-blue50" | "bg-blue60" | "bg-blue70" | "bg-blue80" | "bg-cyan10" | "bg-cyan20" | "bg-cyan30" | "bg-cyan40" | "bg-cyan50" | "bg-cyan60" | "bg-cyan70" | "bg-cyan80" | "bg-green1" | "bg-green5" | "bg-green10" | "bg-green20" | "bg-green30" | "bg-green40" | "bg-green50" | "bg-green60" | "bg-green70" | "bg-green80" | "bg-yellow1" | "bg-yellow5" | "bg-yellow10" | "bg-yellow20" | "bg-yellow30" | "bg-yellow40" | "bg-yellow50" | "bg-yellow60" | "bg-yellow70" | "bg-yellow80" | "bg-orange1" | "bg-orange5" | "bg-orange10" | "bg-orange20" | "bg-orange30" | "bg-orange40" | "bg-orange50" | "bg-orange60" | "bg-orange70" | "bg-orange80" | "bg-red1" | "bg-red5" | "bg-red10" | "bg-red20" | "bg-red30" | "bg-red40" | "bg-red50" | "bg-red60" | "bg-red70" | "bg-red80" | "bg-purple1" | "bg-purple5" | "bg-purple10" | "bg-purple20" | "bg-purple30" | "bg-purple40" | "bg-purple50" | "bg-purple60" | "bg-purple70" | "bg-purple80" | "bg-violet1" | "bg-violet5" | "bg-violet10" | "bg-violet20" | "bg-violet30" | "bg-violet40" | "bg-violet50" | "bg-violet60" | "bg-violet70" | "bg-violet80", boolean>> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & {
|
|
444
449
|
label?: string | undefined;
|
|
445
450
|
color?: string | undefined;
|
|
@@ -470,6 +475,7 @@ declare const _default: React.ForwardRefExoticComponent<((import("../touchableOp
|
|
|
470
475
|
getActiveBackgroundColor?: ((backgroundColor: string, props: any) => string) | undefined;
|
|
471
476
|
animateLayout?: boolean | undefined;
|
|
472
477
|
animateTo?: import("./types").ButtonAnimationDirectionProp | undefined;
|
|
478
|
+
customBackground?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
473
479
|
}, "ref"> | Omit<import("../touchableOpacity").TouchableOpacityProps & import("../../commons/modifiers").CustomModifier & Partial<Record<"transparent" | "black" | "white" | "dark" | "$backgroundDefault" | "$backgroundElevated" | "$backgroundElevatedLight" | "$backgroundNeutralHeavy" | "$backgroundNeutralIdle" | "$backgroundNeutralMedium" | "$backgroundNeutral" | "$backgroundNeutralLight" | "$backgroundPrimaryHeavy" | "$backgroundPrimaryMedium" | "$backgroundPrimaryLight" | "$backgroundGeneralHeavy" | "$backgroundGeneralMedium" | "$backgroundGeneralLight" | "$backgroundSuccessHeavy" | "$backgroundSuccessLight" | "$backgroundWarningHeavy" | "$backgroundWarningLight" | "$backgroundMajorLight" | "$backgroundMajorHeavy" | "$backgroundDangerHeavy" | "$backgroundDangerLight" | "$backgroundDisabled" | "$backgroundDark" | "$backgroundDarkElevated" | "$backgroundDarkActive" | "$backgroundInverted" | "$textDisabled" | "$textDefault" | "$textNeutralHeavy" | "$textNeutral" | "$textNeutralLight" | "$textDefaultLight" | "$textPrimary" | "$textGeneral" | "$textSuccess" | "$textSuccessLight" | "$textMajor" | "$textDanger" | "$textDangerLight" | "$iconDefault" | "$iconNeutral" | "$iconDefaultLight" | "$iconPrimary" | "$iconPrimaryLight" | "$iconGeneral" | "$iconGeneralLight" | "$iconSuccess" | "$iconSuccessLight" | "$iconMajor" | "$iconDanger" | "$iconDangerLight" | "$iconDisabled" | "$outlineDefault" | "$outlineDisabled" | "$outlineDisabledHeavy" | "$outlineNeutral" | "$outlineNeutralHeavy" | "$outlinePrimary" | "$outlinePrimaryMedium" | "$outlineGeneral" | "$outlineWarning" | "$outlineDanger" | "$outlineInverted" | "$black" | "$white" | "grey1" | "grey5" | "grey10" | "grey20" | "grey30" | "grey40" | "grey50" | "grey60" | "grey70" | "grey80" | "blue1" | "blue5" | "blue10" | "blue20" | "blue30" | "blue40" | "blue50" | "blue60" | "blue70" | "blue80" | "cyan10" | "cyan20" | "cyan30" | "cyan40" | "cyan50" | "cyan60" | "cyan70" | "cyan80" | "green1" | "green5" | "green10" | "green20" | "green30" | "green40" | "green50" | "green60" | "green70" | "green80" | "yellow1" | "yellow5" | "yellow10" | "yellow20" | "yellow30" | "yellow40" | "yellow50" | "yellow60" | "yellow70" | "yellow80" | "orange1" | "orange5" | "orange10" | "orange20" | "orange30" | "orange40" | "orange50" | "orange60" | "orange70" | "orange80" | "red1" | "red5" | "red10" | "red20" | "red30" | "red40" | "red50" | "red60" | "red70" | "red80" | "purple1" | "purple5" | "purple10" | "purple20" | "purple30" | "purple40" | "purple50" | "purple60" | "purple70" | "purple80" | "violet1" | "violet5" | "violet10" | "violet20" | "violet30" | "violet40" | "violet50" | "violet60" | "violet70" | "violet80", boolean>> & Partial<Record<"bg-transparent" | "bg-black" | "bg-white" | "bg-dark" | "bg-$backgroundDefault" | "bg-$backgroundElevated" | "bg-$backgroundElevatedLight" | "bg-$backgroundNeutralHeavy" | "bg-$backgroundNeutralIdle" | "bg-$backgroundNeutralMedium" | "bg-$backgroundNeutral" | "bg-$backgroundNeutralLight" | "bg-$backgroundPrimaryHeavy" | "bg-$backgroundPrimaryMedium" | "bg-$backgroundPrimaryLight" | "bg-$backgroundGeneralHeavy" | "bg-$backgroundGeneralMedium" | "bg-$backgroundGeneralLight" | "bg-$backgroundSuccessHeavy" | "bg-$backgroundSuccessLight" | "bg-$backgroundWarningHeavy" | "bg-$backgroundWarningLight" | "bg-$backgroundMajorLight" | "bg-$backgroundMajorHeavy" | "bg-$backgroundDangerHeavy" | "bg-$backgroundDangerLight" | "bg-$backgroundDisabled" | "bg-$backgroundDark" | "bg-$backgroundDarkElevated" | "bg-$backgroundDarkActive" | "bg-$backgroundInverted" | "bg-$textDisabled" | "bg-$textDefault" | "bg-$textNeutralHeavy" | "bg-$textNeutral" | "bg-$textNeutralLight" | "bg-$textDefaultLight" | "bg-$textPrimary" | "bg-$textGeneral" | "bg-$textSuccess" | "bg-$textSuccessLight" | "bg-$textMajor" | "bg-$textDanger" | "bg-$textDangerLight" | "bg-$iconDefault" | "bg-$iconNeutral" | "bg-$iconDefaultLight" | "bg-$iconPrimary" | "bg-$iconPrimaryLight" | "bg-$iconGeneral" | "bg-$iconGeneralLight" | "bg-$iconSuccess" | "bg-$iconSuccessLight" | "bg-$iconMajor" | "bg-$iconDanger" | "bg-$iconDangerLight" | "bg-$iconDisabled" | "bg-$outlineDefault" | "bg-$outlineDisabled" | "bg-$outlineDisabledHeavy" | "bg-$outlineNeutral" | "bg-$outlineNeutralHeavy" | "bg-$outlinePrimary" | "bg-$outlinePrimaryMedium" | "bg-$outlineGeneral" | "bg-$outlineWarning" | "bg-$outlineDanger" | "bg-$outlineInverted" | "bg-$black" | "bg-$white" | "bg-grey1" | "bg-grey5" | "bg-grey10" | "bg-grey20" | "bg-grey30" | "bg-grey40" | "bg-grey50" | "bg-grey60" | "bg-grey70" | "bg-grey80" | "bg-blue1" | "bg-blue5" | "bg-blue10" | "bg-blue20" | "bg-blue30" | "bg-blue40" | "bg-blue50" | "bg-blue60" | "bg-blue70" | "bg-blue80" | "bg-cyan10" | "bg-cyan20" | "bg-cyan30" | "bg-cyan40" | "bg-cyan50" | "bg-cyan60" | "bg-cyan70" | "bg-cyan80" | "bg-green1" | "bg-green5" | "bg-green10" | "bg-green20" | "bg-green30" | "bg-green40" | "bg-green50" | "bg-green60" | "bg-green70" | "bg-green80" | "bg-yellow1" | "bg-yellow5" | "bg-yellow10" | "bg-yellow20" | "bg-yellow30" | "bg-yellow40" | "bg-yellow50" | "bg-yellow60" | "bg-yellow70" | "bg-yellow80" | "bg-orange1" | "bg-orange5" | "bg-orange10" | "bg-orange20" | "bg-orange30" | "bg-orange40" | "bg-orange50" | "bg-orange60" | "bg-orange70" | "bg-orange80" | "bg-red1" | "bg-red5" | "bg-red10" | "bg-red20" | "bg-red30" | "bg-red40" | "bg-red50" | "bg-red60" | "bg-red70" | "bg-red80" | "bg-purple1" | "bg-purple5" | "bg-purple10" | "bg-purple20" | "bg-purple30" | "bg-purple40" | "bg-purple50" | "bg-purple60" | "bg-purple70" | "bg-purple80" | "bg-violet1" | "bg-violet5" | "bg-violet10" | "bg-violet20" | "bg-violet30" | "bg-violet40" | "bg-violet50" | "bg-violet60" | "bg-violet70" | "bg-violet80", boolean>> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & {
|
|
474
480
|
label?: string | undefined;
|
|
475
481
|
color?: string | undefined;
|
|
@@ -500,6 +506,7 @@ declare const _default: React.ForwardRefExoticComponent<((import("../touchableOp
|
|
|
500
506
|
getActiveBackgroundColor?: ((backgroundColor: string, props: any) => string) | undefined;
|
|
501
507
|
animateLayout?: boolean | undefined;
|
|
502
508
|
animateTo?: import("./types").ButtonAnimationDirectionProp | undefined;
|
|
509
|
+
customBackground?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
503
510
|
}, "ref"> | Omit<import("../touchableOpacity").TouchableOpacityProps & Partial<Record<"text10" | "text20" | "text30" | "text40" | "text50" | "text60" | "text65" | "text70" | "text80" | "text90" | "text100" | "text10T" | "text10L" | "text10R" | "text10M" | "text10BO" | "text10H" | "text10BL" | "text20T" | "text20L" | "text20R" | "text20M" | "text20BO" | "text20H" | "text20BL" | "text30T" | "text30L" | "text30R" | "text30M" | "text30BO" | "text30H" | "text30BL" | "text40T" | "text40L" | "text40R" | "text40M" | "text40BO" | "text40H" | "text40BL" | "text50T" | "text50L" | "text50R" | "text50M" | "text50BO" | "text50H" | "text50BL" | "text60T" | "text60L" | "text60R" | "text60M" | "text60BO" | "text60H" | "text60BL" | "text65T" | "text65L" | "text65R" | "text65M" | "text65BO" | "text65H" | "text65BL" | "text70T" | "text70L" | "text70R" | "text70M" | "text70BO" | "text70H" | "text70BL" | "text80T" | "text80L" | "text80R" | "text80M" | "text80BO" | "text80H" | "text80BL" | "text90T" | "text90L" | "text90R" | "text90M" | "text90BO" | "text90H" | "text90BL" | "text100T" | "text100L" | "text100R" | "text100M" | "text100BO" | "text100H" | "text100BL", boolean>> & import("../../commons/modifiers").CustomModifier & Partial<Record<"bg-transparent" | "bg-black" | "bg-white" | "bg-dark" | "bg-$backgroundDefault" | "bg-$backgroundElevated" | "bg-$backgroundElevatedLight" | "bg-$backgroundNeutralHeavy" | "bg-$backgroundNeutralIdle" | "bg-$backgroundNeutralMedium" | "bg-$backgroundNeutral" | "bg-$backgroundNeutralLight" | "bg-$backgroundPrimaryHeavy" | "bg-$backgroundPrimaryMedium" | "bg-$backgroundPrimaryLight" | "bg-$backgroundGeneralHeavy" | "bg-$backgroundGeneralMedium" | "bg-$backgroundGeneralLight" | "bg-$backgroundSuccessHeavy" | "bg-$backgroundSuccessLight" | "bg-$backgroundWarningHeavy" | "bg-$backgroundWarningLight" | "bg-$backgroundMajorLight" | "bg-$backgroundMajorHeavy" | "bg-$backgroundDangerHeavy" | "bg-$backgroundDangerLight" | "bg-$backgroundDisabled" | "bg-$backgroundDark" | "bg-$backgroundDarkElevated" | "bg-$backgroundDarkActive" | "bg-$backgroundInverted" | "bg-$textDisabled" | "bg-$textDefault" | "bg-$textNeutralHeavy" | "bg-$textNeutral" | "bg-$textNeutralLight" | "bg-$textDefaultLight" | "bg-$textPrimary" | "bg-$textGeneral" | "bg-$textSuccess" | "bg-$textSuccessLight" | "bg-$textMajor" | "bg-$textDanger" | "bg-$textDangerLight" | "bg-$iconDefault" | "bg-$iconNeutral" | "bg-$iconDefaultLight" | "bg-$iconPrimary" | "bg-$iconPrimaryLight" | "bg-$iconGeneral" | "bg-$iconGeneralLight" | "bg-$iconSuccess" | "bg-$iconSuccessLight" | "bg-$iconMajor" | "bg-$iconDanger" | "bg-$iconDangerLight" | "bg-$iconDisabled" | "bg-$outlineDefault" | "bg-$outlineDisabled" | "bg-$outlineDisabledHeavy" | "bg-$outlineNeutral" | "bg-$outlineNeutralHeavy" | "bg-$outlinePrimary" | "bg-$outlinePrimaryMedium" | "bg-$outlineGeneral" | "bg-$outlineWarning" | "bg-$outlineDanger" | "bg-$outlineInverted" | "bg-$black" | "bg-$white" | "bg-grey1" | "bg-grey5" | "bg-grey10" | "bg-grey20" | "bg-grey30" | "bg-grey40" | "bg-grey50" | "bg-grey60" | "bg-grey70" | "bg-grey80" | "bg-blue1" | "bg-blue5" | "bg-blue10" | "bg-blue20" | "bg-blue30" | "bg-blue40" | "bg-blue50" | "bg-blue60" | "bg-blue70" | "bg-blue80" | "bg-cyan10" | "bg-cyan20" | "bg-cyan30" | "bg-cyan40" | "bg-cyan50" | "bg-cyan60" | "bg-cyan70" | "bg-cyan80" | "bg-green1" | "bg-green5" | "bg-green10" | "bg-green20" | "bg-green30" | "bg-green40" | "bg-green50" | "bg-green60" | "bg-green70" | "bg-green80" | "bg-yellow1" | "bg-yellow5" | "bg-yellow10" | "bg-yellow20" | "bg-yellow30" | "bg-yellow40" | "bg-yellow50" | "bg-yellow60" | "bg-yellow70" | "bg-yellow80" | "bg-orange1" | "bg-orange5" | "bg-orange10" | "bg-orange20" | "bg-orange30" | "bg-orange40" | "bg-orange50" | "bg-orange60" | "bg-orange70" | "bg-orange80" | "bg-red1" | "bg-red5" | "bg-red10" | "bg-red20" | "bg-red30" | "bg-red40" | "bg-red50" | "bg-red60" | "bg-red70" | "bg-red80" | "bg-purple1" | "bg-purple5" | "bg-purple10" | "bg-purple20" | "bg-purple30" | "bg-purple40" | "bg-purple50" | "bg-purple60" | "bg-purple70" | "bg-purple80" | "bg-violet1" | "bg-violet5" | "bg-violet10" | "bg-violet20" | "bg-violet30" | "bg-violet40" | "bg-violet50" | "bg-violet60" | "bg-violet70" | "bg-violet80", boolean>> & Partial<Record<"margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV", boolean>> & {
|
|
504
511
|
label?: string | undefined;
|
|
505
512
|
color?: string | undefined;
|
|
@@ -530,5 +537,6 @@ declare const _default: React.ForwardRefExoticComponent<((import("../touchableOp
|
|
|
530
537
|
getActiveBackgroundColor?: ((backgroundColor: string, props: any) => string) | undefined;
|
|
531
538
|
animateLayout?: boolean | undefined;
|
|
532
539
|
animateTo?: import("./types").ButtonAnimationDirectionProp | undefined;
|
|
540
|
+
customBackground?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
533
541
|
}, "ref">) & React.RefAttributes<{}>> & ComponentStatics<typeof Button>;
|
|
534
542
|
export default _default;
|
|
@@ -4,6 +4,7 @@ import { Platform, StyleSheet, LayoutAnimation } from 'react-native';
|
|
|
4
4
|
import { asBaseComponent, forwardRef, Constants } from "../../commons/new";
|
|
5
5
|
import { Colors, Typography, BorderRadiuses } from "../../style";
|
|
6
6
|
import TouchableOpacity from "../touchableOpacity";
|
|
7
|
+
import View from "../view";
|
|
7
8
|
import Text from "../text";
|
|
8
9
|
import Icon from "../icon";
|
|
9
10
|
import { ButtonSize, ButtonAnimationDirection, ButtonProps, DEFAULT_PROPS } from "./types";
|
|
@@ -358,6 +359,17 @@ class Button extends PureComponent {
|
|
|
358
359
|
right: horizontalHitslop
|
|
359
360
|
};
|
|
360
361
|
}
|
|
362
|
+
renderCustomBackground() {
|
|
363
|
+
const {
|
|
364
|
+
customBackground
|
|
365
|
+
} = this.props;
|
|
366
|
+
if (customBackground) {
|
|
367
|
+
const borderRadiusStyle = this.getBorderRadiusStyle();
|
|
368
|
+
return <View absF style={[this.styles.backgroundElement, borderRadiusStyle]}>
|
|
369
|
+
{customBackground}
|
|
370
|
+
</View>;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
361
373
|
render() {
|
|
362
374
|
const {
|
|
363
375
|
onPress,
|
|
@@ -368,6 +380,7 @@ class Button extends PureComponent {
|
|
|
368
380
|
modifiers,
|
|
369
381
|
forwardedRef,
|
|
370
382
|
hitSlop: hitSlopProp,
|
|
383
|
+
customBackground,
|
|
371
384
|
...others
|
|
372
385
|
} = this.props;
|
|
373
386
|
const shadowStyle = this.getShadowStyle();
|
|
@@ -375,13 +388,14 @@ class Button extends PureComponent {
|
|
|
375
388
|
margins,
|
|
376
389
|
paddings
|
|
377
390
|
} = modifiers;
|
|
378
|
-
const backgroundColor = this.getBackgroundColor();
|
|
391
|
+
const backgroundColor = customBackground ? undefined : this.getBackgroundColor();
|
|
379
392
|
const outlineStyle = this.getOutlineStyle();
|
|
380
393
|
const containerSizeStyle = this.getContainerSizeStyle();
|
|
381
394
|
const borderRadiusStyle = this.getBorderRadiusStyle();
|
|
382
395
|
return <TouchableOpacity row centerV style={[this.styles.container, animateLayout && this.getAnimationDirectionStyle(), containerSizeStyle, this.isLink && this.styles.innerContainerLink, shadowStyle, margins, paddings, {
|
|
383
396
|
backgroundColor
|
|
384
397
|
}, borderRadiusStyle, outlineStyle, style]} activeOpacity={0.6} activeBackgroundColor={this.getActiveBackgroundColor()} onLayout={this.onLayout} onPress={onPress} disabled={disabled} testID={testID} hitSlop={hitSlopProp ?? this.getAccessibleHitSlop()} {...others} ref={forwardedRef}>
|
|
398
|
+
{this.renderCustomBackground()}
|
|
385
399
|
{this.props.children}
|
|
386
400
|
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
|
|
387
401
|
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
|
|
@@ -415,6 +429,9 @@ function createStyles() {
|
|
|
415
429
|
backgroundColor: 'transparent',
|
|
416
430
|
flexDirection: 'row',
|
|
417
431
|
...Typography.text70
|
|
432
|
+
},
|
|
433
|
+
backgroundElement: {
|
|
434
|
+
overflow: 'hidden'
|
|
418
435
|
}
|
|
419
436
|
});
|
|
420
437
|
}
|
|
@@ -138,6 +138,10 @@ export type ButtonProps = TouchableOpacityProps & TypographyModifiers & ColorsMo
|
|
|
138
138
|
* the direction of the animation ('left' and 'right' will effect the button's own alignment)
|
|
139
139
|
*/
|
|
140
140
|
animateTo?: ButtonAnimationDirectionProp;
|
|
141
|
+
/**
|
|
142
|
+
* Custom element to render as button background (takes precedence over backgroundColor)
|
|
143
|
+
*/
|
|
144
|
+
customBackground?: React.ReactElement;
|
|
141
145
|
};
|
|
142
146
|
export type ButtonState = {
|
|
143
147
|
size?: number;
|