React native 本地应用程序上的全局样式
我正在从事一个有40个组件和50多个屏幕的项目。我们想替换字体,但我们意识到,通过自定义组件逐个文件更改所有React native 本地应用程序上的全局样式,react-native,user-interface,mobile,fonts,styled-components,React Native,User Interface,Mobile,Fonts,Styled Components,我正在从事一个有40个组件和50多个屏幕的项目。我们想替换字体,但我们意识到,通过自定义组件逐个文件更改所有Text元素需要大量工作 我们正在使用样式化组件 我的问题是,是否有一个与此代码等效但使用React Native的代码: import { createGlobalStyle } from 'styled-components' const GlobalStyle = createGlobalStyle` html, body { font-family: fontFami
Text
元素需要大量工作
我们正在使用样式化组件
我的问题是,是否有一个与此代码等效但使用React Native的代码:
import { createGlobalStyle } from 'styled-components'
const GlobalStyle = createGlobalStyle`
html, body {
font-family: fontFamilyName;
}
`
// later in your app
<React.Fragment>
<GlobalStyle whiteColor />
<Navigation /> {/* example of other top-level stuff */}
</React.Fragment>
从“样式化组件”导入{createGlobalStyle}
const GlobalStyle=createGlobalStyle`
html,正文{
字体系列:fontFamilyName;
}
`
//稍后在你的应用程序中
{/*其他顶级内容的示例*/}
我一直在寻找不同的方法来实现一个全局字体系列,但最终我总是得到一个定制组件,就像这里建议的那样
谢谢