Skip to content

Commit 118beb7

Browse files
committed
Extend ActionButton to take buttonFontSize and btnOutRange
1 parent af7c87b commit 118beb7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ActionButton.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export default class ActionButton extends Component {
156156
<Animated.Text
157157
style={[styles.btnText,
158158
{
159+
fontSize: this.props.buttonFontSize,
159160
color: this.state.anim.interpolate({
160161
inputRange: [0, 1],
161162
outputRange: [this.props.buttonTextColor, this.props.btnOutRangeTxt]
@@ -196,7 +197,7 @@ export default class ActionButton extends Component {
196197
angle={startRadian + index * offset}
197198
btnColor={this.props.btnOutRange}
198199
{...button.props}
199-
onPress={() => {
200+
onPress={() => {
200201
if (this.props.autoInactive) {
201202
this.timeout = setTimeout(() => {
202203
this.reset();
@@ -274,13 +275,16 @@ ActionButton.propTypes = {
274275
radius: PropTypes.number,
275276
children: PropTypes.node,
276277
position: PropTypes.oneOf(['left', 'center', 'right']),
278+
btnOutRange: PropTypes.string,
279+
buttonFontSize: PropTypes.number,
277280
};
278281

279282
ActionButton.defaultProps = {
280283
active: false,
281284
bgColor: 'transparent',
282285
buttonColor: 'rgba(0,0,0,1)',
283286
buttonTextColor: 'rgba(255,255,255,1)',
287+
buttonFontSize: 24,
284288
position: 'center',
285289
outRangeScale: 1,
286290
autoInactive: true,
@@ -326,7 +330,6 @@ const styles = StyleSheet.create({
326330
},
327331
btnText: {
328332
marginTop: -4,
329-
fontSize: 24,
330333
backgroundColor: 'transparent',
331334
position: 'relative',
332335
},

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Also this example uses `react-native-vector-icons` for the button Icons.
8686
| radiua | number | 100 | radius of menu
8787
| bgColor | string | "transparent" | color of overlay when ActionButtons are visible
8888
| buttonColor | string | "rgba(0,0,0,1)" | background color of the +Button **(must be rgba value!)**
89+
| buttonFontSize | number | 24 | + and x sizes
8990
| btnOutRange | string | props.buttonColor | button background color to animate to
9091
| outRangeScale | number | 1 | changes size of button during animation
9192
| onPress | function | null | fires, when ActionButton is tapped

0 commit comments

Comments
 (0)