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.

Refreshing when multiple Modals open will keep the first one open after refresh

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.3.0 Yarn: 1.0.2 npm: 2.15.12 Watchman: 4.9.0 Xcode: Xcode 8.3.3 Build version 8E3004b Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: ^0.48.1 => 0.48.2

Target Platform: iOS (10.3)

Steps to Reproduce

See demo app below.

Initial background color is blue, first modal is red, second modal black.

  1. Press “Launch Modal” to launch the first red modal.
  2. Press “Launch Modal” again to launch second black modal.
  3. Now press ⌘R to refresh.

Expected Behavior

I would expect all modals to close and not to reopen after refreshing the app.

Actual Behavior

You’ll notice that immediately after refreshing the app the second black modal becomes active again (while the first red modal does not) and the entire screen is unresponsive. The only way out of this state is to recompile the app completely.

I haven’t confirmed whether this also happens on Android.

Reproducible Demo

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

export default function App () {
  return <ComponentThatLaunchesModal color1="blue" color2="red" color3="black" />;
}

class ComponentThatLaunchesModal extends React.Component {
  state = {
    showModal: false,
  };

  render () {
    return (
      <View style={[styles.container, { backgroundColor: this.props.color1 }]}>
        <TouchableOpacity onPress={() => this.setState({ showModal: true })}>
          <Text style={styles.label}>Launch Modal</Text>
        </TouchableOpacity>

        <Modal animationType="slide" visible={this.state.showModal}>
          <ComponentThatLaunchesModal color1={this.props.color2} color2={this.props.color3} />
        </Modal>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },

  label: {
    color: 'white',
  },
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

23reactions
afortycommented, Feb 5, 2018

Activity. This is still very much a bug.

5reactions
afortycommented, Oct 15, 2018

Not stale, still an issue with 0.57.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keep Bootstrap Modal Open when page refresh - Stack Overflow
My Page refreshed after submitting the form.Is there a way after refresh page modal open again and I an show the message there...
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 >
10 Most Common Bootstrap Mistakes That Developers Make
Bootstrap doesn't support overlapping modals. Only one modal at the time can be visible. Showing more than one modal at a time can...
Read more >
JavaScript · Bootstrap
Multiple open modals not supported. Be sure not to open a modal while another is still visible. Showing more than one modal at...
Read more >
Refresh Behavior in Interfaces - Appian 22.4
System load will vary based on the number of active auto-refreshing interfaces that are open at one time. An interface will not continue...
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