mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 18:13:25 +00:00
[ui] font added, movie item added, pages layout
This commit is contained in:
64
apps/mobile/app/(tabs)/search/Searchbar.tsx
Normal file
64
apps/mobile/app/(tabs)/search/Searchbar.tsx
Normal 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>
|
||||
);
|
||||
}
|
41
apps/mobile/app/(tabs)/search/_layout.tsx
Normal file
41
apps/mobile/app/(tabs)/search/_layout.tsx
Normal 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>
|
||||
);
|
||||
}
|
19
apps/mobile/app/(tabs)/search/styles.tsx
Normal file
19
apps/mobile/app/(tabs)/search/styles.tsx
Normal 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;
|
Reference in New Issue
Block a user