[ui] font added, movie item added, pages layout

This commit is contained in:
Arta
2024-01-18 15:41:42 +03:30
parent 1865d2e6a8
commit ad82e72969
28 changed files with 413 additions and 245 deletions

View File

@@ -0,0 +1,64 @@
import { FontAwesome5 } from '@expo/vector-icons';
import { useCallback, useRef, useState } from 'react';
import { View } from 'react-native';
import { TextInput } from 'react-native-gesture-handler';
import { globalStyles } from '../../../styles/global';
import Colors from '../../../constants/Colors';
import { useFocusEffect } from 'expo-router';
export default function Searchbar() {
const [keyword, setKeyword] = useState('');
const inputRef = useRef<TextInput>(null);
useFocusEffect(
useCallback(() => {
// When the screen is focused
const focus = () => {
setTimeout(() => {
inputRef?.current?.focus();
}, 20);
};
focus();
return focus; // cleanup
}, []),
);
return (
<View
style={{
...globalStyles.flexRow,
...globalStyles.itemsCenter,
...globalStyles.border,
...globalStyles.roundedFull,
marginTop: 14,
marginBottom: 24,
}}
>
<View
style={{
...globalStyles.justifyCenter,
...globalStyles.itemsCenter,
width: 48,
marginLeft: 4,
}}
>
<FontAwesome5 name="search" size={18} color={Colors.dark.shade200} />
</View>
<TextInput
value={keyword}
autoFocus={true}
onChangeText={(text) => setKeyword(text)}
ref={inputRef}
placeholder="What are you looking for?"
placeholderTextColor={Colors.dark.shade200}
style={[
globalStyles.input,
globalStyles.fOpenSansRegular,
{
width: '100%',
},
]}
></TextInput>
</View>
);
}

View File

@@ -0,0 +1,41 @@
import { Dimensions, ScrollView, View } from 'react-native';
import { globalStyles } from '../../../styles/global';
import ScreenLayout from '../../../components/layout/screenLayout';
import { TextInput } from 'react-native-gesture-handler';
import styles from './styles';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useFocusEffect } from 'expo-router';
import { BoldText } from '../../../components/Styled';
import Item from '../../../components/item/item';
import Searchbar from './Searchbar';
export default function SearchScreen() {
return (
<ScrollView>
<ScreenLayout
title={
<View
style={{ ...globalStyles.flexRow, ...globalStyles.itemsCenter }}
>
<BoldText style={globalStyles.sectionTitle}>Search</BoldText>
</View>
}
subtitle="Looking for something?"
>
<Searchbar />
<View style={styles.items}>
<View style={styles.itemOuter}>
<Item />
</View>
<View style={styles.itemOuter}>
<Item />
</View>
<View style={styles.itemOuter}>
<Item />
</View>
</View>
</ScreenLayout>
</ScrollView>
);
}

View File

@@ -0,0 +1,19 @@
import { StyleSheet } from 'react-native';
const styles = StyleSheet.create({
items: {
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'flex-start',
width: '100%',
flexDirection: 'row',
flex: 1,
},
itemOuter: {
flexBasis: '50%',
paddingHorizontal: 12,
paddingBottom: 12,
},
});
export default styles;