-
Notifications
You must be signed in to change notification settings - Fork 24k
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
How to make a full screen modal ? #688
Comments
@kocyigityunus - have a look at react-native-modal and let me know if that doesn't answer your question, I'll be happy to answer! |
i allready looked at it. when i tried to use it in or with compoenent. NavigatorIOS is being top of the my view with following style. this style is just like you use in modal.
as you can see in the photo. Navigator bar on top. |
@vjeux - any insight into how we can absolute position a component to overlay |
Yeah, this is unfortunate, internally we had to implement the modal component in objective-c, so that it can be on-top of NavigatorIOS and the status bar. cc @sahrens who built it |
That makes sense, I'll have a go at fixing that. Thanks @vjeux |
Having a bit of a hard time figuring out the right away to do this, any tips @sahrens? |
maybe this can help : https://github.com/Kureev/react-native-navbar |
We have tons of full screen modals with custom animations with the JS implemented navigator. (See the F8 app for an example). Would that work for you? |
@jordwalke - that makes sense - I like the JS navigator personally, I was just thinking that it would be useful for others who choose to use |
@kocyigityunus it'll help, if you'll migrate from |
One thing you can do is to expose a native API to create a new UIWindow and render the modal content views into that. One way to do this is with a custom native modal component that creates the UIWindow in reactAddSubview and stuffs the view into their instead of as a subview of it's self like it would be default. What happens if you put your react-native-modal component outside of (e.g. as a sibling to) the NavigatorIOS component?
|
Ignore my last paragraph - I missed your example using the react-native-modal. |
@sahrens - that's a neat idea re: overriding |
Would be great if @sahrens could share some code here! |
i tried to have a es6 way to do that. but i think NavigatorIOS component is not keeping it's state. i am constructing it only once but result is the same. as you can see :
|
@sahrens - this worked, but when I render the subviews in the new window they stop responding to any click events, and cmd+r no longer refreshes, any idea? |
The window is probably affecting the responder chain. Is your modal window the key window? |
@ide - I tried both with and without [_overlayWindow makeKeyAndVisible]; _overlayWindow.userInteractionEnabled = YES;
_overlayWindow.hidden = NO; |
@ide - without being key, cmd+r works but presses won't. |
Ah yes, you'll need to attach the RCTTouchHander to the modal...something like
Sorry, I wish I had time to clean up what we have internally sooner, but it relies on some FB infra stuff :(
|
Thanks @sahrens 😄
No problem, this is an enjoyable learning exercise |
@sahrens - so I have this mostly working, I just can't figure out how to properly dispose of the modal UIWindow and give touch control back to the main UIWindow. The only thing that I have found to work is |
@sahrens - Got this working, the problem was that the component is initialized twice by React - once as a base component without props, and immediately after that once more and the props are applied. The problem was that I was creating the @kocyigityunus - You can use |
Awesome work! It's about tradeoffs, and the approach you've taken has benefits as well: I believe that if you embed a |
congs @brentvatne great job. |
The original motivation was to work with NavigatorIOS, right?
|
@jordwalke - Agreed, definitely a matter of trade-offs here. Will definitely get the same thing working on Android when the time comes! @sahrens - yup, but this could applicable to overlay any native component on @kocyigityunus - can we close this issue now? |
Closing 😄 |
i am trying to make a full screen modal in a at the root of the app like in the UIExplorer Example. but when i want to close the modal, it's always starting with the "InitialComponent" of the
what i solve this :
1 ) instead of showing it on the root i set styles " position : absolute, top, right = 0 etc. ". but this didn't work.
2 ) instead of returning an NavigatorIOS element in render. i tried to create a NavigatorIOS element with React.createElement and passing it to render method. but i couldn't get state of the parent.
i think that must be a better way
The text was updated successfully, but these errors were encountered: