aksonov / aksonov/react-native-router-flux

Current status of Drawer opened/closed?

Aberta
#3,530 2 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
8.9k
Forks
2.1k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

### Version
Tell us which versions you are using:

- react-native-router-flux v4.0.6
- react v16.8.3
- react-native v0.59.5

### Expected behaviour

`Actions.state` contains `isDrawerOpen:false/true`

### Actual behaviour

`Action.state` does not contain `isDrawerOpen` anymore
it only contains >

```
index: 0
isTransitioning: true
key: "StackRouterRoot"
routes: [{…}]
```

### Explanation
I have a little wrapper component (if that's what it's called) where i registered a listener `BackHandler.addEventListener("hardwareBackPress", this.handleBackPress);` and I need it to operate conditionally based on whether the drawer is opened or closed. If closed > exit app and so on.

In a previous project I used the same exact wrapper component and was able to access `isDrawerOpen` via `Actions.state`. I am using `RNRF v4.0.6` over there too.

I did try to use the drawer's onExit/onEnter methods in my Router component like so:

```
{
this.setState({ _DrOpen: false });
}}
onEnter={() => {
this.setState({ _DrOpen: false });
}}
contentComponent={DrawerContent}
drawerWidth={300}
hideDrawerButton
>
```
and then pass that `_DrOpen` as a prop to my wrapper, but that would cause the router component to re-render and I have to control that. So, much code for a little function in my opinion.
So, before I go there, is there a straight forward way to know whether the drawer is closed/opened?
Thank you in advance!

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.