Skip to content

Commit be84578

Browse files
committed
feat: add shadow prop
1 parent b032fc4 commit be84578

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/InputSpinner.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@ class InputSpinner extends Component {
878878
width: this.props.width,
879879
height: this.props.height,
880880
},
881+
this.props.showBorder
882+
? {borderWidth: 0.5, borderColor: this._getColor()}
883+
: {},
884+
this.props.shadow ? Style.containerShadow : {},
885+
this.props.rounded ? {borderRadius: this.props.height / 2} : {},
881886
this.props.style,
882887
];
883888
}
@@ -894,10 +899,12 @@ class InputSpinner extends Component {
894899
color: this.props.textColor,
895900
fontSize: this.props.fontSize,
896901
fontFamily: this.props.fontFamily,
897-
borderColor: this.props.showBorder ? this._getColor() : "transparent",
898902
backgroundColor: this.props.background,
899903
height: this.props.height,
900904
},
905+
this.props.showBorder
906+
? {borderWidth: 0.5, borderColor: this._getColor()}
907+
: {},
901908
this.props.inputStyle,
902909
];
903910
}
@@ -1142,6 +1149,7 @@ InputSpinner.propTypes = {
11421149
initialValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
11431150
step: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
11441151
precision: PropTypes.number,
1152+
shadow: PropTypes.bool,
11451153
rounded: PropTypes.bool,
11461154
activeOpacity: PropTypes.number,
11471155
color: PropTypes.string,
@@ -1216,6 +1224,7 @@ InputSpinner.defaultProps = {
12161224
step: 1,
12171225
precision: 2,
12181226
rounded: true,
1227+
shadow: false,
12191228
activeOpacity: 0.85,
12201229
color: defaultColor,
12211230
colorPress: defaultColor,

src/Style.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ export const Style = StyleSheet.create({
1515
alignItems: "center",
1616
justifyContent: "center",
1717
},
18+
containerShadow: {
19+
shadowColor: "#000",
20+
shadowOffset: {
21+
width: 0,
22+
height: 6,
23+
},
24+
shadowOpacity: 0.39,
25+
shadowRadius: 8.3,
26+
27+
elevation: 10,
28+
},
1829
buttonLeft: {
1930
alignItems: "center",
2031
justifyContent: "center",

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface ReactNativeInputSpinnerProps {
99
initialValue?: string | number;
1010
step?: string | number;
1111
precision?: number;
12+
shadow?: boolean;
1213
rounded?: boolean;
1314
activeOpacity?: number;
1415
color?: string;

0 commit comments

Comments
 (0)