@@ -18,6 +18,7 @@ import { mainManager } from '@/utils/MainManager';
1818import { sessionStore } from '@/utils/sessionStore' ;
1919import { VoicePrepareOverlay } from '@/components/VoicePrepareOverlay' ;
2020import { useFocusEffect } from '@react-navigation/native' ;
21+ import { Ionicons } from '@expo/vector-icons' ;
2122import { useLocalSearchParams } from 'expo-router' ;
2223import { useTranslation } from 'react-i18next' ;
2324import { useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
@@ -741,6 +742,7 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
741742 return Gesture . Pan ( )
742743 . minPointers ( 2 )
743744 . activateAfterLongPress ( 500 )
745+ . enabled ( isPageFocused )
744746 . runOnJS ( true )
745747 . onStart ( ( ) => {
746748 const { width, height } = Dimensions . get ( 'window' ) ;
@@ -776,12 +778,13 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
776778 setIsDraggingModel ( false ) ;
777779 } ) ;
778780 // eslint-disable-next-line react-hooks/exhaustive-deps
779- } , [ ] ) ;
781+ } , [ isPageFocused ] ) ;
780782
781783 // 双指缩放手势(捏合/张开)
782784 // 注意:Pinch 手势本身就需要双指,无需 minPointers
783785 const pinchGesture = useMemo ( ( ) => {
784786 return Gesture . Pinch ( )
787+ . enabled ( isPageFocused )
785788 . runOnJS ( true )
786789 . onStart ( ( ) => {
787790 // 记录开始时的缩放值
@@ -799,7 +802,7 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
799802 setIsScalingModel ( false ) ;
800803 } ) ;
801804 // eslint-disable-next-line react-hooks/exhaustive-deps
802- } , [ ] ) ;
805+ } , [ isPageFocused ] ) ;
803806
804807 // 组合手势:双指拖动 + 缩放同时识别
805808 const live2dGesture = useMemo ( ( ) => {
@@ -1158,7 +1161,7 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
11581161 clientMessageId,
11591162 } ) ;
11601163 }
1161- chat . addMessage ( `📸 [已发送${ imagesToSend . length } 张照片]` , 'user' ) ;
1164+ chat . addMessage ( `[已发送${ imagesToSend . length } 张照片]` , 'user' ) ;
11621165 }
11631166
11641167 // 再发送文本
@@ -1227,41 +1230,10 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
12271230 < StatusToast ref = { statusToastRef } />
12281231
12291232 { /* Live2D 舞台区域 */ }
1230- { /* Android 端:GestureDetector 包裹整个容器,同时支持单指注视(原生处理)和双指手势 */ }
1231- { /* iOS 端:直接渲染容器,暂不支持双指手势 */ }
1232- { Platform . OS === 'android' ? (
1233- < GestureDetector gesture = { live2dGesture } >
1234- < View style = { styles . live2dContainer } >
1235- { /* 页面获得焦点时渲染 Live2D */ }
1236- { isPageFocused && (
1237- < ReactNativeLive2dView
1238- style = { styles . live2dView }
1239- { ...live2d . live2dPropsForLipSync }
1240- onTap = { handleLive2DTap }
1241- />
1242- ) }
1243-
1244- { /* 失去焦点时的显示 */ }
1245- { ! isPageFocused && (
1246- < View style = { styles . pausedContainer } >
1247- < Text style = { styles . pausedText } >
1248- { live2d . live2dProps . modelPath ? 'Live2D 已暂停' : '页面未激活' }
1249- </ Text >
1250- </ View >
1251- ) }
1252-
1253- { ( isDraggingModel || isScalingModel ) && (
1254- < View style = { styles . dragIndicator } pointerEvents = "none" >
1255- < Text style = { styles . dragIndicatorText } >
1256- { isDraggingModel && isScalingModel ? '拖动/缩放中' : isDraggingModel ? '拖动中' : '缩放中' }
1257- </ Text >
1258- </ View >
1259- ) }
1260- </ View >
1261- </ GestureDetector >
1262- ) : (
1233+ { /* GestureDetector 包裹整个容器,Android & iOS 共用双指拖动 + 捏合缩放 */ }
1234+ < GestureDetector gesture = { live2dGesture } >
12631235 < View style = { styles . live2dContainer } >
1264- { /* iOS 端暂不支持双指手势 */ }
1236+ { /* 页面获得焦点时渲染 Live2D */ }
12651237 { isPageFocused && (
12661238 < ReactNativeLive2dView
12671239 style = { styles . live2dView }
@@ -1270,15 +1242,24 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
12701242 />
12711243 ) }
12721244
1245+ { /* 失去焦点时的显示 */ }
12731246 { ! isPageFocused && (
12741247 < View style = { styles . pausedContainer } >
12751248 < Text style = { styles . pausedText } >
12761249 { live2d . live2dProps . modelPath ? 'Live2D 已暂停' : '页面未激活' }
12771250 </ Text >
12781251 </ View >
12791252 ) }
1253+
1254+ { ( isDraggingModel || isScalingModel ) && (
1255+ < View style = { styles . dragIndicator } pointerEvents = "none" >
1256+ < Text style = { styles . dragIndicatorText } >
1257+ { isDraggingModel && isScalingModel ? '拖动/缩放中' : isDraggingModel ? '拖动中' : '缩放中' }
1258+ </ Text >
1259+ </ View >
1260+ ) }
12801261 </ View >
1281- ) }
1262+ </ GestureDetector >
12821263
12831264 { /*
12841265 【跨平台组件】Live2DRightToolbar 右侧工具栏
@@ -1529,7 +1510,7 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
15291510 } }
15301511 onPress = { ( ) => setDebugPanelVisible ( true ) }
15311512 >
1532- < Text style = { { color : ' #fff' , fontSize : 20 } } > 🔧 </ Text >
1513+ < Ionicons name = "construct" size = { 20 } color = " #fff" / >
15331514 </ TouchableOpacity >
15341515
15351516 { /* 调试信息面板 */ }
@@ -1559,7 +1540,7 @@ const MainUIScreen: React.FC<MainUIScreenProps> = () => {
15591540 onStartShouldSetResponder = { ( ) => true }
15601541 >
15611542 < Text style = { { color : '#40c5f1' , fontSize : 18 , fontWeight : 'bold' , marginBottom : 15 } } >
1562- 🔧 { t ( 'main.debug.title' ) }
1543+ { t ( 'main.debug.title' ) }
15631544 </ Text >
15641545 < ScrollView >
15651546 < Text style = { { color : '#fff' , fontSize : 12 , fontFamily : 'monospace' , marginBottom : 10 } } >
0 commit comments