Create an animation framework that allows the user to define animations in the js side.
Current proposed API:
Navigation.push(this.props.componentId, {
name: 'navigation.playground.CustomTransitionDestination',
options: {
animations: {
push: {
enable: true, // Optional. Default: true
topBar: {
id: 'STACK_ID' // Id of the stack containing the TopBar to animate
},
bottomTabs: {
id: 'BOTTOM_TABS_ID'
},
content: {
y: {
from: 0,
to: 200,
duration: 150,
interpolation: 'decelerate',
startDelay: 100
},
alpha: {
from: 0,
to: 1,
duration: 150
}
}
},
pop: {},
showModal: {},
dismissModal: {}
}
}
})
[x] Animate topBar and bottomTabs
Support custom animations for the following commands:
[x] show/hide Modal #2790
Support for default app animation style in setDefaultOptions
[x] Animate topBar and bottomTabs
Support custom animations for the following commands:
[x] dismissModal
Support for default app animation style in setDefaultOptions
iOS too I suppose?
Quick question about this, I see that you can define push / pop / openModal etc animations from pushing to a page, this makes sense (especially defining a pop animation for a push).
More often than not though I could see the need to define the animation for just the screen I am transitioning to e.g always opening a modal in a certain way regardless of the screen I'm coming from:
Navigation.openModal(this.props.componentId, {
name: 'navigation.playground.MyFadeModal',
..animationProps
})
Will this be possible too ?
Yes. You'll be able to define keep the default animations provided by RNN, declare default animations once for each command (using Navigation.setDefaultOptions
api) and you'll also be able to override animations whenever you)
Is this working already? Is the API exactly as you described it above?
@rpmonteiro This feature is already available. You can find examples in the playground app (obviously remove the underscore from _animations
)
I think we need for setRoot too
+1 for having animations for setRoot
@chrisbenincasa @yusufyildirim You can customise setRoot
animation in startApp
animation. This will corrected soon to setRoot
as expected. Sorry for the confusion.
@guyca is there a way to slide the screen from left to right instead of bottom to up in android? v2
@ebouJ
Sure, Animate the x
value of content
. I haven't tried it myself but it should work 馃憤
I'd like to create an animation section in the documentation, would be nice if you contributed your slide animation to that 馃憤 馃檹
@guyca Will iOS support the startApp
/setRoot
animation?
Navigation.setDefaultOptions({
bottomTabs: {
animated: false or true
}
changed nothing, there always some kind of animation on going...
also, I've been integrating v2 for a week and v1 a few day ahead and at some point I've got a very nice animation that when tab was not selected, there was only the icon and once selected the icon has size changed and text displayed, I wonder if it has something to do with animationType i can't see no more in v2, or any other exemple i saw but can't put my finger on anymore, any clue will be very much appreciated
@ebouJ Where you able to accommplish what you wanted (and if so please do you mind sharing your code 馃槈)
Using v2, I wasn't able to change the android push/pop animation to something like the 'slide-horizontal' of v1
@Annihil could you provide a sample code? I cannot get it to work!
"react-native-navigation": "^2.0.2459"
"react": "16.3.1",
"react-native": "0.55.4",
Android
animations: {
startApp: { // Not working
y: {
from: 1000,
to: 0,
duration: 2500,
},
alpha: {
from: 0,
to: 1,
duration: 2400,
}
},
push: { // It works! Push with animation from right to left
content: {
x: {
from: 1000,
to: 0,
duration: 300,
},
alpha: {
from: 0.5,
to: 1,
duration: 300,
}
}
},
pop: { // Not working
content: {
x: {
from: 0,
to: 1000,
duration: 2300,
},
alpha: {
from: 1,
to: 0.5,
duration: 2300,
}
}
},
}
Android pop
animation as set like @iksent is not working for me in RNN v2.5862
but is working for me in RNN v2.620
. Also setRoot
(which I believe you would use instead of startApp
) animation is also working for me on Android in both versions.
As the animation feature is already implemented, there's no need for further discussion in this issue. If anyone encounters bugs or issues, please open a new issue.
Most helpful comment
changed nothing, there always some kind of animation on going...
also, I've been integrating v2 for a week and v1 a few day ahead and at some point I've got a very nice animation that when tab was not selected, there was only the icon and once selected the icon has size changed and text displayed, I wonder if it has something to do with animationType i can't see no more in v2, or any other exemple i saw but can't put my finger on anymore, any clue will be very much appreciated