1
1

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 5 years have passed since last update.

react-native-cameraのCameraがiPhoneSEから使えてiPhoneX から使えない話

Posted at

初めに

react-native-camera がexportしている CameraRNCamera のうち、
前者の Camera を使ったらiPhoneSEでは動くくせにiPhoneXでは動かない、という罠に嵌った。

やったこと

react-native-camera をnpmなりyarnなりでinstallし、いつもの手順でlinkさせ、↓ のようにしてアプリから呼び出すと、
default exportな方の CameraがiPhoneSEでは正しく使えるのにiPhoneXではnullになる、という怪現象に見舞われた。

import Camera, { RNCamera } from 'react-native-camera';

普段から表示崩れを意識してiPhoneSEばかりで動作確認していたので見事に嵌った。
シミュレータでも再現した。

対策

素直に新しい方の RNCamera を使うようにしたら問題なかった。
マイク不要なアプリなのに勝手にマイクのpermissionまで取られてしまうのが嫌で避けていたのだが、
captureAudio というpropertyをfalseにすればマイクのpermissionを回避できた。最初からちゃんと調べるべきだった。
そしてちゃんとiPhoneX以降の端末でも動作確認するべきだった。

終わりに

やはりReactNativeなんて使うもんではない (暴論)

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?