diff --git a/src/components/foregroundNotification/foregroundNotification.tsx b/src/components/foregroundNotification/foregroundNotification.tsx new file mode 100644 index 000000000..3c8378ace --- /dev/null +++ b/src/components/foregroundNotification/foregroundNotification.tsx @@ -0,0 +1,120 @@ +import React, { Component } from 'react'; +import { Animated, TouchableOpacity, Text, View } from 'react-native'; +import { IconButton } from '..'; +import UserAvatar from '../userAvatar'; + +// Styles +import styles from './styles'; + +interface Props { + text:string; +} + +const ForegroundNotification = ({text}:Props) => { + const position = {top:0}; + return ( + + + + + + + New Upvote + {text} + + + + + + + ) +} + +// class ToastNotification extends Component { + /* Props + * ------------------------------------------------ + * @prop { type } name - Description.... + */ + + // constructor(props) { + // super(props); + // this.state = { + // animatedValue: new Animated.Value(0), + // }; + // } + + // Component Functions + // _showToast() { + // const { duration } = this.props; + // const animatedValue = new Animated.Value(0); + + // this.setState({ animatedValue }); + + // Animated.timing(animatedValue, { toValue: 1, duration: 350 }).start(); + + // if (duration) { + // this.closeTimer = setTimeout(() => { + // this._hideToast(); + // }, duration); + // } + // } + + // _hideToast() { + // const { animatedValue } = this.state; + // const { onHide } = this.props; + + // Animated.timing(animatedValue, { toValue: 0.0, duration: 350 }).start(() => { + // if (onHide) { + // onHide(); + // } + // }); + + // if (this.closeTimer) { + // clearTimeout(this.closeTimer); + // } + // } + + // Component Life Cycles + // UNSAFE_componentWillMount() { + // this._showToast(); + // } + +// render() { +// const { text, textStyle, style, onPress, isTop } = this.props; +// const { animatedValue } = this.state; +// const outputRange = isTop ? [-50, 0] : [50, 0]; +// const y = animatedValue.interpolate({ +// inputRange: [0, 1], +// outputRange, +// }); +// const position = isTop ? { top: 100 } : { bottom: 100 }; + +// return ( +// onPress && onPress()}> +// +// {text} +// +// +// ); +// } +// } + +export default ForegroundNotification; diff --git a/src/components/foregroundNotification/index.ts b/src/components/foregroundNotification/index.ts new file mode 100644 index 000000000..b8dabdd06 --- /dev/null +++ b/src/components/foregroundNotification/index.ts @@ -0,0 +1,3 @@ +import ForegroundNotification from './foregroundNotification'; + +export { ForegroundNotification }; diff --git a/src/components/foregroundNotification/styles.ts b/src/components/foregroundNotification/styles.ts new file mode 100644 index 000000000..f07590aff --- /dev/null +++ b/src/components/foregroundNotification/styles.ts @@ -0,0 +1,29 @@ +import EStyleSheet from 'react-native-extended-stylesheet'; + +export default EStyleSheet.create({ + container: { + position: 'absolute', + zIndex: 9999, + justifyContent: 'flex-end', + alignSelf: 'center', + maxWidth: '$deviceWidth', + minWidth: '$deviceWidth / 1.9', + height: 100, + width:'100%', + backgroundColor: '$primaryDarkText', + margin: 5, + shadowOffset: { + height: 5, + }, + shadowColor: '#5f5f5fbf', + shadowOpacity: 0.3, + elevation: 3, + marginTop:-4 + }, + text: { + color: 'white', + fontWeight: 'bold', + fontSize: 14, + paddingRight: 10, + }, +}); diff --git a/src/components/index.js b/src/components/index.js index bec219993..a4aed9cdf 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -89,6 +89,7 @@ import { SpinGame } from './spinGame/spinGameView'; import { TabbedPosts } from './tabbedPosts'; import { ActionModal } from './actionModal'; import { CustomiseFiltersModal } from './customiseFiltersModal'; +import { ForegroundNotification } from './foregroundNotification'; // Basic UI Elements import { @@ -226,4 +227,5 @@ export { TabbedPosts, ActionModal, CustomiseFiltersModal, + ForegroundNotification, };