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