Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal not showing working with scenes #639

Closed
dani-cabal opened this issue Apr 12, 2023 · 7 comments
Closed

Modal not showing working with scenes #639

dani-cabal opened this issue Apr 12, 2023 · 7 comments
Labels
feature request New feature or request

Comments

@dani-cabal
Copy link

I've recently moved my app to scenes due to CarPlay implementations. No changes have been made in date picker, so I think my problem is related to scenes (or my phone scene implementation). I must say I have no experience with Swift or Objective C, so it's likely that my scene implementation is incompatible at some point with modal view, but I'm not sure about that.

Searching through iOS code of the library I've found this:

// Finding the top view controller which is neccessary to be able to show the picker from within modal
        self->_topViewController = rootViewController;
        while (self->_topViewController.presentedViewController){
            self->_topViewController = self->_topViewController.presentedViewController;
        }
        [self->_topViewController presentViewController:alertController animated:YES completion:nil];

My scene looks this way:

class PhoneSceneDelegate: UIResponder, UIWindowSceneDelegate {
  var window: UIWindow?
  func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) -> Void {
    guard let appDelegate = (UIApplication.shared.delegate as? AppDelegate) else { return }
    guard let windowScene = (scene as? UIWindowScene) else { return }

    let rootViewController = UIViewController()
    rootViewController.view = appDelegate.rootView;

    let window = UIWindow(windowScene: windowScene)
    window.rootViewController = rootViewController
    self.window = window
    window.makeKeyAndVisible()
  }
}

Smartphone:

  • OS: iOS 15.4 (emulator) iOS 16.2 (phone)
  • React Native version 0.66.5
  • react-native-date-picker version 4.2.10
@henninghall
Copy link
Owner

Hi! Could you provide an example repo where this issue is reproducable?

@dani-cabal
Copy link
Author

Hi! Thanks for your reply.

I created a new repository with a demo app: https://github.com/dcabal/datepicker-demo

In branch develop there's a working example with datepicker's modal opening correctly. To run it, as usual:

  • yarn install
  • cd ios && pod install
  • yarn ios

In branch feature/scenes there's a reproduction of my issue. This branch has all CarPlay stuff with scenes and an AppDelegate in Swift as described here birkir/react-native-carplay#85

You have to install all dependencies and pods in scenes branch, as develop branch is not configured for CarPlay

Thanks a lot

@dani-cabal
Copy link
Author

@henninghall did you have the time to review this?

@Robby2023
Copy link

We're having this exact same issue in our App, Did you find any solution @dani-cabal? Is there any workaround @henninghall?

@Robby2023
Copy link

@henninghall @dani-cabal any update regarding this topic?

@dani-cabal
Copy link
Author

Nothing here @Robby2023

@henninghall
Copy link
Owner

Thanks for the demo app, I won't be able to prioritize this at the moment. Please give this issue a thumbs up if this is bothering you.

If anyone wants to investigate this, PRs are always welcome and let me know if you have any questions about the codebase.

@henninghall henninghall added the feature request New feature or request label Dec 18, 2023
Repository owner locked and limited conversation to collaborators May 17, 2024
@henninghall henninghall converted this issue into discussion #815 May 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants