Current behaviour
I am trying to display and hide a fab.group. When I tried the first time It is works, I can hide the fab and display it again. But when I try again, I can not hide it
Expected behaviour
Being able to hide the fab more than once
Code sample
_callOtherview( ) {
this._hide();
Actions.comment({ changeState: this._display }); // I am using to change the current view with 'react-native-router-flux'
}
_display = () => {
this.setState({
displayButton: true,
});
}
_hide = () => {
this.setState({
displayButton: false,
});
}
render () {
return(
<FAB.Group
visible={this.state.displayButton}
open={this.state.open}
icon={require( '../../../src/favicon.jpg')}
actions={[
{ icon: 'camera', label: 'Foto', onPress: this._selectPhoto },
{ icon: 'comment', label: 'Comentario', onPress: this._sendComment },
]}
onStateChange={({ open }) => this.setState({ open })}
onPress={() => {
if (this.state.open) {
// do something if the speed dial is open
}
}}
/>
)
}
Screenshots (if applicable)
What have you tried
I checked if the state is well implemented and also I tried to implement the fab by another way, somithing like this:
if (this.state.display) {
return
} else {
return null
}
But I had the same problem
Your Environment
| software |
version |
| ios or android |
android |
| react-native |
0.55 |
| react-native-paper |
2.7 |
| node |
10.13 |
| npm or yarn |
6.4.1 |
| expo sdk |
|
Current behaviour
I am trying to display and hide a fab.group. When I tried the first time It is works, I can hide the fab and display it again. But when I try again, I can not hide it
Expected behaviour
Being able to hide the fab more than once
Code sample
_callOtherview( ) {
this._hide();
Actions.comment({ changeState: this._display }); // I am using to change the current view with 'react-native-router-flux'
}
_display = () => {
this.setState({
displayButton: true,
});
}
_hide = () => {
this.setState({
displayButton: false,
});
}
render () {
return(
<FAB.Group
visible={this.state.displayButton}
open={this.state.open}
icon={require( '../../../src/favicon.jpg')}
actions={[
{ icon: 'camera', label: 'Foto', onPress: this._selectPhoto },
{ icon: 'comment', label: 'Comentario', onPress: this._sendComment },
]}
onStateChange={({ open }) => this.setState({ open })}
onPress={() => {
if (this.state.open) {
// do something if the speed dial is open
}
}}
/>
)
}
Screenshots (if applicable)
What have you tried
I checked if the state is well implemented and also I tried to implement the fab by another way, somithing like this:
if (this.state.display) {
return
} else {
return null
}
But I had the same problem
Your Environment