Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Modal not working as expected on Web #34

Closed
Darking360 opened this issue Feb 17, 2020 · 2 comments
Closed

Modal not working as expected on Web #34

Darking360 opened this issue Feb 17, 2020 · 2 comments

Comments

@Darking360
Copy link

Darking360 commented Feb 17, 2020

Issue

Greetings. I'm trying to run the code example for React Native's Modal component but inside the web, the toggle is rendered both the modal content and the button trigger, this only happens on the web, for Android and iOs work as expected. Is this because Modal doesn't have a web implementation yet?

I attach the code I'm trying to run and some images:

import React, {Component} from 'react';
import {Modal, Text, TouchableHighlight, View, Alert} from 'react-native';

class App extends Component {
  state = {
    modalVisible: false,
  };

  setModalVisible(visible) {
    this.setState({modalVisible: visible});
  }

  render() {
    return (
      <View style={{marginTop: 22}}>
        <Modal
          animationType="slide"
          transparent={false}
          visible={this.state.modalVisible}
          onRequestClose={() => {
            Alert.alert('Modal has been closed.');
          }}>
          <View style={{marginTop: 22}}>
            <View>
              <Text>Hello World!</Text>

              <TouchableHighlight
                onPress={() => {
                  this.setModalVisible(!this.state.modalVisible);
                }}>
                <Text>Hide Modal</Text>
              </TouchableHighlight>
            </View>
          </View>
        </Modal>

        <TouchableHighlight
          onPress={() => {
            this.setModalVisible(true);
          }}>
          <Text>Show Modal</Text>
        </TouchableHighlight>
      </View>
    );
  }
}

export default App;

It looks like this on the web:

image

And like this on iOs for example:

image

Expected behavior

It should work in the web tab as expected?

Thank you 🙏

@kopax
Copy link

kopax commented Feb 18, 2020

I have found that the minfiied code cause issue on the web, maybe a terser bug?

@tcdavis
Copy link
Contributor

tcdavis commented Feb 24, 2020

I believe that Modal is not working in RNweb right now:
necolas/react-native-web#1020

@tcdavis tcdavis closed this as completed Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants