From 2acf206205894bb038c5f0504ff4da598fb1f681 Mon Sep 17 00:00:00 2001 From: ue Date: Wed, 30 Oct 2019 23:47:47 +0300 Subject: [PATCH] created acccount container enhanced header container & view convert to hooks && merged trending and feed --- .../container/basicHeaderContainer.js | 6 +- .../bottomTabBar/view/bottomTabBarView.js | 2 +- .../formInput/view/formInputStyles.js | 2 +- .../header/container/headerContainer.js | 99 ++++----- src/components/header/view/headerStyles.js | 5 +- src/components/header/view/headerView.js | 204 ++++++++---------- .../posts/container/postsContainer.js | 123 +++++------ src/components/posts/view/postsView.js | 67 ++---- .../textInput/view/textInputStyles.js | 1 + src/constants/options/filters.js | 18 +- src/constants/routeNames.js | 4 +- src/containers/accountContainer.js | 33 +++ src/containers/index.js | 2 + src/navigation/baseNavigator.js | 6 +- src/navigation/routes.js | 2 +- src/providers/esteem/esteem.js | 8 +- src/screens/feed/index.js | 4 + src/screens/feed/screen/feedScreen.js | 36 ++++ .../screen/feedStyles.js} | 0 src/screens/home/container/homeContainer.js | 38 ---- src/screens/home/index.js | 5 - src/screens/home/screen/homeScreen.js | 73 ------- src/screens/index.js | 4 +- .../pinCode/container/pinCodeContainer.js | 14 +- 24 files changed, 313 insertions(+), 443 deletions(-) create mode 100644 src/containers/accountContainer.js create mode 100644 src/screens/feed/index.js create mode 100644 src/screens/feed/screen/feedScreen.js rename src/screens/{home/screen/homeStyles.js => feed/screen/feedStyles.js} (100%) delete mode 100644 src/screens/home/container/homeContainer.js delete mode 100644 src/screens/home/index.js delete mode 100644 src/screens/home/screen/homeScreen.js diff --git a/src/components/basicHeader/container/basicHeaderContainer.js b/src/components/basicHeader/container/basicHeaderContainer.js index 724474c49..3b3c581af 100644 --- a/src/components/basicHeader/container/basicHeaderContainer.js +++ b/src/components/basicHeader/container/basicHeaderContainer.js @@ -26,13 +26,15 @@ class BasicHeaderContainer extends Component { if (isNewPost) { navigation.navigate({ - routeName: ROUTES.SCREENS.HOME, + routeName: ROUTES.SCREENS.FEED, }); } else { navigation.goBack(); } - if (handleOnBackPress) handleOnBackPress(); + if (handleOnBackPress) { + handleOnBackPress(); + } }; render() { diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index 007e516cc..3399f7852 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -21,7 +21,7 @@ import styles from './bottomTabBarStyles'; const _jumpTo = (route, index, routes, jumpTo) => { const _routeName = routes[index].routeName; - if (!!get(route, 'params.scrollToTop') && _routeName === ROUTES.TABBAR.HOME) { + if (!!get(route, 'params.scrollToTop') && _routeName === ROUTES.TABBAR.FEED) { route.params.scrollToTop(); } diff --git a/src/components/formInput/view/formInputStyles.js b/src/components/formInput/view/formInputStyles.js index 3c46154da..a87f57620 100644 --- a/src/components/formInput/view/formInputStyles.js +++ b/src/components/formInput/view/formInputStyles.js @@ -6,9 +6,9 @@ export default EStyleSheet.create({ borderTopRightRadius: 8, marginTop: 16, flexDirection: 'row', - backgroundColor: '$primaryLightBackground', height: 60, borderBottomWidth: 2, + backgroundColor: '$primaryWhiteLightBackground', }, firstImage: { width: 24, diff --git a/src/components/header/container/headerContainer.js b/src/components/header/container/headerContainer.js index 6a8871cac..8b4a910d1 100644 --- a/src/components/header/container/headerContainer.js +++ b/src/components/header/container/headerContainer.js @@ -1,80 +1,53 @@ -import React, { PureComponent } from 'react'; +import React from 'react'; import { withNavigation } from 'react-navigation'; -import { connect } from 'react-redux'; -import { get, has } from 'lodash'; +import get from 'lodash/get'; +import has from 'lodash/has'; // Component import HeaderView from '../view/headerView'; -/* - * Props Name Description Value - *@props --> props name here description here Value Type Here - * - */ - -class HeaderContainer extends PureComponent { - constructor(props) { - super(props); - this.state = {}; - } - - // Component Life Cycle Functions - - // Component Functions - - _handleOpenDrawer = () => { - const { navigation } = this.props; +import { AccountContainer, ThemeContainer } from '../../../containers'; +const HeaderContainer = ({ selectedUser, isReverse, navigation, handleOnBackPress }) => { + const _handleOpenDrawer = () => { if (has(navigation, 'openDrawer') && typeof get(navigation, 'openDrawer') === 'function') { navigation.openDrawer(); } }; - _handleOnPressBackButton = () => { - const { navigation, handleOnBackPress } = this.props; - - if (handleOnBackPress) handleOnBackPress(); + const _handleOnPressBackButton = () => { + if (handleOnBackPress) { + handleOnBackPress(); + } navigation.goBack(); }; - render() { - const { - isLoggedIn, - currentAccount, - selectedUser, - isReverse, - isLoginDone, - isDarkTheme, - } = this.props; - const _user = isReverse && selectedUser ? selectedUser : currentAccount; + return ( + + {({ isDarkTheme }) => ( + + {({ currentAccount, isLoggedIn, isLoginDone }) => { + const _user = isReverse && selectedUser ? selectedUser : currentAccount; - const displayName = get(_user, 'display_name'); - const username = get(_user, 'name'); - const reputation = get(_user, 'reputation'); + return ( + + ); + }} + + )} + + ); +}; - return ( - - ); - } -} - -const mapStateToProps = state => ({ - isLoggedIn: state.application.isLoggedIn, - isLoginDone: state.application.isLoginDone, - isDarkTheme: state.application.isDarkTheme, - - currentAccount: state.account.currentAccount, -}); - -export default connect(mapStateToProps)(withNavigation(HeaderContainer)); +export default withNavigation(HeaderContainer); diff --git a/src/components/header/view/headerStyles.js b/src/components/header/view/headerStyles.js index 0910ee81a..bf4edf9e1 100644 --- a/src/components/header/view/headerStyles.js +++ b/src/components/header/view/headerStyles.js @@ -7,7 +7,7 @@ export default EStyleSheet.create({ width: '$deviceWidth', backgroundColor: '$primaryBackgroundColor', flex: 1, - maxHeight: Platform.OS === 'ios' ? 95 : 80, + maxHeight: Platform.OS === 'ios' ? 105 : 80, }, containerReverse: { justifyContent: 'space-between', @@ -33,8 +33,7 @@ export default EStyleSheet.create({ titleWrapper: { flexDirection: 'column', justifyContent: 'center', - marginLeft: 8, - marginRight: 8, + marginHorizontal: 8, }, title: { fontSize: 14, diff --git a/src/components/header/view/headerView.js b/src/components/header/view/headerView.js index a6b50aef4..d24df9997 100644 --- a/src/components/header/view/headerView.js +++ b/src/components/header/view/headerView.js @@ -1,131 +1,107 @@ -import React, { Component } from 'react'; +import React, { useState } from 'react'; import { View, Text, SafeAreaView, TouchableOpacity } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; -import { injectIntl } from 'react-intl'; +import { useIntl } from 'react-intl'; // Components import { SearchModal } from '../../searchModal'; import { IconButton } from '../../iconButton'; import { UserAvatar } from '../../userAvatar'; + // Styles import styles from './headerStyles'; -class HeaderView extends Component { - /* Props - * ------------------------------------------------ - * @prop { boolean } hideStatusBar - Can declare status bar is hide or not. - * - */ +const HeaderView = ({ + displayName, + handleOnPressBackButton, + handleOpenDrawer, + isDarkTheme, + isLoggedIn, + isLoginDone, + isReverse, + reputation, + username, +}) => { + const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); + const intl = useIntl(); + let gradientColor; - constructor(props) { - super(props); - this.state = { - isSearchModalOpen: false, - }; + if (isReverse) { + gradientColor = isDarkTheme ? ['#43638e', '#081c36'] : ['#357ce6', '#2d5aa0']; + } else { + gradientColor = isDarkTheme ? ['#081c36', '#43638e'] : ['#2d5aa0', '#357ce6']; } - // Component Life Cycles - - // Component Functions - - _handleOnCloseSearch = () => { - this.setState({ isSearchModalOpen: false }); - }; - - render() { - const { - displayName, - handleOnPressBackButton, - handleOpenDrawer, - intl, - isDarkTheme, - isLoggedIn, - isLoginDone, - isReverse, - reputation, - username, - } = this.props; - const { isSearchModalOpen } = this.state; - let gredientColor; - - if (isReverse) { - gredientColor = isDarkTheme ? ['#43638e', '#081c36'] : ['#357ce6', '#2d5aa0']; - } else { - gredientColor = isDarkTheme ? ['#081c36', '#43638e'] : ['#2d5aa0', '#357ce6']; - } - - return ( - - - handleOpenDrawer()} - disabled={isReverse} + return ( + + setIsSearchModalOpen(false)} + /> + + - - - - - {displayName || username ? ( - - {displayName && {displayName}} - - {`@${username}`} - {reputation && ` (${reputation})`} + + + + {displayName || username ? ( + + {displayName && {displayName}} + + {`@${username}`} + {reputation && ` (${reputation})`} + + + ) : ( + + {isLoginDone && !isLoggedIn && ( + + {intl.formatMessage({ + id: 'header.title', + })} - - ) : ( - - {isLoginDone && !isLoggedIn && ( - - {intl.formatMessage({ - id: 'header.title', - })} - - )} - - )} - {isReverse && ( - - handleOnPressBackButton()} - /> - - )} + )} + + )} - {!isReverse && ( - - this.setState({ isSearchModalOpen: true })} - /> - - )} - - ); - } -} + {isReverse ? ( + + handleOnPressBackButton()} + /> + + ) : ( + + setIsSearchModalOpen(true)} + /> + + )} + + ); +}; -export default injectIntl(HeaderView); +export default HeaderView; diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index 4e5e4d89a..64da5170b 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -1,94 +1,69 @@ -import React, { PureComponent } from 'react'; -import { connect } from 'react-redux'; -import get from 'lodash/get'; +import React from 'react'; +import { connect, useDispatch } from 'react-redux'; // Component import PostsView from '../view/postsView'; +// Container +import { AccountContainer } from '../../../containers'; + // Actions import { setFeedPosts } from '../../../redux/actions/postsAction'; import { hidePostsThumbnails } from '../../../redux/actions/uiAction'; -/* - * Props Name Description Value - *@props --> props name here description here Value Type Here - * - */ - -class PostsContainer extends PureComponent { - constructor(props) { - super(props); - this.state = { - promotedPosts: [], - }; - } - - // Component Life Cycle Functions - - // Component Functions - - _setFeedPosts = posts => { - const { dispatch } = this.props; +const PostsContainer = ({ + changeForceLoadPostState, + feedPosts, + filterOptions, + forceLoadPost, + getFor, + handleOnScroll, + isConnected, + isHideImages, + pageType, + selectedOptionIndex, + tag, + nsfw, +}) => { + const dispatch = useDispatch(); + const _setFeedPosts = posts => { dispatch(setFeedPosts(posts)); }; - _handleImagesHide = () => { - const { dispatch, isHideImages } = this.props; - + const _handleImagesHide = () => { dispatch(hidePostsThumbnails(!isHideImages)); }; - render() { - const { - changeForceLoadPostState, - currentAccount, - feedPosts, - filterOptions, - forceLoadPost, - getFor, - handleOnScroll, - isConnected, - isHideImages, - pageType, - selectedOptionIndex, - tag, - isLoginDone, - isLoggedIn, - nsfw, - } = this.props; - const { promotedPosts } = this.state; - - return ( - - ); - } -} + return ( + + {({ username, isLoggedIn, isLoginDone }) => ( + + )} + + ); +}; const mapStateToProps = state => ({ - currentAccount: state.account.currentAccount, - isLoggedIn: state.application.isLoggedIn, - isLoginDone: state.application.isLoginDone, nsfw: state.application.nsfw, feedPosts: state.posts.feedPosts, isConnected: state.application.isConnected, diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 28d7985fc..80632a581 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -13,7 +13,6 @@ import { getPromotePosts } from '../../../providers/esteem/esteem'; import { PostCard } from '../../postCard'; import { FilterBar } from '../../filterBar'; import { PostCardPlaceHolder, NoPost } from '../../basicUIElements'; -import { POPULAR_FILTERS, PROFILE_FILTERS } from '../../../constants/options/filters'; import { ThemeContainer } from '../../../containers'; // Styles @@ -39,15 +38,6 @@ class PostsView extends Component { }; } - // Component Functions - componentWillMount() { - const { navigation } = this.props; - - navigation.setParams({ - scrollToTop: this._scrollToTop, - }); - } - async componentDidMount() { const { isConnected, pageType } = this.props; @@ -97,25 +87,24 @@ class PostsView extends Component { _getPromotePosts = async () => { const { currentAccountUsername } = this.props; - await getPromotePosts().then(async res => { - if (res && res.length) { - const promotedPosts = await Promise.all( - res.map(item => - getPost(get(item, 'author'), get(item, 'permlink'), currentAccountUsername, true).then( - post => post, + await getPromotePosts() + .then(async res => { + if (res && res.length) { + const promotedPosts = await Promise.all( + res.map(item => + getPost( + get(item, 'author'), + get(item, 'permlink'), + currentAccountUsername, + true, + ).then(post => post), ), - ), - ); + ); - this.setState({ promotedPosts }); - } - }); - }; - - _scrollToTop = () => { - if (this.flatList) { - this.flatList.scrollToOffset({ x: 0, y: 0, animated: true }); - } + this.setState({ promotedPosts }); + } + }) + .catch(() => {}); }; _loadPosts = async () => { @@ -123,10 +112,10 @@ class PostsView extends Component { getFor, tag, currentAccountUsername, - pageType, nsfw, setFeedPosts, isConnected, + filterOptions, } = this.props; const { posts, @@ -137,10 +126,7 @@ class PostsView extends Component { isLoading, promotedPosts, } = this.state; - const filter = - pageType === 'posts' - ? POPULAR_FILTERS[selectedFilterIndex].toLowerCase() - : PROFILE_FILTERS[selectedFilterIndex].toLowerCase(); + const filter = filterOptions[selectedFilterIndex].toLowerCase(); let options; const limit = 3; @@ -157,12 +143,7 @@ class PostsView extends Component { } this.setState({ isLoading: true }); - if (tag || filter === 'feed' || filter === 'blog' || getFor === 'blog') { - options = { - tag, - limit, - }; - } else if (filter === 'reblogs') { + if (filter === 'feed' || filter === 'blog' || getFor === 'blog' || filter === 'reblogs') { options = { tag, limit, @@ -359,12 +340,7 @@ class PostsView extends Component { render() { const { refreshing, posts, isShowFilterBar } = this.state; - const { - filterOptions, - selectedOptionIndex, - isHideImage, - handleImagesHide, - } = this.props; + const { filterOptions, selectedOptionIndex, isHideImage, handleImagesHide } = this.props; return ( @@ -413,9 +389,6 @@ class PostsView extends Component { )} } - ref={ref => { - this.flatList = ref; - }} /> ); diff --git a/src/components/textInput/view/textInputStyles.js b/src/components/textInput/view/textInputStyles.js index 2d00237e5..3bb825c83 100644 --- a/src/components/textInput/view/textInputStyles.js +++ b/src/components/textInput/view/textInputStyles.js @@ -15,5 +15,6 @@ export default EStyleSheet.create({ input: { flex: 1, minHeight: 50, + backgroundColor: '$primaryWhiteLightBackground', }, }); diff --git a/src/constants/options/filters.js b/src/constants/options/filters.js index 0baaad66d..875572f89 100644 --- a/src/constants/options/filters.js +++ b/src/constants/options/filters.js @@ -1,10 +1,10 @@ -export const POPULAR_FILTERS = [ - 'TRENDING', - 'HOT', - 'CREATED', - 'ACTIVE', - 'PROMOTED', - 'VOTES', - 'CHILDREN', -]; +export const POPULAR_FILTERS = ['TRENDING', 'HOT', 'NEW', 'PROMOTED']; export const PROFILE_FILTERS = ['BLOG', 'FEED']; + +// 'TRENDING', +// 'HOT', +// 'CREATED', +// 'ACTIVE', +// 'PROMOTED', +// 'VOTES', +// 'CHILDREN', diff --git a/src/constants/routeNames.js b/src/constants/routeNames.js index 11ec28eb7..714b1ac4c 100644 --- a/src/constants/routeNames.js +++ b/src/constants/routeNames.js @@ -11,7 +11,7 @@ export default { EDITOR: `Editor${SCREEN_SUFFIX}`, FOLLOWS: `Follows${SCREEN_SUFFIX}`, SPIN_GAME: `SpinGame${SCREEN_SUFFIX}`, - HOME: `Home${SCREEN_SUFFIX}`, + FEED: `Feed${SCREEN_SUFFIX}`, LOGIN: `Login${SCREEN_SUFFIX}`, PINCODE: `PinCode${SCREEN_SUFFIX}`, POST: `Post${SCREEN_SUFFIX}`, @@ -29,7 +29,7 @@ export default { MAIN: `Main${DRAWER_SUFFIX}`, }, TABBAR: { - HOME: `Home${TABBAR_SUFFIX}`, + FEED: `Feed${TABBAR_SUFFIX}`, NOTIFICATION: `Notification${TABBAR_SUFFIX}`, POINTS: `Points${TABBAR_SUFFIX}`, POST_BUTTON: `PostButton${TABBAR_SUFFIX}`, diff --git a/src/containers/accountContainer.js b/src/containers/accountContainer.js new file mode 100644 index 000000000..dc3d6711a --- /dev/null +++ b/src/containers/accountContainer.js @@ -0,0 +1,33 @@ +/* eslint-disable no-unused-vars */ +import React from 'react'; +import { connect } from 'react-redux'; + +const AccountContainer = ({ + accounts, + children, + currentAccount, + isLoggedIn, + isLoginDone, + username, +}) => { + return ( + children && + children({ + accounts, + currentAccount, + isLoggedIn, + isLoginDone, + username, + }) + ); +}; + +const mapStateToProps = state => ({ + accounts: state.account.otherAccounts, + currentAccount: state.account.currentAccount, + isLoggedIn: state.application.isLoggedIn, + isLoginDone: state.application.isLoginDone, + username: state.account.currentAccount.name, +}); + +export default connect(mapStateToProps)(AccountContainer); diff --git a/src/containers/index.js b/src/containers/index.js index 2b9d0390a..eda2d5363 100644 --- a/src/containers/index.js +++ b/src/containers/index.js @@ -1,3 +1,4 @@ +import AccountContainer from './accountContainer'; import InAppPurchaseContainer from './inAppPurchaseContainer'; import PointsContainer from './pointsContainer'; import ProfileContainer from './profileContainer'; @@ -8,6 +9,7 @@ import TransferContainer from './transferContainer'; import ThemeContainer from './themeContainer'; export { + AccountContainer, InAppPurchaseContainer, PointsContainer, ProfileContainer, diff --git a/src/navigation/baseNavigator.js b/src/navigation/baseNavigator.js index 6af0acd63..c86558efb 100644 --- a/src/navigation/baseNavigator.js +++ b/src/navigation/baseNavigator.js @@ -6,13 +6,13 @@ import ROUTES from '../constants/routeNames'; // Components import { Icon, IconContainer } from '../components/icon'; -import { Home, Notification, Profile, Points } from '../screens'; +import { Feed, Notification, Profile, Points } from '../screens'; import { PostButton, BottomTabBar } from '../components'; const BaseNavigator = createBottomTabNavigator( { - [ROUTES.TABBAR.HOME]: { - screen: Home, + [ROUTES.TABBAR.FEED]: { + screen: Feed, navigationOptions: () => ({ tabBarIcon: ({ tintColor }) => ( diff --git a/src/navigation/routes.js b/src/navigation/routes.js index 56d5dd2aa..40c83dd5e 100644 --- a/src/navigation/routes.js +++ b/src/navigation/routes.js @@ -31,7 +31,7 @@ import { SideMenu } from '../components'; const mainNavigation = createDrawerNavigator( { - [ROUTES.SCREENS.HOME]: { + [ROUTES.SCREENS.FEED]: { screen: BaseNavigator, }, }, diff --git a/src/providers/esteem/esteem.js b/src/providers/esteem/esteem.js index ca128b25e..aa8c0c52f 100644 --- a/src/providers/esteem/esteem.js +++ b/src/providers/esteem/esteem.js @@ -357,7 +357,13 @@ export const getSCAccessToken = code => api.post('/sc-token-refresh', { code }).then(resp => resolve(resp.data)); }); -export const getPromotePosts = () => api.get('/promoted-posts').then(resp => resp.data); +export const getPromotePosts = () => { + try { + return api.get('/promoted-posts').then(resp => resp.data); + } catch (error) { + return error; + } +}; export const purchaseOrder = data => api.post('/purchase-order', data).then(resp => resp.data); diff --git a/src/screens/feed/index.js b/src/screens/feed/index.js new file mode 100644 index 000000000..a3aa6e9ce --- /dev/null +++ b/src/screens/feed/index.js @@ -0,0 +1,4 @@ +import Feed from './screen/feedScreen'; + +export { Feed }; +export default Feed; diff --git a/src/screens/feed/screen/feedScreen.js b/src/screens/feed/screen/feedScreen.js new file mode 100644 index 000000000..a085fff2e --- /dev/null +++ b/src/screens/feed/screen/feedScreen.js @@ -0,0 +1,36 @@ +import React, { Fragment } from 'react'; +import { SafeAreaView } from 'react-native'; +import get from 'lodash/get'; + +// Components +import { Posts, Header } from '../../../components'; + +// Container +import { AccountContainer } from '../../../containers'; + +// Styles +import styles from './feedStyles'; + +import { POPULAR_FILTERS, PROFILE_FILTERS } from '../../../constants/options/filters'; + +const FeedScreen = () => { + return ( + + {({ currentAccount, isLoggedIn }) => ( + +
+ + + + + )} + + ); +}; + +export default FeedScreen; diff --git a/src/screens/home/screen/homeStyles.js b/src/screens/feed/screen/feedStyles.js similarity index 100% rename from src/screens/home/screen/homeStyles.js rename to src/screens/feed/screen/feedStyles.js diff --git a/src/screens/home/container/homeContainer.js b/src/screens/home/container/homeContainer.js deleted file mode 100644 index 670fd4f44..000000000 --- a/src/screens/home/container/homeContainer.js +++ /dev/null @@ -1,38 +0,0 @@ -import React, { PureComponent } from 'react'; -import { connect } from 'react-redux'; - -// Component -import HomeScreen from '../screen/homeScreen'; - -/* - * Props Name Description Value - *@props --> props name here description here Value Type Here - * - */ - -class HomeContainer extends PureComponent { - constructor(props) { - super(props); - this.state = {}; - } - - render() { - const { isLoggedIn, isLoginDone, currentAccount } = this.props; - - return ( - - ); - } -} - -const mapStateToProps = state => ({ - isLoggedIn: state.application.isLoggedIn, - isLoginDone: state.application.isLoginDone, - currentAccount: state.account.currentAccount, -}); - -export default connect(mapStateToProps)(HomeContainer); diff --git a/src/screens/home/index.js b/src/screens/home/index.js deleted file mode 100644 index b73835b3d..000000000 --- a/src/screens/home/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import HomeScreen from './screen/homeScreen'; -import Home from './container/homeContainer'; - -export { HomeScreen, Home }; -export default Home; diff --git a/src/screens/home/screen/homeScreen.js b/src/screens/home/screen/homeScreen.js deleted file mode 100644 index 8201afdf4..000000000 --- a/src/screens/home/screen/homeScreen.js +++ /dev/null @@ -1,73 +0,0 @@ -import React, { PureComponent, Fragment } from 'react'; -import { View, SafeAreaView } from 'react-native'; -import ScrollableTabView from 'react-native-scrollable-tab-view'; -import { injectIntl } from 'react-intl'; - -// Components -import { TabBar, Posts, Header } from '../../../components'; - -// Styles -import styles from './homeStyles'; -import globalStyles from '../../../globalStyles'; - -import { POPULAR_FILTERS, PROFILE_FILTERS } from '../../../constants/options/filters'; - -class HomeScreen extends PureComponent { - constructor(props) { - super(props); - this.state = {}; - } - - render() { - const { currentAccount, intl, isLoggedIn } = this.props; - - return ( - -
- - ( - - )} - > - - - - - - - - - - ); - } -} - -export default injectIntl(HomeScreen); diff --git a/src/screens/index.js b/src/screens/index.js index d717c6ad1..5de20e384 100755 --- a/src/screens/index.js +++ b/src/screens/index.js @@ -2,7 +2,7 @@ import { Bookmarks } from './bookmarks'; import { Drafts } from './drafts'; import { Editor } from './editor'; import { Follows } from './follows'; -import { Home } from './home'; +import { Feed } from './feed'; import { Launch } from './launch'; import { Login } from './login'; import { Notification } from './notification'; @@ -27,7 +27,7 @@ export { Drafts, Editor, Follows, - Home, + Feed, Launch, Login, Notification, diff --git a/src/screens/pinCode/container/pinCodeContainer.js b/src/screens/pinCode/container/pinCodeContainer.js index 4548cec71..9f99ddbfc 100644 --- a/src/screens/pinCode/container/pinCodeContainer.js +++ b/src/screens/pinCode/container/pinCodeContainer.js @@ -108,7 +108,9 @@ class PinCodeContainer extends Component { dispatch(updateCurrentAccount({ ..._currentAccount })); this._savePinCode(pin); - if (callback) callback(pin, oldPinCode); + if (callback) { + callback(pin, oldPinCode); + } dispatch(closePinCodeModal()); if (navigateTo) { const navigateAction = NavigationActions.navigate({ @@ -171,7 +173,9 @@ class PinCodeContainer extends Component { setExistUser(true).then(() => { this._savePinCode(pin); - if (callback) callback(pin, oldPinCode); + if (callback) { + callback(pin, oldPinCode); + } dispatch(closePinCodeModal()); if (navigateTo) { const navigateAction = NavigationActions.navigate({ @@ -197,7 +201,7 @@ class PinCodeContainer extends Component { } = this.props; const { oldPinCode } = this.state; - // If the user is exist, we are just checking to pin and navigating to home screen + // If the user is exist, we are just checking to pin and navigating to feed screen const pinData = { pinCode: pin, password: currentAccount ? currentAccount.password : '', @@ -213,7 +217,9 @@ class PinCodeContainer extends Component { [_currentAccount.local] = realmData; dispatch(updateCurrentAccount({ ..._currentAccount })); dispatch(closePinCodeModal()); - if (callback) callback(pin, oldPinCode); + if (callback) { + callback(pin, oldPinCode); + } if (navigateTo) { const navigateAction = NavigationActions.navigate({ routeName: navigateTo,