Я успешно использую keobodevoidingview на других экранах этого мобильного (iOS) приложения, но я подозреваю, что есть что -то в общей планировке этого экрана, что заставляет его не функционировать, как ожидалось. Нажатие на ввод открывает клавиатуру, но содержимое не сдвигается. Весь этот компонент «JournalEntryForm» отображается внутри реакционного «модального».
const JournalEntryForm: React.FC = ({
journalEntry,
currentState,
currentQuestion,
currentAnswer,
isSubmitting,
isFollowUpsComplete,
mode,
questions,
onClose,
onAnswerChange,
onSubmitAnswer,
onSubmitFollowUp,
onNextQuestion
}) => {
const scrollViewRef = useRef(null);
const inputRef = useRef(null);
const [isInputFocused, setIsInputFocused] = useState(false);
const [isKeyboardVisible, setKeyboardVisible] = useState(false);
return (
Back
Journal Entry
{journalEntry.date.toDate().toLocaleDateString(undefined, {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
})}
{/* Conversation history */}
{journalEntry && (
{/* Show all previous questions and their conversations */}
)}
{/* Input area and buttons - only show if not complete */}
{currentState !== 'complete' && (
{/* Input area */}
{/* Navigation buttons */}
)}
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F8F9FA',
},
scrollContent: {
padding: spacing.lg,
justifyContent: 'flex-end',
flex: 1,
},
headerContainer: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: 16,
paddingTop: 60,
paddingBottom: 16,
backgroundColor: '#fff',
borderBottomWidth: 1,
borderBottomColor: '#eee',
},
backButton: {
flexDirection: 'row',
alignItems: 'center',
padding: 8,
width: 80,
},
backButtonText: {
fontSize: 16,
color: '#333',
marginLeft: 4,
},
headerTitle: {
fontSize: 20,
fontWeight: '600',
color: '#333',
textAlign: 'center',
flex: 1,
},
headerFiller: {
width: 80,
},
dateContainer: {
paddingHorizontal: spacing.md,
paddingVertical: spacing.sm,
backgroundColor: '#f8f9fa',
borderBottomWidth: 1,
borderBottomColor: '#eee',
},
dateText: {
fontSize: responsiveFontSize(14),
color: '#666',
textAlign: 'center',
},
questionContainer: {
backgroundColor: '#fff',
borderRadius: 12,
padding: spacing.lg,
marginBottom: spacing.lg,
//flex: 1,
},
conversationContainer: {
marginBottom: spacing.lg,
},
inputContainer: {
marginTop: spacing.md,
},
input: {
backgroundColor: '#F5F5F5',
borderRadius: 20,
padding: spacing.md,
fontSize: responsiveFontSize('md'),
minHeight: 40,
maxHeight: 120,
textAlignVertical: 'center',
marginBottom: spacing.md,
},
submitButton: {
backgroundColor: '#FFB703',
borderRadius: 20,
padding: spacing.md,
width: '100%',
alignItems: 'center',
},
submitButtonText: {
color: '#FFFFFF',
fontSize: responsiveFontSize('md'),
fontWeight: 'bold',
},
navigationContainer: {
marginTop: spacing.lg,
alignItems: 'flex-end',
},
nextButton: {
backgroundColor: 'transparent',
borderRadius: 8,
padding: spacing.sm,
paddingHorizontal: spacing.sm,
},
nextButtonText: {
color: '#666',
fontSize: responsiveFontSize('sm'),
fontWeight: '500',
textDecorationLine: 'underline',
},
typingIndicator: {
marginBottom: spacing.md,
alignItems: 'flex-start',
},
disabledButton: {
backgroundColor: '#cccccc',
opacity: 0.7,
},
disabledButtonText: {
color: '#888888',
},
disabledInput: {
backgroundColor: '#f0f0f0',
color: '#999',
},
});
Подробнее здесь: https://stackoverflow.com/questions/796 ... sted-views
KeyboardEvoidingView не работает с ScrollView с вложенными видами ⇐ IOS
Программируем под IOS
-
Anonymous
1746480676
Anonymous
Я успешно использую keobodevoidingview на других экранах этого мобильного (iOS) приложения, но я подозреваю, что есть что -то в общей планировке этого экрана, что заставляет его не функционировать, как ожидалось. Нажатие на ввод открывает клавиатуру, но содержимое не сдвигается. Весь этот компонент «JournalEntryForm» отображается внутри реакционного «модального».
const JournalEntryForm: React.FC = ({
journalEntry,
currentState,
currentQuestion,
currentAnswer,
isSubmitting,
isFollowUpsComplete,
mode,
questions,
onClose,
onAnswerChange,
onSubmitAnswer,
onSubmitFollowUp,
onNextQuestion
}) => {
const scrollViewRef = useRef(null);
const inputRef = useRef(null);
const [isInputFocused, setIsInputFocused] = useState(false);
const [isKeyboardVisible, setKeyboardVisible] = useState(false);
return (
Back
Journal Entry
{journalEntry.date.toDate().toLocaleDateString(undefined, {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
})}
{/* Conversation history */}
{journalEntry && (
{/* Show all previous questions and their conversations */}
)}
{/* Input area and buttons - only show if not complete */}
{currentState !== 'complete' && (
{/* Input area */}
{/* Navigation buttons */}
)}
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F8F9FA',
},
scrollContent: {
padding: spacing.lg,
justifyContent: 'flex-end',
flex: 1,
},
headerContainer: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: 16,
paddingTop: 60,
paddingBottom: 16,
backgroundColor: '#fff',
borderBottomWidth: 1,
borderBottomColor: '#eee',
},
backButton: {
flexDirection: 'row',
alignItems: 'center',
padding: 8,
width: 80,
},
backButtonText: {
fontSize: 16,
color: '#333',
marginLeft: 4,
},
headerTitle: {
fontSize: 20,
fontWeight: '600',
color: '#333',
textAlign: 'center',
flex: 1,
},
headerFiller: {
width: 80,
},
dateContainer: {
paddingHorizontal: spacing.md,
paddingVertical: spacing.sm,
backgroundColor: '#f8f9fa',
borderBottomWidth: 1,
borderBottomColor: '#eee',
},
dateText: {
fontSize: responsiveFontSize(14),
color: '#666',
textAlign: 'center',
},
questionContainer: {
backgroundColor: '#fff',
borderRadius: 12,
padding: spacing.lg,
marginBottom: spacing.lg,
//flex: 1,
},
conversationContainer: {
marginBottom: spacing.lg,
},
inputContainer: {
marginTop: spacing.md,
},
input: {
backgroundColor: '#F5F5F5',
borderRadius: 20,
padding: spacing.md,
fontSize: responsiveFontSize('md'),
minHeight: 40,
maxHeight: 120,
textAlignVertical: 'center',
marginBottom: spacing.md,
},
submitButton: {
backgroundColor: '#FFB703',
borderRadius: 20,
padding: spacing.md,
width: '100%',
alignItems: 'center',
},
submitButtonText: {
color: '#FFFFFF',
fontSize: responsiveFontSize('md'),
fontWeight: 'bold',
},
navigationContainer: {
marginTop: spacing.lg,
alignItems: 'flex-end',
},
nextButton: {
backgroundColor: 'transparent',
borderRadius: 8,
padding: spacing.sm,
paddingHorizontal: spacing.sm,
},
nextButtonText: {
color: '#666',
fontSize: responsiveFontSize('sm'),
fontWeight: '500',
textDecorationLine: 'underline',
},
typingIndicator: {
marginBottom: spacing.md,
alignItems: 'flex-start',
},
disabledButton: {
backgroundColor: '#cccccc',
opacity: 0.7,
},
disabledButtonText: {
color: '#888888',
},
disabledInput: {
backgroundColor: '#f0f0f0',
color: '#999',
},
});
Подробнее здесь: [url]https://stackoverflow.com/questions/79607666/keyboardavoidingview-not-working-with-scrollview-with-nested-views[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия