refactor(LocalDataSource, PostRepository, ChatScreen): enhance database handling and message loading
- Introduced a promise-based initialization mechanism in LocalDataSource to prevent concurrent initialization issues. - Updated PostRepository to utilize an enqueueWrite method for database operations, ensuring thread-safe writes. - Refactored ChatScreen to improve message loading logic, including preloading history and managing scroll behavior more effectively. - Enhanced message rendering logic to maintain correct indices in inverted lists and optimize user experience during scrolling.
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
TextInput,
|
||||
Keyboard,
|
||||
BackHandler,
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useNavigation, useIsFocused } from '@react-navigation/native';
|
||||
@@ -334,12 +335,12 @@ export const MessageListScreen: React.FC = () => {
|
||||
Animated.timing(scaleAnims[index], {
|
||||
toValue: 0.98,
|
||||
duration: 100,
|
||||
useNativeDriver: true,
|
||||
useNativeDriver: Platform.OS !== 'web',
|
||||
}),
|
||||
Animated.timing(scaleAnims[index], {
|
||||
toValue: 1,
|
||||
duration: 100,
|
||||
useNativeDriver: true,
|
||||
useNativeDriver: Platform.OS !== 'web',
|
||||
}),
|
||||
]).start(() => {
|
||||
if (conversation.id === SYSTEM_MESSAGE_CHANNEL_ID) {
|
||||
|
||||
Reference in New Issue
Block a user