4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ReactNative with Expo で画像の縦横サイズを取得する

Posted at

はじめに

ReactNative with Expo 構成で画像の縦横比を取得するのが思いのほか簡単だったので共有します。

結論

Imageコンポーネントで画像サイズを取得するメソッドが提供されています。

sample.js
// Imageコンポーネントを取得
import {Image} from 'react-native';

// uriに任意の値を格納
Image.getSize(uri, (width, height) => {
  return({width, height})
});
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?