css - 如何在不使用 styleSheet 原生元素的情况下将 CSS 文件添加到 react-native 应用程序中
问题描述
我需要将纯CSS
文件添加到 react-native android 和 ios 应用程序中。如何在不使用 styleSheet 原生元素的情况下克服这个问题?
body {
margin: 25px;
background-color: rgb(240,240,240);
font-family: arial, sans-serif;
font-size: 14px;
}
h1 {
font-size: 35px;
font-weight: normal;
margin-top: 5px;
}
解决方案
然后,您可以使用 css 对组件样式进行编码。
const Body = styled.body`
margin: 25px;
background-color: rgb(240,240,240);
font-family: arial, sans-serif;
font-size: 14px;
`;
const Header = styled.h1`
font-size: 35px;
font-weight: normal;
margin-top: 5px;
`;
推荐阅读
- c# - 使用 MediaCapture 的相机流在一段时间后停止工作?
- python - 如何从 NetworkX 图形转换为 ete3 树对象?
- php - Laravel 贪吃 http
- r - 自定义函数不从magicfor返回for循环的结果
- string - 将匿名函数扩展为字符串
- uml - 从(流)端口到 UML 活动图的模型数据流
- java - Java 从文件夹中搜索文件
- angular - 如何设置表单字段值ng-Bootstrap模型的值
- java - Tomcat 日历 Webapp mysql: MySQLNonTransientConnectionException:
- java - 在活动之上打开片段的最佳做法是什么