- Hands-On Design Patterns with React Native
- Mateusz Grzesiukiewicz
- 119字
- 2021-08-13 15:12:59
The Image component
The next component that you will often use is the Image component. Let's extend our task list with the React logo. After each task, we will show a .png image of the React logo:
// Chapter 2_View patterns/ Example 5/src /Task.js
// ...
<Image
// styles just to make it smaller in the example
style={{width: 100, height: 100}}
source={require("./react.png")}
/>
// ...
Please note that not every image type is supported right now. For instance, SVG images will need a separate library to work.
You can check out the props that the Image component consumes in the official documentation here: https://facebook.github.io/react-native/docs/image. You will find useful props such as loadingIndicatorSource here—this is an image that is shown while a big source image is loading.
推薦閱讀
- Google Flutter Mobile Development Quick Start Guide
- 數據庫程序員面試筆試真題與解析
- iOS 9 Game Development Essentials
- Android NDK Beginner’s Guide
- STM32F0實戰:基于HAL庫開發
- 深入RabbitMQ
- Emgu CV Essentials
- 大學計算機基礎實驗指導
- Appcelerator Titanium:Patterns and Best Practices
- Getting Started with Electronic Projects
- Drupal 8 Development:Beginner's Guide(Second Edition)
- Getting Started with hapi.js
- 前端架構設計
- 智能優化算法與MATLAB編程實踐
- Erlang編程指南