From be6d9c264ae7fddd1e0b5903e0b32cbeb9f311b6 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Tue, 12 Apr 2022 17:39:15 +0430 Subject: [PATCH] reza fixed compo colors before Contact --- src/screens/Blogs/index.js | 3 --- src/screens/Blogs/layouts/Hashtags.js | 8 ++++---- src/screens/Blogs/layouts/Header.js | 15 ++++++++------- src/screens/Blogs/layouts/New.js | 24 ++++++++++-------------- src/screens/Blogs/layouts/Single.js | 11 +++++------ src/screens/Blogs/layouts/Target.js | 19 +++++++++++-------- 6 files changed, 38 insertions(+), 42 deletions(-) diff --git a/src/screens/Blogs/index.js b/src/screens/Blogs/index.js index 3fb43ca..ae14847 100644 --- a/src/screens/Blogs/index.js +++ b/src/screens/Blogs/index.js @@ -1,6 +1,5 @@ import React from "react"; import { - View, StyleSheet, ScrollView, SafeAreaView, @@ -24,8 +23,6 @@ import Target from "./layouts/Target"; //style import tw from "tailwind-rn"; -import fontSize from "../../constants/fontSize"; -import Colors from "../../constants/Colors"; function Blogs({ getList, blogs }) { const [position, setPosition] = React.useState("100%"); diff --git a/src/screens/Blogs/layouts/Hashtags.js b/src/screens/Blogs/layouts/Hashtags.js index e1fbba2..6ab2a09 100644 --- a/src/screens/Blogs/layouts/Hashtags.js +++ b/src/screens/Blogs/layouts/Hashtags.js @@ -1,5 +1,5 @@ import React from "react"; -import { View, Text, FlatList, Appearance } from "react-native"; +import { View, Text, FlatList } from "react-native"; import { connect } from "react-redux"; import Svg, { Path } from "react-native-svg"; @@ -8,15 +8,14 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -export const Hashtags = ({ hashtags }) => { - const colorScheme = Appearance.getColorScheme(); +export const Hashtags = ({ hashtags, theme }) => { return ( @@ -59,6 +58,7 @@ const Hashtag = ({ hashtag }) => { const mapStateToProps = (state) => ({ hashtags: state.blog.hashtags, + theme: state.publicApi.theme }); const mapDispatchToProps = {}; diff --git a/src/screens/Blogs/layouts/Header.js b/src/screens/Blogs/layouts/Header.js index c8e5870..ba8e787 100644 --- a/src/screens/Blogs/layouts/Header.js +++ b/src/screens/Blogs/layouts/Header.js @@ -1,5 +1,5 @@ import React from "react"; -import { View, Text, Appearance } from "react-native"; +import { View, Text } from "react-native"; import { connect } from "react-redux"; //style @@ -7,8 +7,7 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -export const Header = ({ title }) => { - const colorScheme = Appearance.getColorScheme(); +export const Header = ({ title, theme }) => { return ( { tw("py-2.5 pr-2.5 pl-5"), { fontSize: fontSize.base, - color: Colors.theme1[colorScheme].white, - backgroundColor: Colors.theme1[colorScheme].black, + color: Colors.theme1[theme].white, + backgroundColor: Colors.theme1[theme].black, fontFamily : 'bold' }, ]} > {title} - + ); }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + theme: state.publicApi.theme +}); const mapDispatchToProps = {}; diff --git a/src/screens/Blogs/layouts/New.js b/src/screens/Blogs/layouts/New.js index 40711db..88b9613 100644 --- a/src/screens/Blogs/layouts/New.js +++ b/src/screens/Blogs/layouts/New.js @@ -1,13 +1,6 @@ import React from "react"; -import { - View, - Text, - Dimensions, - Pressable, - Image, - Appearance, - Platform, -} from "react-native"; +import { Text, Dimensions, Pressable, Image, Platform } from "react-native"; +import { connect } from "react-redux"; import { useNavigation } from "@react-navigation/native"; //style @@ -18,9 +11,8 @@ import Colors from "../../../constants/Colors"; const { width } = Dimensions.get("window"); const ios = Platform.OS === "ios"; -export const New = ({ blog }) => { +export const New = ({ blog, theme }) => { const navigation = useNavigation(); - const colorScheme = Appearance.getColorScheme(); return ( { style={{ fontSize: fontSize.tiny, fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, marginTop: 5, textAlign: ios ? "right" : "auto", }} @@ -54,7 +46,7 @@ export const New = ({ blog }) => { style={{ fontSize: fontSize.xs, fontFamily: "regular", - color: Colors.theme1[colorScheme].gray2077, + color: Colors.theme1[theme].gray2077, textAlign: ios ? "right" : "auto", marginTop: 5, }} @@ -65,4 +57,8 @@ export const New = ({ blog }) => { ); }; -export default New; +const mapStateToProps = (state) => ({ + theme: state.publicApi.theme, +}); + +export default connect(mapStateToProps)(New); diff --git a/src/screens/Blogs/layouts/Single.js b/src/screens/Blogs/layouts/Single.js index d6bf5c0..5062fb7 100644 --- a/src/screens/Blogs/layouts/Single.js +++ b/src/screens/Blogs/layouts/Single.js @@ -5,7 +5,6 @@ import { Text, Dimensions, Image, - Appearance, Platform, } from "react-native"; import { connect } from "react-redux"; @@ -17,12 +16,11 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -const { height, width } = Dimensions.get("window"); +const { width } = Dimensions.get("window"); const ios = Platform.OS === "ios"; -export const Single = ({ blog }) => { +export const Single = ({ blog, theme }) => { const navigation = useNavigation(); - const colorScheme = Appearance.getColorScheme(); return ( { style={{ fontFamily: "bold", fontSize: fontSize.lg, - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, textAlign: ios ? "right" : "auto", }} > @@ -121,7 +119,7 @@ export const Single = ({ blog }) => { style={{ fontFamily: "regular", fontSize: fontSize.sm, - color: Colors.theme1[colorScheme].gray2077, + color: Colors.theme1[theme].gray2077, lineHeight: 25, marginTop: 10, textAlign: ios ? "right" : "auto", @@ -140,6 +138,7 @@ export const Single = ({ blog }) => { const mapStateToProps = (state) => ({ blog: state.blog.list[0], + theme: state.publicApi.theme }); const mapDispatchToProps = {}; diff --git a/src/screens/Blogs/layouts/Target.js b/src/screens/Blogs/layouts/Target.js index 0411d51..553695a 100644 --- a/src/screens/Blogs/layouts/Target.js +++ b/src/screens/Blogs/layouts/Target.js @@ -17,12 +17,11 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -const { height, width } = Dimensions.get("window"); +const { width } = Dimensions.get("window"); const ios = Platform.OS === "ios"; -const Target = ({ blogs }) => { +const Target = ({ blogs, theme }) => { const navigation = useNavigation(); - const colorScheme = Appearance.getColorScheme(); const Large = ({ blog }) => { return ( { style={[ { fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, fontSize: fontSize.tiny, }, ]} @@ -85,7 +84,7 @@ const Target = ({ blogs }) => { style={[ { fontFamily: "regular", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, fontSize: fontSize.xs, }, ]} @@ -99,7 +98,7 @@ const Target = ({ blogs }) => { style={[ { fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, fontSize: fontSize.sm, }, ]} @@ -111,7 +110,7 @@ const Target = ({ blogs }) => { tw("mt-0"), { fontFamily: "bold", - color: Colors.theme1[colorScheme].gray20, + color: Colors.theme1[theme].gray20, fontSize: fontSize.sm, }, ]} @@ -167,4 +166,8 @@ const Target = ({ blogs }) => { ); }; -export default Target; +const mapStateToProps = (state) => ({ + theme: state.publicApi.theme, +}); + +export default connect(mapStateToProps)(Target);