-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Dynamic scenes? #2911
Comments
Could you do an iter where you are defining your routing stack JSX and render them dynamically at app-load? Something like
I know this is light on details, just to demonstrate the concept. |
@asciifaceman - have you tried this yourself? It doesn't work - you cannot have dynamic scene render unless I'm missing something. All your scenes need to be defined in advance. |
Hmm, I had never tried it in the router stack but obviously it is a pattern for rendering other objects in Views so assumed it might work. I mean a kind of junk way you could handle it would be to have two sets of identically functioning tabs, one with 3 and one with 2, and you only push one or the other depending on the state. But thats a lot of copied code and is not elegant in any way. It might get you to point B for now. |
Dynamic scenes are not supported. |
I think that this is impossible, but nevertheless wanted to ask if one can define dynamic scenes?
I have a list with companies & once the user clicks on one of them - he is presented with the data for this company. We have a tab scene here. Unfortunately for me - some of the users on this screen need to see 3 or 2 tabs.
I don't know in advance if the user is able to see 2 or 3 tabs. I need to open the company - read the configuration for the user and present him with the correct UI. (this is different for every company)
Ideal would be to have a HOC that reads the necessary data (does a network request) and either renders 2 or 3 tabs. Since this doesn't seem to be possible and I'm dealing with a Tab component I decided to try a workaround.
For tabs we can pass a tabBarComponent. I wanted to reuse the one from react-navigation, but before rendering it remove the unnecessary tab. This unfortunately didn't work. Is there a way to modify the routes without breaking everything?
Since I was not able to modify the routes - I just recreated the react-navigation TabBarBottom and just added this line in the render function:
This is obviously the most stupid way to do this and I wonder if someone else faced the same issue and what did you do?
The text was updated successfully, but these errors were encountered: