React-Materialize Modal:任何键都会意外关闭该模式

问题描述 投票:0回答:1

说明我有一个带有文本输入的react-materialize模式在选项中,我将dismissible设置为false

实际行为:当我在其中输入文字或其他内容时,任何键都会关闭模式。

预期的行为:我只想在单击关闭按钮或单击提交按钮时关闭模式您知道为什么任何键都会关闭模式吗?我认为这是由于我输入的OnChange。

谢谢

版本反应实现:3.5.10materialize-css:1.0.0反应:16.12.0

<Form>
  <Modal actions={[ <div>
    <Button className="blue darken-4" size="sm" onClick={()=> this.closeModal()}>Annuler</Button>{' '}
    <Button className="blue darken-4" size="sm" onClick={()=> this.addProd(producerName, producerShare)} >Enregistrer dans la blockchain</Button>
    </div>

    ]} bottomSheet={false} fixedFooter={false} header="Ajouter un coproducteur" id="Modal-0" open={false} options={{ dismissible: false, endingTop: '10%', inDuration: 250, onCloseEnd: null, onCloseStart: null, onOpenEnd: null, onOpenStart: null, opacity:
    0.5, outDuration: 250, preventScrolling: true, startingTop: '4%' }} trigger={
    <Button className="blue darken-4">Ajouter un coproducteur</Button>} >
    <p>

      Veuillez saisir le nom du coproducteur et le pourcentage de ses parts dans le projet
    </p>
    <br></br>


    <TextInput id="producerName" placeholder="Nom" onChange={adresse=> this.setState({producerName: adresse.target.value})} />{' '}
      <br></br>
      <TextInput id="producerShare" placeholder="Part Producteur" onChange={adresse=> this.setState({producerShare: adresse.target.value})} />
        <br></br>
  </Modal>
</Form>
reactjs modal-dialog state materialize onchange
1个回答
0
投票

解决方案是删除open = {false}

© www.soinside.com 2019 - 2024. All rights reserved.