diff --git a/src/components/Input.tsx b/src/components/Input.tsx index 4efdb95..6d42d17 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -1,13 +1,45 @@ +import React from 'react'; +import { Platform, TextInputProps } from 'react-native'; import styled, { css } from 'styled-components/native'; +import useDefaultStyles from './Colors'; +import { Gap } from './Utility'; -const Input = styled.TextInput<{ icon?: boolean }>` - margin: 10px 0; +export interface InputProps extends TextInputProps { + icon?: React.ReactNode +} + +const Container = styled.View` + margin: 6px 0; border-radius: 8px; - padding: 15px; - - ${(props) => props.icon && css` - padding-left: 40px; - `} + display: flex; + flex-direction: row; + align-items: center; + + ${Platform.select({ + ios: css`padding: 12px;`, + android: css`padding: 4px 12px;`, + })} `; +const InputWrapper = styled.TextInput` + margin: 0; + padding: 0; +`; + +function Input({ icon = null, style, ...rest }: InputProps) { + const defaultStyles = useDefaultStyles(); + + return ( + + {icon && ( + <> + {icon} + + + )} + + + ); +} + export default Input; \ No newline at end of file diff --git a/src/components/Utility.tsx b/src/components/Utility.tsx new file mode 100644 index 0000000..093bd5b --- /dev/null +++ b/src/components/Utility.tsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { View } from 'react-native'; + +export interface GapProps { + size: number; + direction?: 'horizontal' | 'vertical'; +} + +export function Gap({ size, direction = 'horizontal' }: GapProps) { + return ; +} \ No newline at end of file diff --git a/src/screens/Search/index.tsx b/src/screens/Search/index.tsx index ca78934..99e6b74 100644 --- a/src/screens/Search/index.tsx +++ b/src/screens/Search/index.tsx @@ -70,13 +70,6 @@ const SearchResult = styled.View` height: 54px; `; -const SearchIndicator = styled(SearchIcon)` - position: absolute; - left: 16px; - top: 26px; -`; - - const fuseOptions: Fuse.IFuseOptions = { keys: ['Name', 'AlbumArtist', 'AlbumArtists', 'Artists'], threshold: 0.1, @@ -229,10 +222,9 @@ export default function Search() { onChangeText={setSearchTerm} style={[defaultStyles.input, { marginBottom: 12 }]} placeholder={t('search') + '...'} - icon + icon={} testID="search-input" /> - {isLoading && }