I am currently building a react native app and am using a stack navigator to navigate between the screens in my app. In my App.js, I am currently storing the screens in this format:
const Stack = createStackNavigator();
export default function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="screen1">
<Stack.Screen name="screen1" component={Screen1}></Stack.Screen>
<Stack.Screen name="screen2" component={Screen2}></Stack.Screen>
</Stack.Navigator>
</NavigationContainer>
);
}
Run Code Online (Sandbox Code Playgroud)
After the user is in screen 1, I want to be able to navigate to screen 2 on the press of a …
在我的应用程序中,我的 React 项目中的按钮具有以下 css 代码:
.Button {
background-color: #somehex;
}
Run Code Online (Sandbox Code Playgroud)
当用户将鼠标悬停在按钮上时,我希望背景颜色更深一些。我试过改变不透明度,但没有用,目前正在这样做:
.Button:hover {
transition: 0.2s ease-in;
background-color: #ALittleDarkerHex;
}
Run Code Online (Sandbox Code Playgroud)
虽然这个过程有效,但它真的很乏味,因为我必须手动寻找我正在使用的颜色的较暗版本。我想知道是否有一种更简单的方法可以使用 CSS 使按钮的背景颜色变暗。