Answer
The Answer component provides a keyboard-aware scrollable container for journal entry forms. It combines KeyboardAwareScrollView with KeyboardToolbar to create an optimal mobile input experience for healthcare questionnaires and journal entries.
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
The Answer component provides a keyboard-aware scrollable container for journal entry forms. It combines KeyboardAwareScrollView with KeyboardToolbar to create an optimal mobile input experience for healthcare questionnaires and journal entries.
Basic Example
import { Answer } from "@ovok/native";
import * as React from "react";
import { Button } from "react-native-paper";
const BasicAnswer = () => {
const [answerText, setAnswerText] = React.useState("");
return (
<Answer>
<Answer.Question>What is your name?</Answer.Question>
<Answer.Input
value={answerText}
onChangeText={setAnswerText}
placeholder="Your answer"
autoFocus
multiline
/>
<Answer.Actions>
<Button mode="contained">Save</Button>
</Answer.Actions>
</Answer>
);
};
export default BasicAnswer;Props
Every prop, with its type and description, is listed in the @ovok/native/journal API reference.
Compound Components
Answer.Header- Top section for navigation and form actionsAnswer.Question- Styled text component for question displayAnswer.Input- Theme-aware text input for user responsesAnswer.Actions- Bottom container for submission buttons
Component Behavior
Keyboard Management
- Automatic Scrolling: Ensures input fields remain visible when keyboard appears
- Keyboard Toolbar: Provides native iOS-style toolbar above keyboard
- Scroll Performance: Optimized for smooth scrolling during text input
Layout System
- Flexible Height: Expands to fill available screen space
- Content Padding: Default padding of
theme.spacing(6)with customizable override - Component Spacing: Consistent
theme.spacing(5)gap between child elements
Theme Integration
- Spacing Values: Uses theme multipliers for consistent layout
- Color Inheritance: Child components inherit theme colors automatically
- Responsive Design: Adapts to different screen sizes and orientations
Styling
Theme Colors Used
- Inherits from child components (no direct color usage)
Last updated on
Journal
A comprehensive set of React Native components for building journal and questionnaire interfaces in healthcare applications. The Journal module provides keyboard-aware forms, question-answer flows, and display components for past entries.
Answer.Actions
The Answer.Actions component provides a themed container for action buttons at the bottom of journal entry forms. It applies consistent horizontal padding and serves as a wrapper for submission, navigation, and other form-related buttons.