From dc410b756758d534628373635d18ea9421f68f9e Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Tue, 26 Feb 2019 14:51:47 +0300 Subject: [PATCH] Added click method for tag component --- src/components/basicUIElements/index.js | 2 +- .../basicUIElements/view/tag/tagContainer.js | 55 +++++++++++++++++++ .../searchInput/view/searchInputView.js | 4 +- .../searchResult/screen/searchResultScreen.js | 3 +- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 src/components/basicUIElements/view/tag/tagContainer.js diff --git a/src/components/basicUIElements/index.js b/src/components/basicUIElements/index.js index b01fed0f1..f308548e5 100644 --- a/src/components/basicUIElements/index.js +++ b/src/components/basicUIElements/index.js @@ -8,7 +8,7 @@ import PostCardPlaceHolder from './view/placeHolder/postCardPlaceHolderView'; import PostPlaceHolder from './view/placeHolder/postPlaceHolderView'; import ProfileSummaryPlaceHolder from './view/placeHolder/profileSummaryPlaceHolder'; import StickyBar from './view/stickyBar/stickyBarView'; -import Tag from './view/tag/tagView'; +import Tag from './view/tag/tagContainer'; import TextWithIcon from './view/textWithIcon/textWithIconView'; import UserListItem from './view/userListItem/userListItem'; import WalletDetailsPlaceHolder from './view/placeHolder/walletDetailsPlaceHolder'; diff --git a/src/components/basicUIElements/view/tag/tagContainer.js b/src/components/basicUIElements/view/tag/tagContainer.js new file mode 100644 index 000000000..0adb8ab53 --- /dev/null +++ b/src/components/basicUIElements/view/tag/tagContainer.js @@ -0,0 +1,55 @@ +import React, { PureComponent } from 'react'; +import { withNavigation } from 'react-navigation'; + +// Services and Actions + +// Middleware + +// Constants +import ROUTES from '../../../../constants/routeNames'; + +// Utilities + +// Component +import TagView from './tagView'; + +/* + * Props Name Description Value + *@props --> props name here description here Value Type Here + * + */ + +class TagContainer extends PureComponent { + // Component Life Cycle Functions + + // Component Functions + _handleOnTagPress = () => { + const { navigation, onPress, value } = this.props; + + if (onPress) { + onPress(); + } else { + navigation.navigate({ + routeName: ROUTES.SCREENS.SEARCH_RESULT, + params: { + tag: value, + }, + }); + } + }; + + render() { + const { isPin, value, isPostCardTag } = this.props; + + return ( + + ); + } +} + +export default withNavigation(TagContainer); diff --git a/src/components/searchInput/view/searchInputView.js b/src/components/searchInput/view/searchInputView.js index 41a448cfb..e310e76e9 100644 --- a/src/components/searchInput/view/searchInputView.js +++ b/src/components/searchInput/view/searchInputView.js @@ -14,7 +14,7 @@ import styles from './searchInputStyles'; * @prop { type } name - Description.... */ const SearchInputView = ({ - onChangeText, handleOnModalClose, placeholder, editable = true, + onChangeText, handleOnModalClose, placeholder, editable = true, autoFocus = true, }) => ( @@ -25,7 +25,7 @@ const SearchInputView = ({ placeholder={placeholder} placeholderTextColor="#c1c5c7" autoCapitalize="none" - autoFocus + autoFocus={autoFocus} editable={editable} /> console.log('text :', text)} handleOnModalClose={navigationGoBack} - placeholder={tag} + placeholder={`#${tag}`} editable={false} + autoFocus={false} />