import {
Column,
FilterChip,
Host,
Icon,
IconButton,
OutlinedTextField,
Row,
Text,
TextButton,
useNativeState,
} from '@expo/ui/jetpack-compose';
import { fillMaxWidth, height, padding, weight } from '@expo/ui/jetpack-compose/modifiers';
import { StyleSheet, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { ICONS } from './icons';
import { useAndroidColors } from './material';
import type { FindBarProps } from './types';
import { type FindOption, useFind } from './useFind';
// Outlined fields, filter chips for the options and text buttons for the actions, all Material 3.
export function FindBar({ scheme, editor, onStatus, onClose }: FindBarProps) {
const colors = useAndroidColors(scheme);
const safe = useSafeAreaInsets();
const find = useFind(editor, onStatus);
const query = useNativeState('');
const replacement = useNativeState('');
const chip = (label: string, option: FindOption) => (
find.toggle(option)}>
{find.options[option] ? (
) : null}
{label}
);
return (
Find
{`${find.match.index} of ${find.match.count}`}
void find.previous()}>
void find.next()}>
{chip('Aa', 'caseSensitive')}
{chip('.*', 'regex')}
{chip('W', 'wholeWord')}
Replace
void find.replaceOne()}>
Replace
void find.replaceAll()}>
Replace all
Done
);
}
const styles = StyleSheet.create({
host: { alignSelf: 'stretch' },
});