Skip to content

Commit fc34488

Browse files
authored
Merge pull request #3 from fwaadahmad1/fahmad/master
style props for backdrop and action icon
2 parents c5a2dda + 244517b commit fc34488

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ declare module "react-native-floating-action" {
4444
style?: ViewStyle;
4545
iconStyle?: ViewStyle;
4646
itemStyle?: ViewStyle;
47+
backdropStyle?: ViewStyle;
4748
tintColor?: string;
4849
actions?: IActionProps[];
4950
color?: string;

src/AddIcon.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { View, StyleSheet } from "react-native";
44

55
class AddIcon extends PureComponent {
66
render() {
7-
const { width, height, backgroundColor } = this.props;
7+
const { width, height, backgroundColor, iconStyle } = this.props;
88

99
return (
1010
<View style={styles.container}>
11-
<View style={[styles.vertical, { height, backgroundColor }]} />
12-
<View style={[styles.horizontal, { width, backgroundColor }]} />
11+
<View style={[styles.vertical, { height, backgroundColor }, iconStyle]} />
12+
<View style={[styles.horizontal, { width, backgroundColor }, iconStyle]} />
1313
</View>
1414
);
1515
}

src/FloatingAction.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class FloatingAction extends Component {
186186
} = this.props;
187187

188188
if (overrideWithAction) {
189-
const { icon } = actions[0];
189+
const { icon } = actions[0]?.icon || floatingIcon;
190190

191191
if (React.isValidElement(icon)) {
192192
return icon;
@@ -209,7 +209,12 @@ class FloatingAction extends Component {
209209
);
210210
}
211211

212-
return <AddIcon width={iconStyle?.width || iconWidth} height={iconStyle?.height || iconHeight} backgroundColor={iconStyle?.backgroundColor || iconColor} />;
212+
return <AddIcon
213+
width={iconStyle?.width || iconWidth}
214+
height={iconStyle?.height || iconHeight}
215+
backgroundColor={iconStyle?.backgroundColor || iconColor}
216+
iconStyle={iconStyle}
217+
/>;
213218
};
214219

215220
reset = () => {
@@ -528,7 +533,7 @@ class FloatingAction extends Component {
528533
imageStyle={action?.imageStyle}
529534
imageContainerStyle={action?.imageContainerStyle}
530535
textStyle={action?.textStyle}
531-
textContainerStyle={action.textContainerStyle}
536+
textContainerStyle={action?.textContainerStyle}
532537
/>
533538
);
534539
})}
@@ -571,6 +576,7 @@ FloatingAction.propTypes = {
571576
tintColor: PropTypes.string,
572577
iconStyle: PropTypes.object,
573578
itemStyle: PropTypes.object,
579+
backdropStyle: PropTypes.object,
574580
actions: PropTypes.arrayOf(
575581
PropTypes.shape({
576582
color: PropTypes.string,

0 commit comments

Comments
 (0)