Skip to content

Minimal

Left aligned, no Cancel button, no animation.

Live demo, try it.Open full screen ↗
  1. showCancelButton={false} keeps the input at full width.
  2. placeholderAlign="left" rests the icon and the placeholder at the leading edge.
  3. animated={false} turns the animation off.

Uses

This is the code running in the phone. Copy it into your app.

example/demos/minimal.tsx
import { useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Search from 'react-native-search-box';
export default function Minimal() {
const [query, setQuery] = useState('');
return (
<View style={styles.screen}>
<Text style={styles.title}>Notes</Text>
<Search
showCancelButton={false}
placeholderAlign="left"
animated={false}
backgroundColor="transparent"
placeholder="Search notes"
inputHeight={40}
inputStyle={styles.input}
searchIconExpandedMargin={18}
placeholderExpandedMargin={34}
onChangeText={setQuery}
onDelete={() => setQuery('')}
/>
<Text style={styles.text}>{query ? `Notes about “${query}”` : 'All notes'}</Text>
</View>
);
}
const styles = StyleSheet.create({
screen: { flex: 1, backgroundColor: '#fff', padding: 16 },
title: { fontSize: 28, fontWeight: '700', color: '#111', marginBottom: 8, marginLeft: 5 },
input: {
fontSize: 16,
color: '#111',
backgroundColor: '#fff',
borderWidth: 1,
borderColor: '#d1d5db',
borderRadius: 8,
},
text: { marginTop: 16, marginLeft: 5, color: '#6b7280' },
});