question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modal: Refresh (via dev menu) does not tear down

See original GitHub issue

Is this a bug report?

yes

Have you read the Contributing Guidelines?

kind of

Environment

Environment: OS: Windows 10 Node: 9.0.0 Yarn: 1.3.2 npm: 5.5.1 Watchman: Not Found Xcode: N/A Android Studio: Version 3.0.0.0 AI-171.4408382

Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.53.0 => 0.53.0

Target Platform: Android 7.0 on Samsung Galaxy S5

Steps to Reproduce

  1. create app and launch with react-native run-android
  2. trigger state which causes a modal to show
  3. launch the dev menu (via shake or keycode)
  4. select refresh

Expected Behavior

The app closes the modal and refreshes

Actual Behavior

The app presumably refreshes, but the modal stays on top and cannot be closed

Reproducible Demo


import React, { Component } from 'react';
import { Text, View, Button, Modal, StyleSheet } from 'react-native';

export default class MyComponent extends Component {
  state = {
    modalVisible: false,
  };

  openModal() {
    this.setState({modalVisible:true});
  }

  closeModal() {
    this.setState({modalVisible:false});
  }

  render() {
    return (
        <View style={styles.container}>
          <Modal
              visible={this.state.modalVisible}
              animationType={'slide'}
              onRequestClose={() => this.closeModal()}
          >
            <View style={styles.modalContainer}>
              <View style={styles.innerContainer}>
                <Text>This is content inside of modal component</Text>
                <Button
                    onPress={() => this.closeModal()}
                    title="Close modal"
                >
                </Button>
              </View>
            </View>
          </Modal>
          <Button
              onPress={() => this.openModal()}
              title="Open modal"
          />
        </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
  modalContainer: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: 'grey',
  },
  innerContainer: {
    alignItems: 'center',
  },
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:117
  • Comments:77 (9 by maintainers)

github_iconTop GitHub Comments

61reactions
malvindercommented, Aug 12, 2019

Confirming, still an issue in RN 0.60.4

27reactions
rafaelfndevcommented, Apr 7, 2019

Still an issue on react-native 0.59.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reload content in modal (twitter bootstrap)
You can force Modal to refresh the popup by adding this line at the end of the hide method of the Modal plugin...
Read more >
How to Make a Modal Popup Refresh Items on the Page
Refreshing Page Using onClick Event​​ This is a mandatory function required to close the modal invoked by the onHide event. Call the reload() ......
Read more >
Angular 8 #16; Refresh GRID on Modal close - YouTube
If this video is helpful to you, you can support this channel to grow much more by supporting on patreon ...
Read more >
Using modals in Slack apps
Modals are a focused surface to collect data from users or display dynamic and interactive information. To users, modals appear as focused surfaces...
Read more >
lightning-modal - documentation
There is no lightning-modal component. Instead, you create a modal by extending LightningModal and using these helper lightning-modal-* components to provide a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found