// @flow import * as React from 'react'; import {View} from "react-native"; import {TouchableRipple, withTheme} from 'react-native-paper'; import {MaterialCommunityIcons} from "@expo/vector-icons"; import * as Animatable from "react-native-animatable"; type Props = { focused: boolean, color: string, label: string, icon: string, onPress: Function, onLongPress: Function, theme: Object, extraData: any, } const AnimatedIcon = Animatable.createAnimatableComponent(MaterialCommunityIcons); /** * Abstraction layer for Agenda component, using custom configuration */ class TabIcon extends React.Component { firstRender: boolean; constructor(props) { super(props); Animatable.initializeRegistryWithDefinitions({ focusIn: { "0": { scale: 1, translateY: 0 }, "0.9": { scale: 1.5, translateY: 7 }, "1": { scale: 1.4, translateY: 6 }, }, focusOut: { "0": { scale: 1.4, translateY: 6 }, "1": { scale: 1, translateY: 0 }, } }); this.firstRender = true; } componentDidMount() { this.firstRender = false; } shouldComponentUpdate(nextProps: Props): boolean { return (nextProps.focused !== this.props.focused) || (nextProps.theme.dark !== this.props.theme.dark) || (nextProps.extraData !== this.props.extraData); } render(): React$Node { const props = this.props; return ( {props.label} ); } } export default withTheme(TabIcon);