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
<ColumnChart | |
height={200} | |
width={300} | |
data={data} | |
onPress={onPress} | |
/> |
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
import { TranslateYAndOpacity } from 'react-native-motion'; | |
class ToolbarTitle extends PureComponent { | |
render() { | |
return ( | |
<TranslateYAndOpacity duration={250}> | |
<View> | |
// ... | |
</View> | |
</TranslateYAndOpacity> |
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
class TranslateYAndOpacity extends PureComponent { | |
constructor(props) { | |
// ... | |
this.state = { | |
opacityValue: new Animated.Value(opacityMin), | |
translateYValue: new Animated.Value(translateYMin), | |
}; | |
// ... | |
} | |
componentDidMount() { |
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
/** | |
* Removes non alphanumeric characters. | |
*/ | |
function normalize(phrase) { | |
if (!phrase) { | |
return ''; | |
} | |
return phrase.replace(/[\W_]/g, '').toLowerCase(); | |
} |
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
/** | |
* Removes non alphanumeric characters. | |
*/ | |
function normalize(phrase) { | |
if (!phrase) { | |
return ''; | |
} | |
return phrase.replace(/[\W_]/g, '').toLowerCase(); | |
} |
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
/** | |
* Removes non alphanumeric characters. | |
*/ | |
function normalize(phrase) { | |
if (!phrase) { | |
return ''; | |
} | |
return phrase.replace(/[\W_]/g, '').toLowerCase(); | |
} |
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
onPressOut = () => { | |
// When user use onPress all animation happens in onPress method. But when user use long | |
// press. We displaye background layer in onLongPress and then we need to animate ripple | |
// effect that is done here. | |
Animated.parallel([ | |
// Hide opacity background layer, slowly. It has to be done later than ripple | |
// effect | |
Animated.timing(this.state.opacityBackgroundValue, { | |
toValue: 0, | |
duration: 500 + diameter, |
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
onLongPress = () => { | |
// Animation of long press is slightly different than onPress animation | |
Animated.timing(this.state.opacityBackgroundValue, { | |
toValue: maxOpacity / 2, | |
duration: 700, | |
}).start(); | |
} |