Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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
React native “反应自然”;fontFamily不是有效的样式属性;_React Native_Expo - Fatal编程技术网

React native “反应自然”;fontFamily不是有效的样式属性;

React native “反应自然”;fontFamily不是有效的样式属性;,react-native,expo,React Native,Expo,我今天在react native/expo项目中遇到了这个错误。我尝试过清除缓存和重新安装软件包等 My package.json如下所示: { "name": "empty-project-template", "main": "node_modules/expo/AppEntry.js", "private": true, "scripts": { "start": "expo start", "android": "expo start --android"

我今天在react native/expo项目中遇到了这个错误。我尝试过清除缓存和重新安装软件包等

My package.json如下所示:

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject"
  },
  "dependencies": {
    "@firebase/app": "^0.3.4",
    "babel": "^6.23.0",
    "babel-plugin-module-resolver": "^3.1.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-expo": "^5.0.0",
    "eslint": "^5.8.0",
    "expo": "^31.0.0",
    "expo-cli": "^2.2.5",
    "firebase": "^5.5.7",
    "for": "^0.1.0",
    "lodash": "^4.17.11",
    "me": "^0.3.0",
    "moment": "^2.22.2",
    "react": "^16.6.0",
    "react-native": "^0.57.4",
    "react-native-blur": "^3.2.2",
    "react-native-elements": "^0.19.1",
    "react-native-keyboard-aware-scrollview": "^2.0.0",
    "react-native-material-textfield": "^0.12.0",
    "react-native-platform-touchable": "^1.1.1",
    "react-native-scrollable-tab-view": "^0.9.0",
    "react-native-snap-carousel": "^3.7.5",
    "react-native-swiper": "^1.5.13",
    "react-native-tab-view": "^1.2.0",
    "react-native-vector-icons": "^6.0.2",
    "react-navigation": "^2.18.2",
    "react-redux": "^5.1.0",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.3.0",
    "windows": "0.0.8",
    "worked": "^0.0.2",
    "ws": "^6.1.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.1.2",
    "@babel/core": "^7.1.2",
    "@babel/preset-env": "^7.1.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-react": "^6.24.1",
    "redux": "^4.0.1",
    "remote-redux-devtools": "^0.5.13"
  },
  "resolutions": {
    "babel-core": "7.0.0-bridge.0"
  }
}
我的字体系列用例类似于以下内容:

export default StyleSheet.create({
    container: {
      borderRadius: 4,
      borderWidth: 0.5,
      borderColor: '#d6d7da',
    },
    title: {
      textAlign: 'center',
      fontSize: 30,
      marginBottom: 0,
      fontFamily: 'mainFontBold',
    },
其中mainFontBold是加载到my app.js中的自定义字体。这在今天之前一直运行良好,我不确定是什么原因导致了这种变化

我不明白为什么它会给我这个错误?expo文档明确说明fontFamily是文本的有效样式属性,请参见:


有没有人知道我可以如何解决这个问题,或者是什么原因导致了这个错误?谢谢

我在修改package.json后遇到了同样的问题。 我所做的修改是从:

dependencies: {
    ...,
   "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
}
致:

我不完全确定,但世博会似乎使用了一个特定的本地版本。
有关此主题的更多文档,请访问:

使用较低版本的
react native

"react-native": "0.57.1"

本期已发行。(尚未发布)

您的
标题
样式位于
元素上?@oma是。我已经确保fontFamily的所有款式都只在elementsAwesome上!这解决了我的问题。我从来没有想到这个错误会与RN版本有关哈哈,是的,这是一个令人头疼的回溯步骤。我还遇到了react native与expo链接(用于使用本机组件)的一些问题。快乐编码!:)
"react-native": "0.57.1"