@@ -7,6 +7,7 @@ import { type AuxiliaryPreviewConfig, ContextMenuView, type MenuElementConfig, t
77
88
99const SHOULD_USE_NEW_CONFIG = true ;
10+ const MESSAGE_BUBBLE_BORDER_RADIUS = 10 ;
1011
1112// Repro for issue:
1213// https://github.com/dominicstop/react-native-ios-context-menu/issues/47
@@ -283,7 +284,7 @@ const MessageBubble = (props: {
283284
284285 const hasReaction = ( currentReaction != null ) ;
285286
286- const menuRef = React . useRef < ContextMenuView | undefined > ( ) ;
287+ const menuRef = React . useRef < ContextMenuView | null > ( ) ;
287288
288289 const animatedReactionOpacity =
289290 React . useRef ( new Animated . Value ( 0 ) ) . current ;
@@ -315,7 +316,6 @@ const MessageBubble = (props: {
315316 } ;
316317
317318 const startCollapse = ( ) => {
318-
319319 return Promise . all ( [
320320 new Promise ( resolve => {
321321 Animated . timing ( animatedMessageContainerMarginTop , {
@@ -347,7 +347,7 @@ const MessageBubble = (props: {
347347 </ Animated . View >
348348 ) ;
349349
350- const AuxPreviewConfig : AuxiliaryPreviewConfigBackwardsCompatible = ( SHOULD_USE_NEW_CONFIG ? {
350+ const auxPreviewConfig : AuxiliaryPreviewConfigBackwardsCompatible = ( SHOULD_USE_NEW_CONFIG ? {
351351 verticalAnchorPosition : 'automatic' ,
352352 horizontalAlignment : ( props . message . isSender
353353 ? 'targetTrailing'
@@ -386,13 +386,10 @@ const MessageBubble = (props: {
386386 } ] } >
387387 { ( hasReaction && props . message . isSender ) && reactionIndicator }
388388 < ContextMenuView
389- ref = { menuRef }
390- style = { [ styles . messageBubbleContainer , {
391- backgroundColor : ( props . message . isSender
392- ? Colors . PURPLE [ 100 ]
393- : Colors . ORANGE [ 100 ]
394- ) ,
395- } ] }
389+ ref = { ref => menuRef . current = ref }
390+ style = { [
391+ styles . messageBubbleContainer
392+ ] }
396393 lazyPreview = { true }
397394 menuConfig = { {
398395 menuTitle : '' ,
@@ -403,7 +400,10 @@ const MessageBubble = (props: {
403400 MENU_CONFIGS . delete ,
404401 ] ,
405402 } }
406- auxiliaryPreviewConfig = { AuxPreviewConfig }
403+ previewConfig = { {
404+ borderRadius : MESSAGE_BUBBLE_BORDER_RADIUS ,
405+ } }
406+ auxiliaryPreviewConfig = { auxPreviewConfig }
407407 renderAuxiliaryPreview = { ( ) => (
408408 < View style = { styles . auxRootContainer } >
409409 { REACTIONS_KEYS . map ( ( reactionKey , index ) => (
@@ -467,9 +467,19 @@ const MessageBubble = (props: {
467467 ( currentReaction != null ) && await startFadeIn ( ) ;
468468 } }
469469 >
470- < Text style = { styles . messageTextLabel } >
471- { props . message . messageText }
472- </ Text >
470+ < View style = { [
471+ styles . messageBubbleContent ,
472+ {
473+ backgroundColor : ( props . message . isSender
474+ ? Colors . PURPLE [ 100 ]
475+ : Colors . ORANGE [ 100 ]
476+ ) ,
477+ }
478+ ] } >
479+ < Text style = { styles . messageTextLabel } >
480+ { props . message . messageText }
481+ </ Text >
482+ </ View >
473483 </ ContextMenuView >
474484 { ( hasReaction && ! props . message . isSender ) && reactionIndicator }
475485 </ Animated . View >
@@ -605,10 +615,13 @@ const styles = StyleSheet.create({
605615 marginBottom : 10 ,
606616 } ,
607617 messageBubbleContainer : {
618+ maxWidth : '90%' ,
619+ } ,
620+ messageBubbleContent : {
621+ flex : 1 ,
608622 paddingHorizontal : 12 ,
609623 paddingVertical : 8 ,
610- borderRadius : 10 ,
611- maxWidth : '90%' ,
624+ borderRadius : MESSAGE_BUBBLE_BORDER_RADIUS ,
612625 } ,
613626 messageTextLabel : {
614627 } ,
0 commit comments