If a screen is pushed with a custom transition, the memory isn't released when it's popped. Pushing and popping the same screen continues to add to the stack and consumes more memory.
Updated onClickPush() function in playground screen "PushedScreen.js" and tracked the stack in react dev tools.
async onClickPush() {
await Navigation.push(this.props.componentId, {
component: {
name: "navigation.playground.PushedScreen",
passProps: {
stackPosition: this.getStackPosition() + 1,
previousScreenIds: _.concat(
[],
this.props.previousScreenIds || [],
this.props.componentId,
),
},
options: {
topBar: {
title: {
text: `Pushed ${this.getStackPosition() + 1}`,
},
},
customTransition: { animations: [], duration: 0 },
},
},
});
}
Are we maintaining any strong references to the VC anywhere? pop calls to remove the VC from the store.
Would it be possible to add a styling option "animated: false" for pushing a new screen or modal? I built my own shared element transition (because customTransition wasn't working for components in a list) and just want the new screen to appear instantly after my animation is complete.
You can disable animations in options.
Navigation.push(this.props.componentId, {
component: {
name: 'myScreen',
options: {
animations: {
push: {
enable: false
}
}
}
}
});
and how would that look for Navigation.pop @guyca ?
I just documented the animations options - There's much to improve, i'm sure some things are not clear - if you have any suggestions for improvements please PR 馃憤
Navigation.push(this.props.componentId, {
component: {
name: 'myScreen',
options: {
animations: {
pop: {
enable: false
}
}
}
}
});
@guyca I don't get it, how do you pop without animation?
Navigation.pop(this.props.componentId, {
component: {
options: {
animations: {
pop: {
enable: false
}
}
}
}
});
Doesn't work.
Interesting thing, for me it works with enabled
, not enable
!
Navigation.push(this.props.componentId, {
component: {
name: 'myScreen',
options: {
animations: {
push: {
enabled: false
}
}
}
}
});
Most helpful comment
I just documented the animations options - There's much to improve, i'm sure some things are not clear - if you have any suggestions for improvements please PR 馃憤