reza fixed login bug

master
Reza_ashrafi 3 years ago
parent 388573268f
commit df449885cd
  1. 1
      src/components/CustomTextInput.js
  2. 10
      src/components/Drawer.js
  3. 2
      src/redux/reducers/user.js
  4. 2
      src/redux/store.js
  5. 13
      src/screens/Home/index.js
  6. 5
      src/screens/Login/index.js
  7. 20
      src/screens/Otp/index.js
  8. 2
      src/screens/Product/components/Book.js
  9. 2
      src/screens/Profile/components/List.js
  10. 2
      src/screens/Profile/components/User.js
  11. 2
      src/screens/ShoppingCart/components/Code.js
  12. 2
      src/screens/ShoppingCart/index.js
  13. 2
      src/screens/Video/index.js
  14. 2
      src/screens/VideoDisplay/components/Season/index.js
  15. 12
      src/utils/onInput.js

@ -51,6 +51,7 @@ const FloatingLabelInput = ({
textAlign: textAlign,
fontFamily: "regular",
fontWeight: "900",
direction: direction ? direction : "rtl"
},
});
return (

@ -31,7 +31,7 @@ if (
UIManager.setLayoutAnimationEnabledExperimental(true);
}
const Drawer = ({ position, setBoxPosition, user }) => {
const Drawer = ({ position, setBoxPosition, user = JSON.parse(user) }) => {
const colorScheme = Appearance.getColorScheme();
const [routes, setRoutes] = useState([
{
@ -142,7 +142,7 @@ const Drawer = ({ position, setBoxPosition, user }) => {
{ backgroundColor: Colors.theme1[colorScheme].greenCF },
]}
>
{user.picFileId ? (
{user?.picFileId ? (
<Image
source={{ uri: "https://dnvn.ir/api/v1/" + user.picFileId }}
style={[tw("rounded-full"), { width: 60, height: 60 }]}
@ -151,7 +151,7 @@ const Drawer = ({ position, setBoxPosition, user }) => {
<View
style={[
tw("rounded-full bg-gray-200"),
{ width: 60, height: 60, zIndex : 1 },
{ minWidth: 60, minHeight: 60, zIndex : 1 },
]}
></View>
)}
@ -210,11 +210,11 @@ const Drawer = ({ position, setBoxPosition, user }) => {
};
const mapStateToProps = (state) => ({
user: JSON.parse(state.user.status),
user: state.user.status,
});
const mapDispatchToProps = {
logout: user.logout,
};
export default connect(mapStateToProps)(Drawer);
export default connect(mapStateToProps, mapDispatchToProps)(Drawer);

@ -23,7 +23,7 @@ const user = (state = initialState, action) => {
case "public/sendOTP":
return { ...state, loading: false, error: null };
case "user/getStatus":
return { ...state, status: data.status, error: null };
return { ...state, status: JSON.parse(data.status), error: null };
case "user/login":
case "user/otp/login":
return {

@ -65,6 +65,8 @@ try {
console.log(e);
}
AsyncStorage.clear();
console.disableYellowBox = true;
export default store;

@ -26,8 +26,6 @@ const Home = ({
getBlogs,
books,
getBooks,
videos,
getVideos,
userProducts,
getUserProducts,
}) => {
@ -35,7 +33,7 @@ const Home = ({
useEffect(() => {
getBlogs();
getBooks();
getBooks({vod : true});
getUserProducts();
}, []);
@ -68,13 +66,13 @@ const Home = ({
contentContainerStyle={styles.contentContainerStyle}
style={[styles.container, tw("flex")]}
>
{userProducts.length > 0 && <MyBooks books={userProducts} />}
{userProduct?.length > 0 && <MyBooks books={userProducts} />}
<View style={tw("px-4 w-full")}>
<Header title={"فروشگاه"} route={"Products"} />
</View>
{books.length > 0 && <Scroll books={books} />}
{books.length > 0 && <Videos videos={books} />}
{blogs.length > 0 && <Blogs blogs={blogs} />}
{books?.length > 0 && <Scroll books={books} />}
{books?.length > 0 && <Videos videos={books} />}
{blogs?.length > 0 && <Blogs blogs={blogs} />}
</ScrollView>
</SafeAreaView>
);
@ -96,7 +94,6 @@ const mapStateToProps = (state) => ({
blogs: state.blog.list,
books: state.book.list,
userProducts: state.userProduct.list,
videos: state.product.listVOD,
});
const mapDispatchToProps = {

@ -77,7 +77,7 @@ function Login(props) {
</Text>
<Text
style={[
tw(`w-full ${ios ? "text-right mb-5" : "mt-5"}`),
tw(`w-full mb-5 ${ios ? "text-right" : ""}`),
{
fontSize: fontSize.xl2,
fontFamily: "bold",
@ -92,10 +92,11 @@ function Login(props) {
label="شماره موبایل"
textAlign="left"
name="phone"
maxlength="11"
maxLength={11}
value={phone}
onChange={onChangePhone}
autoFocus={true}
direction="ltr"
regex={onInput.phonenumber}
/>
</View>

@ -87,7 +87,7 @@ function Otp(props) {
const submit = async () => {
setLoading(true);
props.sendOtp({
cellphone: props.route.params.phone,
cellphone: props.route.params?.phone,
otp: String(getEnCode()),
applicationToken: "1",
userToken: "1",
@ -139,7 +139,7 @@ function Otp(props) {
color: "#6f7074",
},
]}
>{`یک کد تائیدیه به شماره ${props.route.params.phone} ارسال شد. آن را در قسمت زیر وارد کنید`}</Text>
>{`یک کد تائیدیه به شماره ${props.route.params?.phone} ارسال شد. آن را در قسمت زیر وارد کنید`}</Text>
<View
style={[
tw("w-full px-4 pt-6 flex flex-row items-center justify-center"),
@ -152,7 +152,7 @@ function Otp(props) {
fontSize: fontSize.xl3,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
width : ios ? fontSize.xl3 + 40 : ""
// width : ios ? fontSize.xl3 + 40 : ""
},
]}
underlineColorAndroid={"transparent"}
@ -160,6 +160,8 @@ function Otp(props) {
maxLength={1}
ref={(ref) => (ref1 = ref)}
onChangeText={(text) => onChangeCode(text, "1")}
regex={onInput.numberOnly}
direction="ltr"
/>
<TextInput
style={[
@ -168,7 +170,7 @@ function Otp(props) {
fontSize: fontSize.xl3,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
width : ios ? fontSize.xl3 + 40 : ""
// width : ios ? fontSize.xl3 + 40 : ""
},
]}
underlineColorAndroid={"transparent"}
@ -176,6 +178,8 @@ function Otp(props) {
maxLength={1}
ref={(ref) => (ref2 = ref)}
onChangeText={(text) => onChangeCode(text, "2")}
regex={onInput.numberOnly}
direction="ltr"
/>
<TextInput
style={[
@ -184,7 +188,7 @@ function Otp(props) {
fontSize: fontSize.xl3,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
width : ios ? fontSize.xl3 + 40 : ""
// width : ios ? fontSize.xl3 + 40 : ""
},
]}
underlineColorAndroid={"transparent"}
@ -192,6 +196,8 @@ function Otp(props) {
maxLength={1}
ref={(ref) => (ref3 = ref)}
onChangeText={(text) => onChangeCode(text, "3")}
regex={onInput.numberOnly}
direction="ltr"
/>
<TextInput
style={[
@ -200,7 +206,7 @@ function Otp(props) {
fontSize: fontSize.xl3,
fontFamily: "bold",
color: Colors.theme1[colorScheme].green79,
width : ios ? fontSize.xl3 + 40 : ""
// width : ios ? fontSize.xl3 + 40 : ""
},
]}
underlineColorAndroid={"transparent"}
@ -208,6 +214,8 @@ function Otp(props) {
maxLength={1}
ref={(ref) => (ref4 = ref)}
onChangeText={(text) => onChangeCode(text, "4")}
regex={onInput.numberOnly}
direction="ltr"
/>
</View>
<TouchableOpacity

@ -308,7 +308,7 @@ function Book({ book, grades, pushToCart, userId, loading }) {
}
const mapStateToProps = (state) => ({
userId: state.user.status.id,
userId: state.user.status?.id,
loading: state.userProduct.loading,
});

@ -109,7 +109,7 @@ const List = ({}) => {
},
{
icon: (
<Svg xmlns="http://www.w3.org/2000/svg" width={24.613} height={21.519}>
<Svg xmlns="http://www.w3.org/2000/svg" width={25.613} height={22.519}>
<G data-name="Group 2005">
<Path
d="M18.085 20.769H6.528c-3.467 0-5.778-2-5.778-6.673V7.423C.75 2.75 3.061.75 6.528.75h11.557c3.467 0 5.778 2 5.778 6.673v6.673c0 4.671-2.313 6.673-5.778 6.673Z"

@ -150,7 +150,7 @@ const User = ({ user }) => {
};
const mapStateToProps = (state) => ({
user: JSON.parse(state.user.status),
user: state.user.status,
});
export default connect(mapStateToProps)(User);

@ -70,7 +70,7 @@ function Code({ codeId, setCodeId, userId, factorId }) {
const mapStateToProps = (state) => ({
codeId: state.userFactor.info?.codeId,
userId: state.user.status.id,
userId: state.user.status?.id,
factorId: state.userFactor.info?.id,
});

@ -247,7 +247,7 @@ const mapStateToProps = (state) => ({
list: state.userProduct.list,
payPrice: state.userProduct.sum,
factorInfo: state.userFactor.info,
userId: state.user.status.id,
userId: state.user.status?.id,
hasPhysical: state.userProduct.hasPhysical,
loading: state.userProduct.loading,
});

@ -173,7 +173,7 @@ const mapStateToProps = (state) => ({
seasons: state.publicApi.categories,
grades: state.publicApi.grades,
isLogin: state.user.status,
userId: state.user.status.id,
userId: state.user.status?.id,
loading: state.userProduct.loading,
});

@ -123,7 +123,7 @@ const mapStateToProps = (state) => ({
selectedVideo: state.publicApi.selectedVideo,
realSeasons: state.publicApi.bookInfo?.categories,
vods: state.publicApi.bookSection?.vods,
userid: state.user.status.id,
userid: state.user.status?.id,
});
const mapDispatchToProps = {

@ -147,6 +147,16 @@ class onInput {
newText = newText.replace(/7/g, "7");
newText = newText.replace(/8/g, "8");
newText = newText.replace(/9/g, "9");
newText = newText.replace(/۰/g, "0");
newText = newText.replace(/۱/g, "1");
newText = newText.replace(/۲/g, "2");
newText = newText.replace(/۳/g, "3");
newText = newText.replace(/۴/g, "4");
newText = newText.replace(/۵/g, "5");
newText = newText.replace(/۶/g, "6");
newText = newText.replace(/۷/g, "7");
newText = newText.replace(/۸/g, "8");
newText = newText.replace(/۹/g, "9");
newText = newText.replace(/ا/g, "");
newText = newText.replace(/ب/g, "");
newText = newText.replace(/پ/g, "");
@ -237,7 +247,7 @@ class onInput {
newText = newText.replace(/N/g, "");
newText = newText.replace(/M/g, "");
if (!newText && newText.length !== 0) {
// toast.info("از اعداداستفاده کنید");
toast.info("از اعداداستفاده کنید");
}
return newText;
};

Loading…
Cancel
Save