ajsmth / earhart-shared-element

react native + routing + shared-element
MIT License
1 stars 0 forks source link

Could this work within an earhart stack? #1

Closed kyle-ssg closed 4 years ago

kyle-ssg commented 4 years ago

This looks awesome, especially since you can provide a transition config. Though I notice that this does not work as soon as it's within a Stack, I'm guessing this may well be an unavoidable constraint?

Working:

                 <Navigator>
                            <SharedElements>
                                    <Route path='/2'>
                                        <Scene1 path="/3" />
                                    </Route>

                                    <Route path='/3'>
                                        <Scene2 path="/2" />
                                    </Route>
                            </SharedElements>
                    </Navigator>

Not working

                 <Navigator>
                            <SharedElements>
                                <Stack>
                                    <Route path='/2'>
                                        <Scene1 path="/3" />
                                    </Route>

                                    <Route path='/3'>
                                        <Scene2 path="/2" />
                                    </Route>
                                </Stack>
                            </SharedElements>
                    </Navigator>
ajsmth commented 4 years ago

this was something i initially thought was unrealistic, but rn-shared-element has made some updates recently that should make this possible.

i initially considered this package to be another type of screen container, but i think the API you outlined above in the not working section is the ideal one, i was thinking along those lines as well.

kyle-ssg commented 4 years ago

Cool! I'll close this for now then was more curious than anything

ajsmth commented 4 years ago

Following up on this - we're limited by the children prop here so it's not possible to use both stack and shared element at this time. If there were a better way to track and manipulate nested children it would be a great addition.