-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
207 additions
and
85 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
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,64 @@ | ||
import React from "react"; | ||
import { ColorSchemeName, StyleSheet, ViewStyle } from "react-native"; | ||
import Reanimated, { AnimatedStyleProp } from "react-native-reanimated"; | ||
import { SvgProps } from "react-native-svg"; | ||
|
||
import _MessageTail from "../../../assets/message-tail.svg"; | ||
import { | ||
messageBubbleColor, | ||
myMessageBubbleColor, | ||
} from "../../../utils/colors"; | ||
|
||
class MessageTailComponent extends React.Component<SvgProps> { | ||
render() { | ||
return <_MessageTail {...this.props} />; | ||
} | ||
} | ||
|
||
const MessageTailAnimated = | ||
Reanimated.createAnimatedComponent(MessageTailComponent); | ||
|
||
interface MessageTailProps { | ||
fromMe: boolean; | ||
colorScheme: ColorSchemeName; | ||
hideBackground: boolean; | ||
style?: AnimatedStyleProp<ViewStyle>; | ||
} | ||
|
||
const MessageTail: React.FC<MessageTailProps> = ({ | ||
fromMe, | ||
colorScheme, | ||
hideBackground, | ||
style, | ||
}) => { | ||
return ( | ||
<MessageTailAnimated | ||
style={[styles.messageTail, fromMe && styles.messageTailMe, style]} | ||
fill={ | ||
hideBackground | ||
? "transparent" | ||
: fromMe | ||
? myMessageBubbleColor(colorScheme) | ||
: messageBubbleColor(colorScheme) | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
messageTail: { | ||
position: "absolute", | ||
left: -5, | ||
bottom: 0, | ||
width: 14, | ||
height: 21, | ||
zIndex: -1, | ||
}, | ||
messageTailMe: { | ||
left: "auto", | ||
right: -5, | ||
transform: [{ scaleX: -1 }], | ||
}, | ||
}); | ||
|
||
export default MessageTail; |
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
Oops, something went wrong.