Compare commits

..

2 Commits

Author SHA1 Message Date
duffyduck cff421bc53 release: bump version to 0.0.3.5 2026-04-11 12:13:41 +02:00
duffyduck bca925d385 fix: Use scrollToIndex with viewPosition:1 for reliable bottom scroll
- scrollToIndex targets last message at bottom of viewport
- onScrollToIndexFailed fallback to scrollToEnd
- More reliable than scrollToEnd with dynamic heights

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 12:12:24 +02:00
3 changed files with 22 additions and 8 deletions
+2 -2
View File
@@ -79,8 +79,8 @@ android {
applicationId "com.ariacockpit" applicationId "com.ariacockpit"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 304 versionCode 305
versionName "0.0.3.4" versionName "0.0.3.5"
// Fallback fuer Libraries mit Product Flavors // Fallback fuer Libraries mit Product Flavors
missingDimensionStrategy 'react-native-camera', 'general' missingDimensionStrategy 'react-native-camera', 'general'
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "aria-cockpit", "name": "aria-cockpit",
"version": "0.0.3.4", "version": "0.0.3.5",
"private": true, "private": true,
"scripts": { "scripts": {
"android": "react-native run-android", "android": "react-native run-android",
+19 -5
View File
@@ -377,12 +377,21 @@ const ChatScreen: React.FC = () => {
useEffect(() => { useEffect(() => {
if (messages.length > 0 && shouldAutoScroll.current) { if (messages.length > 0 && shouldAutoScroll.current) {
const isInitial = lastMessageCount.current === 0; const isInitial = lastMessageCount.current === 0;
// Mehrfach versuchen (FlatList braucht Zeit zum Rendern) const scrollToBottom = () => {
const delays = isInitial ? [100, 300, 600, 1000] : [100, 300]; try {
for (const delay of delays) { flatListRef.current?.scrollToIndex({
setTimeout(() => { index: messages.length - 1,
animated: !isInitial,
viewPosition: 1, // 1 = Item am unteren Rand
});
} catch {
// Fallback wenn Index nicht berechnet werden kann
flatListRef.current?.scrollToEnd({ animated: !isInitial }); flatListRef.current?.scrollToEnd({ animated: !isInitial });
}, delay); }
};
const delays = isInitial ? [200, 500, 1000] : [150];
for (const delay of delays) {
setTimeout(scrollToBottom, delay);
} }
} }
lastMessageCount.current = messages.length; lastMessageCount.current = messages.length;
@@ -691,6 +700,11 @@ const ChatScreen: React.FC = () => {
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
onScrollBeginDrag={handleScrollBeginDrag} onScrollBeginDrag={handleScrollBeginDrag}
onScrollEndDrag={handleScrollEndDrag} onScrollEndDrag={handleScrollEndDrag}
onScrollToIndexFailed={(info) => {
setTimeout(() => {
flatListRef.current?.scrollToEnd({ animated: false });
}, 200);
}}
ListEmptyComponent={ ListEmptyComponent={
<View style={styles.emptyContainer}> <View style={styles.emptyContainer}>
<Text style={styles.emptyIcon}>{'\uD83E\uDD16'}</Text> <Text style={styles.emptyIcon}>{'\uD83E\uDD16'}</Text>