Javascript 如何在后台运行Google streetview时弹出一个模式

Javascript 如何在后台运行Google streetview时弹出一个模式,javascript,reactjs,google-maps-api-3,modal-dialog,Javascript,Reactjs,Google Maps Api 3,Modal Dialog,我一直在使用谷歌地图API,特别是街景API。我的目标是在街景模式下弹出一个模式。我将分享我用于模态的代码,但是它们在我的项目中的两个单独的文件夹中。有人知道如何在后台运行函数时弹出模式吗?(顺便说一句,我使用的是REACT的模态组件) 在调用组件“Modal”之前,我尝试调用包含GoogleMapsAPI的组件“GoogleMApsStreetView” {} <div> {<GoogleMapsStreetView />} <M

我一直在使用谷歌地图API,特别是街景API。我的目标是在街景模式下弹出一个模式。我将分享我用于模态的代码,但是它们在我的项目中的两个单独的文件夹中。有人知道如何在后台运行函数时弹出模式吗?(顺便说一句,我使用的是REACT的模态组件)

在调用组件“Modal”之前,我尝试调用包含GoogleMapsAPI的组件“GoogleMApsStreetView”


{}
<div>
        {<GoogleMapsStreetView />}
        <Modal
        className="Modal"
        className="content-Modal"
import React, { Component } from "react";
import Modal from 'react-modal';
import GoogleMapsStreetView from "./GoogleMapsStreetView.js";


export default class LevelOne extends Component {

  constructor() {
    super();

    this.state = {
      modalIsOpen: true
    };
  }
    /*this.openModal = this.openModal.bind(this);
    this.afterOpenModal = this.afterOpenModal.bind(this);
    this.closeModal = this.closeModal.bind(this);
  }

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

  afterOpenModal() {
    // to change text color in modal
    //this.subtitle.style.color = '#000000';
  }

  closeModal() {
    this.setState({modalIsOpen: false});
  }*/

  render() {

    return (
      <div>
        {<GoogleMapsStreetView />}
        <Modal
        className="Modal"
        className="content-Modal"

          isOpen={this.state.modalIsOpen}
          onAfterOpen={this.afterOpenModal}
          onRequestClose={this.closeModal}
          contentLabel="Example Modal"
        >


          <center><h2 style = {{color: '#444444'}}>Hello Jane!</h2></center>
          <center><button onClick={this.closeModal}>close</button></center>
        </Modal>
      </div>

    );
  }
}