react / react/react-native

[Android] Vector images from native resources is not working

オープン
#27,502 コメント 18 件 リアクション 10 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #45354 @Abbondanzo による — マージされずにクローズ
Bug Component: Image Never gets stale Platform: Android
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Based on React Native documentation, we should be able to fetch images from native resources.
This is works great on iOS, but in Android you can't load vector images using uri.

React Native version:

react-native: 0.61.5

Steps To Reproduce

Placing vector image named image.xml in drawable folder and using this code, is not working:
<Image width={100} height={100} source={{ uri: 'image' }} style={{ width: 100, height: 100 }} />

Placing the vector image in assets folder and using this code, is not working either:
<Image width={100} height={100} source={{ uri: 'asset:/image.xml' }} style={{ width: 100, height: 100 }} />

Note that placing .jpg or .png images is working without any issues.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、文書化されているネイティブリソース URI の動作と、React Native の Image パスにおける Android vector drawable の処理を比較します。React Native 0.61.5 について説明されている drawable と asset:/image.xml のケースを再現し、その後、ベクターリソースが動作している JPG および PNG のケースと一貫して読み込まれることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, react-native
領域
mobile
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。