【问题标题】:How to use loadingIndicatorSource component in react native如何在本机反应中使用 loadingIndicatorSource 组件
【发布时间】:2022-08-15 20:57:19
【问题描述】:

我在 React Native 的官方网站上看到了这个组件。但是https://reactnative.dev/docs/image#loadingindicatorsource 上没有任何示例。我只知道这是什么 谁能告诉我如何在 react native 上使用这个组件?

    标签: react-native


    【解决方案1】:

    我发现使用它的一种方法是直接传递一个组件,比如 ActivityIndi​​cator

    <Image loadingIndicatorSource={<YOUR LOADING COMPONENT/>} />
    

    【讨论】:

    • 可以给我看一个正常的例子吗?
    【解决方案2】:
    <Image {...props} loadingIndicatorSource={URI} />
    

    上面的陈述是什么意思?

    1. {...props} - 是您的自定义道具,例如 sourcestyle
    2. URI - 是URI图像,将在source props 中指定的图像加载时显示。`

      例子:

      • &lt;Image source={{uri: URI}} loadingIndicatorSource={require('loadingIndicatorSource={require('@assets/images/loading.jpeg')}')}
      • <Image source={{uri: URI}} loadingIndicatorSource={{uri: 'https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Emotes-face-smile-icon.png'}} />

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-18
      • 2022-09-27
      • 1970-01-01
      • 1970-01-01
      • 2021-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多