garganurag893 / react-native-phone-number-input

React Native component for phone number.
MIT License
372 stars 212 forks source link

Crash: Modal was presented with 0x2 orientations #156

Open sivantha96 opened 5 months ago

sivantha96 commented 5 months ago

I got this error Modal was presented with 0x2 orientations mask but the application only supports 0x18. Add more interface orientations to your app's Info. plist to fix this. NOTE: This will crash in non-dev mode.

So, I used patch-package to patch react-native-phone-number-input@2.1.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-phone-number-input/lib/index.js b/node_modules/react-native-phone-number-input/lib/index.js
index b89c388..ddd341e 100644
--- a/node_modules/react-native-phone-number-input/lib/index.js
+++ b/node_modules/react-native-phone-number-input/lib/index.js
@@ -194,6 +194,9 @@ export default class PhoneInput extends PureComponent {
               renderFlagButton={this.renderFlagButton}
               onClose={() => this.setState({ modalVisible: false })}
               {...countryPickerProps}
+              modalProps={{
+                supportedOrientations: ["landscape", 'portrait'],
+              }}
             />
             {code && layout === "second" && (
               <Text

This issue body was partially generated by patch-package.