@@ -158,9 +158,9 @@ type MessageInputPropsWithContext = Pick<
158158
159159const textComposerStateSelector = ( state : TextComposerState ) => ( {
160160 command : state . command ,
161+ hasText : ! ! state . text ,
161162 mentionedUsers : state . mentionedUsers ,
162163 suggestions : state . suggestions ,
163- text : state . text ,
164164} ) ;
165165
166166const messageComposerStateStoreSelector = ( state : MessageComposerState ) => ( {
@@ -218,7 +218,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
218218
219219 const messageComposer = useMessageComposer ( ) ;
220220 const { attachmentManager, textComposer } = messageComposer ;
221- const { command, mentionedUsers, text } = useStateStore (
221+ const { command, mentionedUsers, hasText } = useStateStore (
222222 textComposer . state ,
223223 textComposerStateSelector ,
224224 ) ;
@@ -534,7 +534,6 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
534534 } = useAudioController ( ) ;
535535
536536 const asyncAudioEnabled = audioRecordingEnabled && isAudioRecorderAvailable ( ) ;
537- const hasText = ! ! text ;
538537 const showSendingButton = hasText || attachments . length ;
539538
540539 const isSendingButtonVisible = useMemo ( ( ) => {
@@ -600,37 +599,35 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
600599 runOnJS ( setMicLocked ) ( false ) ;
601600 } ) ;
602601
603- const animatedStyles = {
604- lockIndicator : useAnimatedStyle ( ( ) => ( {
605- transform : [
606- {
607- translateY : interpolate (
608- micPositionY . value ,
609- [ 0 , Y_AXIS_POSITION ] ,
610- [ 0 , Y_AXIS_POSITION ] ,
611- Extrapolation . CLAMP ,
612- ) ,
613- } ,
614- ] ,
615- } ) ) ,
616- micButton : useAnimatedStyle ( ( ) => ( {
617- opacity : interpolate ( micPositionX . value , [ 0 , X_AXIS_POSITION ] , [ 1 , 0 ] , Extrapolation . CLAMP ) ,
618- transform : [ { translateX : micPositionX . value } , { translateY : micPositionY . value } ] ,
619- } ) ) ,
620- slideToCancel : useAnimatedStyle ( ( ) => ( {
621- opacity : interpolate ( micPositionX . value , [ 0 , X_AXIS_POSITION ] , [ 1 , 0 ] , Extrapolation . CLAMP ) ,
622- transform : [
623- {
624- translateX : interpolate (
625- micPositionX . value ,
626- [ 0 , X_AXIS_POSITION ] ,
627- [ 0 , X_AXIS_POSITION / 2 ] ,
628- Extrapolation . CLAMP ,
629- ) ,
630- } ,
631- ] ,
632- } ) ) ,
633- } ;
602+ const lockIndicatorAnimatedStyle = useAnimatedStyle ( ( ) => ( {
603+ transform : [
604+ {
605+ translateY : interpolate (
606+ micPositionY . value ,
607+ [ 0 , Y_AXIS_POSITION ] ,
608+ [ 0 , Y_AXIS_POSITION ] ,
609+ Extrapolation . CLAMP ,
610+ ) ,
611+ } ,
612+ ] ,
613+ } ) ) ;
614+ const micButttonAnimatedStyle = useAnimatedStyle ( ( ) => ( {
615+ opacity : interpolate ( micPositionX . value , [ 0 , X_AXIS_POSITION ] , [ 1 , 0 ] , Extrapolation . CLAMP ) ,
616+ transform : [ { translateX : micPositionX . value } , { translateY : micPositionY . value } ] ,
617+ } ) ) ;
618+ const slideToCancelAnimatedStyle = useAnimatedStyle ( ( ) => ( {
619+ opacity : interpolate ( micPositionX . value , [ 0 , X_AXIS_POSITION ] , [ 1 , 0 ] , Extrapolation . CLAMP ) ,
620+ transform : [
621+ {
622+ translateX : interpolate (
623+ micPositionX . value ,
624+ [ 0 , X_AXIS_POSITION ] ,
625+ [ 0 , X_AXIS_POSITION / 2 ] ,
626+ Extrapolation . CLAMP ,
627+ ) ,
628+ } ,
629+ ] ,
630+ } ) ) ;
634631
635632 const { aiState } = useAIState ( channel ) ;
636633
@@ -655,7 +652,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
655652 < AudioRecordingLockIndicator
656653 messageInputHeight = { height }
657654 micLocked = { micLocked }
658- style = { animatedStyles . lockIndicator }
655+ style = { lockIndicatorAnimatedStyle }
659656 />
660657 { recordingStatus === 'stopped' ? (
661658 < AudioRecordingPreview
@@ -686,7 +683,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
686683 recording = { recording }
687684 recordingDuration = { recordingDuration }
688685 recordingStopped = { recordingStatus === 'stopped' }
689- slideToCancelStyle = { animatedStyles . slideToCancel }
686+ slideToCancelStyle = { slideToCancelAnimatedStyle }
690687 stopVoiceRecording = { stopVoiceRecording }
691688 uploadVoiceRecording = { uploadVoiceRecording }
692689 />
@@ -753,11 +750,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
753750 { audioRecordingEnabled && isAudioRecorderAvailable ( ) && ! micLocked && (
754751 < GestureDetector gesture = { panGestureMic } >
755752 < Animated . View
756- style = { [
757- styles . micButtonContainer ,
758- animatedStyles . micButton ,
759- micButtonContainer ,
760- ] }
753+ style = { [ styles . micButtonContainer , micButttonAnimatedStyle , micButtonContainer ] }
761754 >
762755 < StartAudioRecordingButton
763756 permissionsGranted = { permissionsGranted }
0 commit comments