基础知识访问主题访问主题如果你需要在使用 Restyle 创建的组件之外手动访问主题,请使用 useTheme 钩子const Component = () => { const theme = useTheme<Theme>(); const {cardPrimaryBackground} = theme.colors; // ...};通过这样做而不是直接导入主题对象,可以很容易地在运行时切换主题,例如在你的应用中实现暗黑模式切换。