0
我有点困惑什么应该是一个简单的修复。我在版本0.27.2上运行了一个react-native项目,并且我的所有ios.js
文件都成功导入了样式表,除了一个。react-native:导入后无法找到变量样式表
进口看起来像这样:
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
ScrollView,
Text,
View,
} from 'react-native';
import {
Cell,
CustomCell,
Section,
TableView
} from 'react-native-tableview-simple';
const styles = Stylesheet.create({
container: {
backgroundColor: 'rgb(20,25,30)',
}
}
);
的Stylesheet.create({})
功能是最终导致错误Can't find variable Stylesheet
被抛出。但是,我在所有其他文件中使用相同的导入声明样式,并且这些样式没有错误地呈现样式。
这个文件中唯一不同的是已经声明了多个类。我是React新手,所以我不知道这是否会导致问题。有没有人有任何想法可能造成这种情况?
StyleSheet中的第二个s需要在'const styles = Stylesheet.create'中大写,应该是'StyleSheet.create' –
是的,它修复了它。哇,我不能相信我错过了,谢谢你。 – zavtra