我正在使用Switch Navigator进行react native expo项目,并且导航似乎正常工作,但是每次尝试单击按钮进行导航时,都会出现错误。我收到以下错误:
不变违反:此导航缺少导航道具。在react-navigation 3中,您必须直接设置应用程序容器。更多信息:https://codepen.io/anon/pen/VgRxoK?editors=1010
我目前正在遵循本文https://reactnavigation.org/docs/en/app-containers.html中概述的方法。
如何在没有导航道具的情况下遵循导航说明,app-containers.html链接中概述了什么?他们似乎互相冲突。
<style>
body {
font-family: 'Montserrat', sans-serif;
margin: 0;
}
.container {
display: flex;
justify-content: center;
align-items: center;
align-content: center;
flex-wrap: wrap;
width: 100%;
margin: 0 auto;
height: 100%;
}
.btn {
flex: 1 1 auto;
margin: 10;
padding: 20px;
text-align: center;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 1000px;
}
.btn:hover {
background-position: right center;
}
.btn-1 {
background-image: linear-gradient(to right, #f6d365 0%, #fda085 51%, #f6d365 100%);
}
</style>
<body>
<div class="container">
<a id="button1" class="btn btn-1">Hover me</a><br>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
var color1 = "#fdceaa";
var color2 = "#FFFFFF";
var color3 = "#FFFFFF";
var color = 'linear - gradient(to right, ' + color1 + ' 0 % , ' + color2 + ' 51 % ,' + color3 + ' 100 % )'
document.querySelector('.btn.btn-1')['background-image'] = color;
$('.btn.btn-1').css('background-image', "red");
</script>
</div>
</body>