Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal stays alive on screen after app resume (navigation stack change due to authorization) #778

Open
MikaelCompile opened this issue Mar 6, 2024 · 3 comments

Comments

@MikaelCompile
Copy link

MikaelCompile commented Mar 6, 2024

Describe the bug
We are working on an app that needs to validate the user every time the appstate changes to background due to sensitive information. Essentially a conditional that swaps you to an unathorized navigation stack for re-authentication if you put the app in the background. This seems to leave any open date picker modal open on the screen and no useEffects or other tries to set the open state to false after the fact seems to work.

Expected behavior
I would hope to be able to react to appstate changes and close the modal, but i'm not getting through to the modal via its parent component after setting the app in the background.

To Reproduce
Add example code that reproduces the behavior.

export default class App extends Component {

  state = { date: new Date() }

  render = () =>
    <DatePicker
      open={authorization.state === 'authorized' && !!showTimeSelect} <--- in this attempt, the open state should be reliant on authorization state
      date={this.state.date}
      onDateChange={date => this.setState({ date })}
    />

}

Smartphone (please complete the following information):
- iOS simulator, some hardware devices in testing. Hardware seems unimportant
"react-native": "0.71.12",
"react-native-date-picker": "^4.3.3",
"@react-navigation/stack": "^6.0.1",

@ConstSkripl
Copy link

@MikaelCompile Hello!

I faced the same problem, were you able to find a solution?

@MikaelCompile
Copy link
Author

Hi! We ended up creating a custom modal that has the inline version inside of it. I think the ticket was solved with that approach.

@ConstSkripl
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants