-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4070 from rdjuric/IOUFlowAnimations
Animations for the IOU flow
- Loading branch information
Showing
8 changed files
with
134 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import * as Animatable from 'react-native-animatable'; | ||
import CONST from '../CONST'; | ||
|
||
const propTypes = { | ||
/** Children to wrap in AnimatedStep. */ | ||
children: PropTypes.node.isRequired, | ||
|
||
/** Styles to be assigned to Container */ | ||
style: PropTypes.arrayOf(PropTypes.object), | ||
|
||
/** Whether we're animating the step in or out */ | ||
direction: PropTypes.string, | ||
}; | ||
|
||
const defaultProps = { | ||
direction: 'in', | ||
style: [], | ||
}; | ||
|
||
const AnimatedStep = (props) => { | ||
function getAnimationStyle(direction) { | ||
let animationStyle; | ||
|
||
if (direction === 'in') { | ||
animationStyle = 'slideInRight'; | ||
} else if (direction === 'out') { | ||
animationStyle = 'slideInLeft'; | ||
} | ||
return animationStyle; | ||
} | ||
|
||
return ( | ||
<Animatable.View | ||
duration={CONST.ANIMATED_TRANSITION} | ||
animation={getAnimationStyle(props.direction)} | ||
useNativeDriver | ||
style={[...props.style]} | ||
> | ||
{props.children} | ||
</Animatable.View> | ||
); | ||
}; | ||
|
||
AnimatedStep.propTypes = propTypes; | ||
AnimatedStep.defaultProps = defaultProps; | ||
AnimatedStep.displayName = 'AnimatedStep'; | ||
export default AnimatedStep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters