Merge pull request #1421 from esteemapp/bugfix/dark-theme

fixed dark theme issues
This commit is contained in:
Mustafa Buyukcelebi 2019-12-18 22:06:58 +03:00 committed by GitHub
commit fcea96cad5
6 changed files with 14 additions and 14 deletions

View File

@ -529,4 +529,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: d4edbb9c1c57c5484f4893520a7865260cb898d3 PODFILE CHECKSUM: d4edbb9c1c57c5484f4893520a7865260cb898d3
COCOAPODS: 1.8.4 COCOAPODS: 1.8.3

View File

@ -46,11 +46,9 @@ const PostsView = ({
const [startPermlink, setStartPermlink] = useState(''); const [startPermlink, setStartPermlink] = useState('');
const [refreshing, setRefreshing] = useState(false); const [refreshing, setRefreshing] = useState(false);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [isShowFilterBar, setIsShowFilterBar] = useState(true);
const [selectedFilterIndex, setSelectedFilterIndex] = useState(selectedOptionIndex || 0); const [selectedFilterIndex, setSelectedFilterIndex] = useState(selectedOptionIndex || 0);
const [isNoPost, setIsNoPost] = useState(false); const [isNoPost, setIsNoPost] = useState(false);
const [promotedPosts, setPromotedPosts] = useState([]); const [promotedPosts, setPromotedPosts] = useState([]);
const [scrollOffsetY, setScrollOffsetY] = useState(0);
const [selectedFilterValue, setSelectedFilterValue] = useState( const [selectedFilterValue, setSelectedFilterValue] = useState(
filterOptionsValue && filterOptionsValue[selectedFilterIndex], filterOptionsValue && filterOptionsValue[selectedFilterIndex],
); );
@ -333,22 +331,17 @@ const PostsView = ({
); );
}; };
const _handleOnScroll = event => { const _handleOnScroll = () => {
const currentOffset = event.nativeEvent.contentOffset.y;
if (handleOnScroll) { if (handleOnScroll) {
handleOnScroll(); handleOnScroll();
} }
setScrollOffsetY(currentOffset);
setIsShowFilterBar(scrollOffsetY > currentOffset || scrollOffsetY <= 0);
}; };
return ( return (
<ThemeContainer> <ThemeContainer>
{({ isDarkTheme }) => ( {({ isDarkTheme }) => (
<View style={styles.container}> <View style={styles.container}>
{filterOptions && isShowFilterBar && ( {filterOptions && (
<FilterBar <FilterBar
dropdownIconName="arrow-drop-down" dropdownIconName="arrow-drop-down"
//options={filterOptions} //options={filterOptions}

View File

@ -464,7 +464,7 @@ export const getSettings = async () => {
} }
const settingData = { const settingData = {
language: '', language: '',
isDarkTheme: false, isDarkTheme: null,
currency: '', currency: '',
notification: true, notification: true,
server: '', server: '',

View File

@ -462,7 +462,11 @@ class ApplicationContainer extends Component {
const settings = await getSettings(); const settings = await getSettings();
if (settings) { if (settings) {
dispatch(isDarkTheme(nativeThemeInitialMode === 'dark' || settings.isDarkTheme)); dispatch(
isDarkTheme(
settings.isDarkTheme === null ? nativeThemeInitialMode === 'dark' : settings.isDarkTheme,
),
);
if (settings.isPinCodeOpen !== '') dispatch(isPinCodeOpen(settings.isPinCodeOpen)); if (settings.isPinCodeOpen !== '') dispatch(isPinCodeOpen(settings.isPinCodeOpen));
if (settings.language !== '') dispatch(setLanguage(settings.language)); if (settings.language !== '') dispatch(setLanguage(settings.language));
if (settings.server !== '') dispatch(setApi(settings.server)); if (settings.server !== '') dispatch(setApi(settings.server));

View File

@ -30,6 +30,10 @@ const Application = () => {
isThemeReady, isThemeReady,
isPinCodeRequire, isPinCodeRequire,
}) => { }) => {
if (showAnimation || !isReady || !isRenderRequire || !isThemeReady) {
return <Launch />;
}
return ( return (
<Fragment> <Fragment>
<Modal <Modal
@ -47,7 +51,6 @@ const Application = () => {
isReady={isReady} isReady={isReady}
isDarkTheme={isDarkTheme} isDarkTheme={isDarkTheme}
/> />
{(showAnimation || !isReady || !isRenderRequire || !isThemeReady) && <Launch />}
</Fragment> </Fragment>
); );
}} }}

View File

@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { createAppContainer } from 'react-navigation'; import { createAppContainer } from 'react-navigation';
import AppNavitation from '../../../navigation/routes'; import AppNavitation from '../../../navigation/routes';
import { setTopLevelNavigator } from '../../../navigation/service'; import { setTopLevelNavigator, navigate } from '../../../navigation/service';
// Services // Services
import { toastNotification as toastNotificationAction } from '../../../redux/actions/uiAction'; import { toastNotification as toastNotificationAction } from '../../../redux/actions/uiAction';