我react-native-scoped-storage用于獲取檔案夾中的所有檔案。我正在獲取以下 URI 格式的影像:
"uri": "content://com.android.externalstorage.documents/tree/primary:Android/media/com.whatsapp/WhatsApp/media/.Statuses/document/primary:Android/media/com.whatsapp/WhatsApp/media/.Statuses/images.jpeg"
如何在組件中渲染此影像?如果有人能為我提供解決方案,我將不勝感激。
我是新來的反應本地人。謝謝你。
uj5u.com熱心網友回復:
看起來您正在從 URI 加載影像。您可以在檔案中檢查它 ht??tps ://reactnative.dev/docs/images#uri-data-images
// include at least width and height!
<Image
style={{
width: 51,
height: 51,
resizeMode: 'contain'
}}
source={{
uri: 'content://com.android.externalstorage.documents/tree/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2Fmedia%2F.Statuses/document/primary%3AAndroid%2Fmedia%2Fcom.whatsapp%2FWhatsApp%2Fmedia%2F.Statuses%2Fimages.jpeg'
}}
/>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/521704.html
標籤:安卓反应反应式
上一篇:如何在json檔案中撰寫操作?
