Fixed search input component

This commit is contained in:
Mustafa Buyukcelebi 2019-02-25 12:05:20 +03:00
parent 9f9ac91c5a
commit 941d8a5011
4 changed files with 33 additions and 33 deletions

View File

@ -13,25 +13,27 @@ import styles from './searchInputStyles';
* ------------------------------------------------ * ------------------------------------------------
* @prop { type } name - Description.... * @prop { type } name - Description....
*/ */
const SearchInputView = ({
const SearchInputView = () => ( onChangeText, handleOnModalClose, placeholder, editable = true,
}) => (
<SafeAreaView style={styles.safeArea}> <SafeAreaView style={styles.safeArea}>
<View style={styles.inputWrapper}> <View style={styles.inputWrapper}>
<Icon style={styles.icon} iconType="FontAwesome" name="search" size={15} /> <Icon style={styles.icon} iconType="FontAwesome" name="search" size={15} />
<TextInput <TextInput
style={styles.input} style={styles.input}
onChangeText={text => console.log('text :', text)} onChangeText={text => onChangeText(text)}
placeholder="tst" placeholder={placeholder}
placeholderTextColor="#c1c5c7" placeholderTextColor="#c1c5c7"
autoCapitalize="none" autoCapitalize="none"
autoFocus autoFocus
editable={editable}
/> />
<IconButton <IconButton
iconStyle={styles.closeIcon} iconStyle={styles.closeIcon}
iconType="Ionicons" iconType="Ionicons"
style={styles.closeIconButton} style={styles.closeIconButton}
name="ios-close-circle-outline" name="ios-close-circle-outline"
onPress={() => console.log('test :')} onPress={() => handleOnModalClose()}
/> />
</View> </View>
</SafeAreaView> </SafeAreaView>

View File

@ -1,16 +1,13 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { import {
View, Text, FlatList, TouchableHighlight, SafeAreaView, View, Text, FlatList, TouchableHighlight,
} from 'react-native'; } from 'react-native';
import FastImage from 'react-native-fast-image'; import FastImage from 'react-native-fast-image';
// Constants // Constants
// Components // Components
import { Icon } from '../../icon';
import { IconButton } from '../../iconButton';
import { Modal } from '../..'; import { Modal } from '../..';
import { TextInput } from '../../textInput';
import SearchInput from '../../searchInput'; import SearchInput from '../../searchInput';
// Styles // Styles
@ -50,27 +47,11 @@ class SearchModalView extends PureComponent {
isTransparent isTransparent
> >
<View style={styles.container}> <View style={styles.container}>
<SafeAreaView style={styles.safeArea}> <SearchInput
<View style={styles.inputWrapper}> onChangeText={handleOnChangeSearchInput}
<Icon style={styles.icon} iconType="FontAwesome" name="search" size={15} /> handleOnModalClose={handleOnClose}
<TextInput placeholder={placeholder}
style={styles.input} />
onChangeText={text => handleOnChangeSearchInput(text)}
placeholder={placeholder}
placeholderTextColor="#c1c5c7"
autoCapitalize="none"
autoFocus
/>
<IconButton
iconStyle={styles.closeIcon}
iconType="Ionicons"
style={styles.closeIconButton}
name="ios-close-circle-outline"
onPress={() => handleOnClose()}
/>
</View>
</SafeAreaView>
<View style={styles.body}> <View style={styles.body}>
<FlatList <FlatList
data={searchResults.data} data={searchResults.data}

View File

@ -16,12 +16,24 @@ class SearchResultContainer extends PureComponent {
this.state = {}; this.state = {};
} }
_navigationGoBack = () => {
const { navigation } = this.props;
navigation.goBack();
};
render() { render() {
const { currentAccount, navigation } = this.props; const { currentAccount, navigation } = this.props;
const tag = navigation.getParam('tag', 'esteem'); const tag = navigation.getParam('tag', 'esteem');
return <SearchResultScreen currentAccount={currentAccount} tag={tag} />; return (
<SearchResultScreen
currentAccount={currentAccount}
tag={tag}
navigationGoBack={this._navigationGoBack}
/>
);
} }
} }

View File

@ -19,12 +19,17 @@ class SearchResultScreen extends PureComponent {
} }
render() { render() {
const { intl, tag } = this.props; const { intl, tag, navigationGoBack } = this.props;
return ( return (
<Fragment> <Fragment>
<View style={styles.container}> <View style={styles.container}>
<SearchInput /> <SearchInput
onChangeText={text => console.log('text :', text)}
handleOnModalClose={navigationGoBack}
placeholder={tag}
editable={false}
/>
<ScrollableTabView <ScrollableTabView
style={globalStyles.tabView} style={globalStyles.tabView}
renderTabBar={() => ( renderTabBar={() => (