Skip to content

Commit

Permalink
fix: makes FAB not pressable when initialy not visible (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trancever authored and ferrannp committed Feb 21, 2019
1 parent 7a4966d commit ade8d27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/components/FAB/FAB.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class FAB extends React.Component<Props, State> {
onPress,
theme,
style,
visible,
...rest
} = this.props;
const { visibility } = this.state;
Expand Down Expand Up @@ -185,6 +186,7 @@ class FAB extends React.Component<Props, State> {
disabled && styles.disabled,
style,
]}
pointerEvents={visible ? 'auto' : 'none'}
>
<TouchableRipple
borderless
Expand Down
6 changes: 3 additions & 3 deletions src/components/__tests__/__snapshots__/FAB.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`renders extended FAB 1`] = `
<View
pointerEvents="auto"
style={
Object {
"backgroundColor": "#03dac4",
Expand All @@ -22,7 +23,6 @@ exports[`renders extended FAB 1`] = `
],
}
}
visible={true}
>
<View
accessibilityLabel="Add items"
Expand Down Expand Up @@ -159,6 +159,7 @@ exports[`renders extended FAB 1`] = `

exports[`renders normal FAB 1`] = `
<View
pointerEvents="auto"
style={
Object {
"backgroundColor": "#03dac4",
Expand All @@ -179,7 +180,6 @@ exports[`renders normal FAB 1`] = `
],
}
}
visible={true}
>
<View
accessibilityRole="button"
Expand Down Expand Up @@ -292,6 +292,7 @@ exports[`renders normal FAB 1`] = `

exports[`renders small FAB 1`] = `
<View
pointerEvents="auto"
style={
Object {
"backgroundColor": "#03dac4",
Expand All @@ -312,7 +313,6 @@ exports[`renders small FAB 1`] = `
],
}
}
visible={true}
>
<View
accessibilityRole="button"
Expand Down

0 comments on commit ade8d27

Please sign in to comment.