oblador / react-native-lightbox

Images etc in Full Screen Lightbox Popovers for React Native
MIT License
2.82k stars 502 forks source link

Modal crash in iOS #112

Open toneyavuz opened 5 years ago

toneyavuz commented 5 years ago

my app orientations only landspace

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.

-[RCTModalHostViewController supportedInterfaceOrientations] RCTModalHostViewController.m:66 -[UIViewController supportedInterfaceOrientations] -[UIViewController _preferredInterfaceOrientationGivenStatusBarAndDeviceAndOrientation:] -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] -[_UIFullscreenPresentationController _adjustOrientationIfNecessaryInWindow:forViewController:preservingViewController:] -[UIPresentationController _presentWithAnimationController:interactionController:target:didEndSelector:] -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] -[UIViewController _presentViewController:withAnimationController:completion:] 63-[UIViewController _presentViewController:animated:completion:]_block_invoke_2 +[UIView(Animation) performWithoutAnimation:] 63-[UIViewController _presentViewController:animated:completion:]_block_invoke -[UIViewController _performCoordinatedPresentOrDismiss:animated:] -[UIViewController _presentViewController:animated:completion:] -[UIViewController presentViewController:animated:completion:] -[RCTModalHostViewManager presentModalHostView:withViewController:animated:] -[RCTModalHostView didMoveToWindow] -[UIView(Internal) _didMoveFromWindow:toWindow:] __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke -[NSISEngine withBehaviors:performModifications:] -[UIView(Hierarchy) _postMovedFromSuperview:] -[UIView(Internal) _addSubview:positioned:relativeTo:] -[UIView(React) didUpdateReactSubviews] -[RCTView didUpdateReactSubviews] 48-[RCTUIManager _dispatchChildrenDidChangeEvents]_block_invoke 44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke 44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.544 __RCTExecuteOnMainQueue_block_invoke _dispatch_call_block_and_release _dispatch_client_callout _dispatch_main_queue_callback_4CF CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal UIApplicationMain main start

Path: node_modules/react-native-lightbox/LightboxOverlay.js i added supportedOrientations={['landscape']} to Modal. problem is resolve.

<Modal visible={isOpen} transparent={true} onRequestClose={() => this.close()}>
        {background}
        {content}
        {header}
      </Modal>
toneyavuz commented 5 years ago

?

m-inan commented 5 years ago

I think you need to add orientation for your app. You can add it info.plist. You can review this

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
gtebbutt commented 4 years ago

This is a blocking issue for apps/games where the design only supports landscape orientation (i.e. situations where adding UIInterfaceOrientationPortrait is not possible because it would break the rest of the app layout).

If the lightbox had a landscapeOnly prop or similar, that could pass the correct supportedOrientations prop to the underlying Modal component and prevent the crash.