Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 通过React Native和Expo从WebView中的本地文件使用CSS_Android_Ios_React Native_Exponent_Expo - Fatal编程技术网

Android 通过React Native和Expo从WebView中的本地文件使用CSS

Android 通过React Native和Expo从WebView中的本地文件使用CSS,android,ios,react-native,exponent,expo,Android,Ios,React Native,Exponent,Expo,我正在使用最新的Expo SDK。我使用非分离项目。 我需要从WebView中的本地文件加载css,该文件从字符串加载html,如下所示: <WebView source={{ baseUrl: './', html: this.fullPost }} /> 那么我应该把style.css文件放在哪里,我应该指定什么作为baseUrl? 这与世博会有什么关系 谢谢。最简单的方法是将css代码包装到javascript文件中: style.js: const css = ` <

我正在使用最新的Expo SDK。我使用非分离项目。 我需要从
WebView
中的本地文件加载
css
,该文件从字符串加载
html
,如下所示:

<WebView source={{ baseUrl: './', html: this.fullPost }} />
那么我应该把
style.css
文件放在哪里,我应该指定什么作为
baseUrl
? 这与世博会有什么关系


谢谢。

最简单的方法是将css代码包装到javascript文件中:

style.js:

const css = `
<style>
// copy your css file's content here
</style>
`;
export default css;
const css=`
//在此处复制css文件的内容
`;
导出默认css;
然后从“/style”导入样式并且您可以简单地将
样式
转换为
this.fullPost

const css = `
<style>
// copy your css file's content here
</style>
`;
export default css;