zoukankan      html  css  js  c++  java
  • 【RN】标题栏右边添加自定义按钮或加事件

    一、需求:

        要实现在标题栏的右边部分添加自定义按钮

    问题分析:

      日常废话,这个真的是难者不会,会者不难,在研究多次无果之后,经过高人点拨,顿时。。。

    使用:

    class HearNavigation extends Component{
        render(){
            return(
                <TouchableOpacity style={styles.msgContent}
                  >
                <Image
                  source={require('./../../img/forward.png')}
                 style={styles.msgBg}
       />
                </TouchableOpacity>
            )
        }
    }
     
    export default class CustomerDetail extends Component{
        static navigationOptions = {
            headerRight:<HearNavigation/>
        }
    }

    二、需求:

        标题栏右边文字加事件

    使用:

    class HearNavigation extends Component{
        constructor(props){
            super(props);
        }
        goPayList(){
            navigationNewPush({
                navigation:this.props.navigation,
                route:'payList'
            });
        }
        render(){
            return(
                <Text style={styles.msgContent}
                    onPress={()=>{
                        this.goPayList()
                    }}
                >
                   点击
                </Text>
            )
        }
    }
    export default class InsureList extends Component{
        static navigationOptions = (props) => {
            return{
                headerRight:<HearNavigation {...props} />
            }
        }
    }
  • 相关阅读:
    MFC开发编程规范(二)
    Mysql日期和时间函数大全(转)
    php获取客户端IP地址的几种方法
    postgres 查看数据表和索引的大小
    PHP应用memcache函数详解
    css自动截取文字 兼容IE firefox Opera
    JavaScript在IE和Firefox浏览器下的7个差异兼容写法小结
    Zend_Auth与Zend_Acl访问控制链
    去除所有js,html,css代码问题
    [转]那些相见恨晚的 JavaScript 技巧
  • 原文地址:https://www.cnblogs.com/guanpingping/p/12056146.html
Copyright © 2011-2022 走看看