Bỏ qua để đến nội dung

Phải sang trái

Tiếng Ả Rập, bố cục được lật ngược.

Demo chạy thật, hãy bấm thử.Mở toàn màn hình ↗
  1. direction="rtl" lật icon, chữ, nút xoá và nút Cancel.
  2. clearButtonAccessibilityLabel dịch nội dung trình đọc màn hình đọc lên.

Dùng

Đây chính là đoạn code đang chạy trong điện thoại. Chép vào app của bạn là dùng được.

example/demos/rtl.tsx
import { useState } from 'react';
import { ScrollView, StyleSheet, Text, View } from 'react-native';
import Search from 'react-native-search-box';
const DISHES = ['كبسة', 'منسف', 'فلافل', 'حمص', 'تبولة', 'كنافة', 'شاورما', 'مقلوبة', 'فتوش', 'ملوخية'];
export default function Rtl() {
const [query, setQuery] = useState('');
const reset = () => setQuery('');
return (
<View style={styles.screen}>
<Search
direction="rtl"
backgroundColor="#f5f0e6"
titleCancelColor="#9a3412"
placeholder="بحث"
cancelTitle="إلغاء"
clearButtonAccessibilityLabel="مسح"
inputHeight={40}
inputBorderRadius={12}
inputStyle={styles.input}
searchIconExpandedMargin={16}
placeholderExpandedMargin={32}
onChangeText={setQuery}
onDelete={reset}
onCancel={reset}
/>
<ScrollView keyboardShouldPersistTaps="handled">
{DISHES.filter((dish) => dish.includes(query.trim())).map((dish) => (
<Text key={dish} style={styles.row}>
{dish}
</Text>
))}
</ScrollView>
</View>
);
}
const styles = StyleSheet.create({
screen: { flex: 1, backgroundColor: '#fffaf0' },
input: { fontSize: 16, color: '#431407' },
row: {
paddingVertical: 14,
marginHorizontal: 16,
fontSize: 18,
textAlign: 'right',
color: '#431407',
borderBottomWidth: 1,
borderColor: '#f0e6d2',
},
});