"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Textarea = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const bottom_sheet_1 = require("@gorhom/bottom-sheet");
const React = tslib_1.__importStar(require("react"));
const react_native_1 = require("react-native");
const atoms_1 = require("../../lib/theme/atoms");
const ui_1 = require("../../ui");
const Textarea = React.forwardRef(({ style, multiline = true, numberOfLines = 4, ...props }, ref) => {
    let th = (0, ui_1.useTheme)();
    // Detect if we're inside a bottom sheet
    let isInBottomSheet = false;
    try {
        (0, bottom_sheet_1.useBottomSheetInternal)();
        isInBottomSheet = true;
    }
    catch {
        // Not in a bottom sheet context
        isInBottomSheet = false;
    }
    // Use BottomSheetTextInput when inside a bottom sheet, regular TextInput otherwise
    const InputComponent = isInBottomSheet && react_native_1.Platform.OS !== "web"
        ? bottom_sheet_1.BottomSheetTextInput
        : react_native_1.TextInput;
    return ((0, jsx_runtime_1.jsx)(InputComponent, { ref: ref, style: [
            atoms_1.flex.values[1],
            atoms_1.borders.width.thin,
            atoms_1.borders.color.gray[400],
            atoms_1.bg.gray[900],
            atoms_1.p[3],
            atoms_1.text.gray[200],
            props.editable === false && { opacity: 0.5 },
            { borderRadius: 10 },
            style,
        ], autoComplete: props.autoComplete || "off", textContentType: props.textContentType || "none", multiline: multiline, numberOfLines: numberOfLines, textAlignVertical: "top", placeholderTextColor: th.theme.colors.textMuted, ...props }));
});
exports.Textarea = Textarea;
Textarea.displayName = "Textarea";
//# sourceMappingURL=textarea.js.map