【问题标题】:Module not found: Can't resolve './PlatformColorValueTypes'未找到模块:无法解析“./PlatformColorValueTypes”
【发布时间】:2021-10-15 10:12:50
【问题描述】:

我刚开始学习 React Native 并想添加 styleSheet 似乎不起作用,我正在尝试解决一个问题但我仍然卡住了请有人帮我解决这个问题。顺便说一句,我使用的是 react native。

控制台日志

浏览器结果:

下面是我的代码:

 const styles = StyleSheet.create({
      container: {
        flex: 1,
        marginTop: 100,
        paddingTop: 20,
        paddingBottom: 30,
        justifyContent: 'center',
        alignItems: 'center',
        
      },
      tinyPic: {
        width: 90,
        height: 90,
        top: -10
      },
    
      gauge: {
        position: 'absolute',
        width: 140,
        height: 140,
        alignItems: 'center',
        justifyContent: 'center',
      },
      
      label1: {
        position: 'absolute',
        top:15,
        right: '115%',
        padding: 4

      },
      label2: {
        position: 'absolute',
        top:15,
        left: '115%',
        padding: 4

      },
      label3: {
        position: 'absolute',
        top: 145,
        left: '95%',
        padding: 4

      }
   
    });

【问题讨论】:

  • 我们可以查看您的代码发生此错误的位置吗?看起来您使用样式表错误,但如果没有更多详细信息,社区将无法帮助您
  • @user3812411 我更新了你现在可以查看的问题
  • 你是如何导入样式表的?
  • @user3812411 import { StyleSheet } from 'react-native'
  • 你使用的是哪个版本的 React native?你使用的是 expo 还是 vanilla React-Native?

标签: javascript reactjs typescript react-native


【解决方案1】:

我通过更新 react-native 解决了这个问题:

npm i https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz --save -force

【讨论】:

    猜你喜欢
    • 2021-07-17
    • 2018-04-17
    • 2018-10-01
    • 2021-10-16
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    • 2022-08-05
    • 2021-09-21
    相关资源
    最近更新 更多