From 209b6056548f5f650ff2e6f75ed0738b5b9a640e Mon Sep 17 00:00:00 2001 From: ue Date: Sat, 26 Oct 2019 23:58:38 +0300 Subject: [PATCH 1/2] created themeContainer fixed markdown placeholder issue --- .../markdownEditor/view/markdownEditorView.js | 38 +++++++++++-------- src/containers/index.js | 2 + src/containers/themeContainer.js | 18 +++++++++ 3 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 src/containers/themeContainer.js diff --git a/src/components/markdownEditor/view/markdownEditorView.js b/src/components/markdownEditor/view/markdownEditorView.js index 4ceea3c11..02810b4e7 100644 --- a/src/components/markdownEditor/view/markdownEditorView.js +++ b/src/components/markdownEditor/view/markdownEditorView.js @@ -13,6 +13,8 @@ import { PostBody } from '../../postElements'; import { StickyBar } from '../../basicUIElements'; import { TextInput } from '../../textInput'; +import { ThemeContainer } from '../../../containers'; + // Styles import styles from './markdownEditorStyles'; @@ -201,22 +203,26 @@ export default class MarkdownEditorView extends Component { behavior={Platform.OS === 'ios' ? 'padding' : null} > {!isPreviewActive ? ( - + + {({ isDarkTheme }) => ( + + )} + ) : ( this._renderPreview() )} diff --git a/src/containers/index.js b/src/containers/index.js index 3d725da0a..2b9d0390a 100644 --- a/src/containers/index.js +++ b/src/containers/index.js @@ -5,6 +5,7 @@ import ProfileEditContainer from './profileEditContainer'; import RedeemContainer from './redeemContainer'; import SpinGameContainer from './spinGameContainer'; import TransferContainer from './transferContainer'; +import ThemeContainer from './themeContainer'; export { InAppPurchaseContainer, @@ -14,4 +15,5 @@ export { RedeemContainer, SpinGameContainer, TransferContainer, + ThemeContainer, }; diff --git a/src/containers/themeContainer.js b/src/containers/themeContainer.js new file mode 100644 index 000000000..22a24adff --- /dev/null +++ b/src/containers/themeContainer.js @@ -0,0 +1,18 @@ +/* eslint-disable no-unused-vars */ +import React from 'react'; +import { connect } from 'react-redux'; + +const ThemeContainer = ({ children, isDarkTheme }) => { + return ( + children && + children({ + isDarkTheme, + }) + ); +}; + +const mapStateToProps = state => ({ + isDarkTheme: state.application.isDarkTheme, +}); + +export default connect(mapStateToProps)(ThemeContainer); From b97c0902345209596193c0568233162132bdaf2d Mon Sep 17 00:00:00 2001 From: ue Date: Sun, 27 Oct 2019 00:18:42 +0300 Subject: [PATCH 2/2] removed unused isdarktheme props --- .../placeHolder/listItemPlaceHolderView.js | 52 ++++++++++--------- .../view/placeHolder/listPlaceHolderView.js | 8 +-- src/containers/redeemContainer.js | 1 - .../container/notificationContainer.js | 4 +- 4 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/components/basicUIElements/view/placeHolder/listItemPlaceHolderView.js b/src/components/basicUIElements/view/placeHolder/listItemPlaceHolderView.js index 807143c46..15a198e66 100644 --- a/src/components/basicUIElements/view/placeHolder/listItemPlaceHolderView.js +++ b/src/components/basicUIElements/view/placeHolder/listItemPlaceHolderView.js @@ -1,34 +1,38 @@ import React from 'react'; -import { connect } from 'react-redux'; import { View } from 'react-native'; import Placeholder from 'rn-placeholder'; +import { ThemeContainer } from '../../../../containers'; + import styles from './listItemPlaceHolderStyles'; -const ListItemPlaceHolderView = ({ isDarkTheme }) => { - const color = isDarkTheme ? '#2e3d51' : '#f5f5f5'; - +const ListItemPlaceHolderView = () => { return ( - - - - - - + + {({ isDarkTheme }) => ( + + + + + + + )} + ); }; -const mapStateToProps = state => ({ - isDarkTheme: state.application.isDarkTheme, -}); - -export default connect(mapStateToProps)(ListItemPlaceHolderView); +export default ListItemPlaceHolderView; diff --git a/src/components/basicUIElements/view/placeHolder/listPlaceHolderView.js b/src/components/basicUIElements/view/placeHolder/listPlaceHolderView.js index 4aea8d528..66478b5d0 100644 --- a/src/components/basicUIElements/view/placeHolder/listPlaceHolderView.js +++ b/src/components/basicUIElements/view/placeHolder/listPlaceHolderView.js @@ -1,6 +1,5 @@ /* eslint-disable radix */ import React, { Fragment } from 'react'; -import { connect } from 'react-redux'; import { Dimensions } from 'react-native'; import times from 'lodash/times'; @@ -18,9 +17,4 @@ const ListPlaceHolderView = () => { return {listElements}; }; - -const mapStateToProps = state => ({ - isDarkTheme: state.application.isDarkTheme, -}); - -export default connect(mapStateToProps)(ListPlaceHolderView); +export default ListPlaceHolderView; diff --git a/src/containers/redeemContainer.js b/src/containers/redeemContainer.js index 7a6383a6c..9e326c3ef 100644 --- a/src/containers/redeemContainer.js +++ b/src/containers/redeemContainer.js @@ -140,7 +140,6 @@ class RedeemContainer extends Component { const mapStateToProps = state => ({ username: state.account.currentAccount.name, - isDarkTheme: state.application.isDarkTheme, activeBottomTab: state.ui.activeBottomTab, isConnected: state.application.isConnected, accounts: state.account.otherAccounts, diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index 7814506b0..79136338b 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -151,13 +151,12 @@ class NotificationContainer extends Component { render() { const { isLoggedIn } = this.props; - const { notifications, isNotificationRefreshing, isDarkTheme } = this.state; + const { notifications, isNotificationRefreshing } = this.state; return ( ({ isLoggedIn: state.application.isLoggedIn, - isDarkTheme: state.application.isDarkTheme, isConnected: state.application.isConnected, username: state.account.currentAccount.name,