React Navigation modal height

后端 未结 4 1157
执念已碎
执念已碎 2020-12-31 07:33

How do I set the height a React Navigation modal view so once it has appeared it will only cover about half of the screen from the bottom up, and the view below remains visi

4条回答
  •  傲寒
    傲寒 (楼主)
    2020-12-31 08:37

    In your stacknavigator you can set these options:

      mode: 'modal',
        headerMode: 'none',
        cardStyle:{
          backgroundColor:"transparent",
          opacity:0.99
      }
    

    And in your modal screen:

    class ModalScreen extends React.Component {
    
      render() {
        return (
          
              
                Testing a modal with transparent background
              
          
        );
      }
    }
    

    Also you can refer to this expo snack https://snack.expo.io/@yannerio/modal that I've created to show how it works, or you could use React Native Modal

提交回复
热议问题