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

Docs: mention Modal state:modalVisible is required #3724

Closed
morenoh149 opened this issue Oct 27, 2015 · 1 comment
Closed

Docs: mention Modal state:modalVisible is required #3724

morenoh149 opened this issue Oct 27, 2015 · 1 comment
Assignees
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@morenoh149
Copy link
Contributor

The following works

import React from 'react-native'
import _ from 'lodash'
import { Icon } from 'react-native-icons'

const {
  Modal,
  StyleSheet,
  Text,
  TouchableHighlight,
  View,
  Dimensions,
  ScrollView,
} = React;

class InviteModal extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      animated: true,
      modalVisible: false,
      transparent: true,
    };
  }

  handleDismiss(errorId) {
    this.setState({
      modalVisible: false
    })
  }

  render() {
    return (
      <View>
        <Modal
          animated={true}
          transparent={true}
          visible={this.state.modalVisible}
        >
          <View style={styles.container}>
            <View style={styles.innerContainer}>
              <ScrollView style={styles.errorsContainer}>
              </ScrollView>
              <TouchableHighlight
                style={styles.button}
                onPress={::this.handleDismiss}
                underlayColor={'#fff'}
              >
                <Text style={styles.buttonText}>Dismiss</Text>
              </TouchableHighlight>
            </View>
          </View>
        </Modal>
      </View>
    );
  }
};

var styles = StyleSheet.create({
});

var { height: deviceHeight } = Dimensions.get('window');

export default InviteModal

but if you remove this.state.modalVisible it does not work. I get Exception thrown while executing UI block: Can't present modal view controller without a presenting view controller. Either the docs should mention such a requirement or the error should be more descriptive.

Ref: #2952

@astreet astreet added the Platform: iOS iOS applications. label Oct 27, 2015
@tadeuzagallo tadeuzagallo assigned javache and unassigned tadeuzagallo Oct 27, 2015
@javache
Copy link
Member

javache commented Oct 29, 2015

I'll actually change the default here, so the default value for visible is true.

@javache javache closed this as completed Oct 29, 2015
javache added a commit that referenced this issue Oct 31, 2015
Summary: Make <Modal> visible by default and fix the scenario where we present a modal immediately when adding it to the view hierarchy.

Closes #3724
Closes #2952

public

Reviewed By: nicklockwood

Differential Revision: D2595938

fb-gh-sync-id: 1571790d36fe486f1fbbed9f2d66f1e6add73d91
MattFoley pushed a commit to skillz/react-native that referenced this issue Nov 9, 2015
Summary: Make <Modal> visible by default and fix the scenario where we present a modal immediately when adding it to the view hierarchy.

Closes facebook#3724
Closes facebook#2952

public

Reviewed By: nicklockwood

Differential Revision: D2595938

fb-gh-sync-id: 1571790d36fe486f1fbbed9f2d66f1e6add73d91
Crash-- pushed a commit to Crash--/react-native that referenced this issue Dec 24, 2015
Summary: Make <Modal> visible by default and fix the scenario where we present a modal immediately when adding it to the view hierarchy.

Closes facebook#3724
Closes facebook#2952

public

Reviewed By: nicklockwood

Differential Revision: D2595938

fb-gh-sync-id: 1571790d36fe486f1fbbed9f2d66f1e6add73d91
rozele referenced this issue in microsoft/react-native-windows May 25, 2016
Summary: Make <Modal> visible by default and fix the scenario where we present a modal immediately when adding it to the view hierarchy.

Closes #3724
Closes #2952

public

Reviewed By: nicklockwood

Differential Revision: D2595938

fb-gh-sync-id: 1571790d36fe486f1fbbed9f2d66f1e6add73d91
@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants