GuidesComponentsjournal

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

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

On this page