جشنواره عیدانه راکت | عضویت ویژه راکت برای آخرین بار | افزایش قیمت‌ها از سال جدید | و ...

مشاهده اطلاعات بیشتر...
ثانیه
دقیقه
ساعت
روز
بهنام
5 سال پیش توسط بهنام مطرح شد
2 پاسخ

استفاده از onPress داخل navigationOptions

کد زیر مشکل داره مشکلشش چیه که onPress دوم کار میکنه دقیقا همون تو onPress اول کار نمیکنه :(

import React,{Component} from "react";
import {View,Text,StyleSheet,Platform,Button,Image,TouchableWithoutFeedback} from "react-native";
import Icon from "react-native-vector-icons/Ionicons"
import EStyleSheet from "react-native-extended-stylesheet";

export default class Profile extends Component {

    static navigationOptions = ({navigation}) => ({
        headerLeft :
            <View style={styles.headerContainer}>
                <TouchableWithoutFeedback >
                    <Icon
                        onPress={() => navigation.navigate('Archive')}
                        style={styles.headerIcons} name="md-more" size={30} color="black"/>
                </TouchableWithoutFeedback>
                <Icon style={styles.headerIcons} name="md-person-add" size={30} color="black" />
                <Icon style={styles.headerIcons} name="md-filing" size={30} color="black" />
            </View>,
        headerRight : <Text style={styles.headerTitle}>بهنام میرزایی</Text>
    });

    render() {
        return (
            <View style={styles.container}>
                <View style={[styles.container]}>
                    <Button
                        onPress={() => {
                            const n = this.props.navigation;
                            n.navigate("Archive")
                        }}
                        title="Learn More"
                        color="#841584"
                        accessibilityLabel="Learn more about this purple button"
                    />
                    {/*<Image source={require('../../assets/images/profile.jpg')}/>*/}
                </View>
                <View>
                    <Text >
                        Profile hjhjh Screen
                    </Text>
                </View>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    headerTitle : {
        ...Platform.select({
            ios: {
                fontFamily : "IRANSansMobile",
                fontWeight : "bold",
                color : "rgba(0,0,0,.7)"
            },
            android: {
                fontFamily : "IRANSansMobile_Bold",
            },
        }),
        marginRight : 14,
        fontSize : 18
    },
    headerContainer : {
        flex:1,
        flexDirection : "row",
        justifyContent : "flex-end",
        color : "rgba(0,0,0,.7)",
    },
    headerIcons : {
        marginLeft : 15,
        marginRight: 10,
        color : "rgba(0,0,0,.8)",
        backgroundColor: "white"
    },
    container : {
        flex : 1,
    },
    imageFollowContainer : {
        flex : .3,
        backgroundColor : '#2f3542',
        height : 160 ,
    },
    profileImage : {
        flex : .3,
    }
});

ثبت پرسش جدید
آقای برنامه نویس
@mrdeveloperrr 5 سال پیش مطرح شد
0

نحوه نوشتن این سینتکس اشتباهه دوست عزیز
شما onPress رو return نکردی
onPress(()=>({}))


بهنام
@behnam.mirzaeee 5 سال پیش مطرح شد
0

الان کد رو ویرایش کردم جواب نداد باز کدی ک شما میگید درسته رو میتونید بذارید ببینم ؟
@mrdeveloperrr


برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام