Skip to content
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

Hide element in last screen programmatically #13

Closed
hirbod opened this issue Dec 28, 2019 · 3 comments
Closed

Hide element in last screen programmatically #13

hirbod opened this issue Dec 28, 2019 · 3 comments

Comments

@hirbod
Copy link

hirbod commented Dec 28, 2019

Hi @IjzerenHein,

I've spent a lot of time with this bindings and your package (using expo).
I wanted to achieve a similar shared transition on iOS as WhatsApp does.

I am using a special Stack with a transparent background. My view has a white background which I wan't to interpolate while dragging the element using PanGesture from RNGH. Everything is working finally as I want it (only the borderRadius animation is broken, already posted an issue).

Anyway, since I am interpolating the background, I can see, that the shared element in the routerStack is already visible again, and as soon as I release my finger, it gets hidden.

This is great when using the default back gesture, but not when I interpolate (since this will trigger the animation).

Is there a way to programmatically trigger "hide the element on the last screen"?
To make it more clear, I've recorded a video.

https://youtu.be/h782F9Q-7D0

I am demonstrating multiple cases, which all work fine but the last not. (U see, the image is there when I release the finger and disappears and appears again). This wasn't a issue without the navigator card being transparent, but it has to be this way.

const userStack = createSharedElementStackNavigator(
    createStackNavigator, {
        User: {screen: User},
        UserImage: {screen: UserImage},
    },
    {
        ...StackNavigatorOptions,
        transparentCard: true,
        cardStyle: {
            backgroundColor: "transparent"
        },
        transitionConfig: () => springyFadeIn(),
    },
);
@hirbod
Copy link
Author

hirbod commented Dec 29, 2019

So I think that all the magic happens here:

You hide the element behind the current view when willFocus navigation event is triggered. I only need to find an option to trigger willFocus manually (and revert it if the user cancels). Is there any way I could do that currently?

@IjzerenHein
Copy link
Owner

Perhaps taking a look at Williams video will help:
https://www.youtube.com/watch?v=83GNiMp-qq0

@ethanyuwang
Copy link

has borderRadius animation being fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants