react-native-iphone-x-helper icon indicating copy to clipboard operation
react-native-iphone-x-helper copied to clipboard

iPhone 12 Pro Max not being recognized

Open castrolem opened this issue 4 years ago • 8 comments

Issue

We have an app that has support for all iPhone sizes, and we use the plug in to set a consistent marginTop layout from the notch on one of our UI components.

How to reproduce

  • Install npm package on a create-react-native-app project.
  • console.log(isIphoneX()) on App.js.
  • Run a new iPhone 12 Pro Max simulator.
  • console output is always false.

castrolem avatar Nov 23 '20 12:11 castrolem

Seeing the same thing + 1

osikes avatar Dec 02 '20 15:12 osikes

Are you using the latest 1.3.0?

ptelad avatar Dec 02 '20 15:12 ptelad

Are you using the latest 1.3.0?

Yup, using ^1.3.1

castrolem avatar Dec 02 '20 16:12 castrolem

What value are you getting from Dimensions.get('window').width and height?

ptelad avatar Dec 02 '20 16:12 ptelad

@ptelad just tested, {height: 926, width: 428 } and asked around about it when we upgraded to 1.3.1 that fixed the issue for us. (sorry, another team in my company ended up taking this one)

castrolem avatar Dec 02 '20 17:12 castrolem

1.3.1 resolved for me as well.

osikes avatar Dec 03 '20 21:12 osikes

@castrolem The original comment points this out as a problem but semantically, based on the library name, this would be correct behavior. The iPhone 12 is not an iPhone X. This gave me a lot of confusion just now while updating my orgs legacy app. Maybe you could consider adding a custom isIphone12() function?

daaashleywch avatar Mar 12 '21 20:03 daaashleywch

@daaashleywch I agree, the name of the library hasn't aged well, but the description of the library is accurate

A library to help you design your react-native app for notched iPhones

And the 12 Pro Max is a notched iPhone, previous versions (before 1.3.1) worked with other 12 versions, just the Pro Max had the issue, no longer an issue after 1.3.1. 👍

castrolem avatar Mar 15 '21 12:03 castrolem