我想更改所有按钮样式,而不必像这样一个接一个地添加样式:
<Button mode="contained" style={{ backgroundColor: "#FF6766" }} >
我正在尝试这样做:
const theme = {
...DefaultTheme,
roundness: 2,
colors: {
...DefaultTheme.colors,
primary: '#ffffff',
accent: '#f1c40f',
text: '#515151',
surface: '#FF6766',
underlineColor: 'transparent',
background: '#ffffff',
contained: '#000000',
}
};
但是我不知道这里是否可行,我在以下链接上找到了此链接:https://callstack.github.io/react-native-paper/theming.html
App.js
export default function App() {
const theme = {
...DefaultTheme,
roundness: 2,
colors: {
...DefaultTheme.colors,
primary: '#ffffff',
accent: '#f1c40f',
text: '#515151',
surface: '#FF6766',
underlineColor: 'transparent',
background: '#ffffff',
contained: '#000000',
}
};
return (
<PaperProvider theme={theme}>
<AppNavigator />
</PaperProvider>
)
}