博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
react native 自定义head title组件
阅读量:7242 次
发布时间:2019-06-29

本文共 1629 字,大约阅读时间需要 5 分钟。

hot3.png

import Entypo from 'react-native-vector-icons/Entypo'; import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'; import React, { PureComponent } from 'react'; import { AppRegistry, StyleSheet, Text, View, Image, TouchableOpacity, Platform, Switch, DeviceEventEmitter } from 'react-native';

export default class Title extends PureComponent { constructor() { super();

this.state = {        leftVisible: 'hidden',        rigitVisible: 'hidden',    };}render = () => {    console.log(this)    let leftView = this.props.leftVisibility == 'hidden' ?        
:
{ this.props.leftCallBack? this.props.leftCallBack():null }} >
let rightView = this.props.rightVisibility == 'hidden' ?
:
{ this.props.rightCallBack?this.props.rightCallBack():null }} >
return (
{leftView}
{this.props.name ? this.props.name : 'Delphy'}
{rightView}
);}

}

const styles = StyleSheet.create({ footerContainer: {

flexDirection: 'row',    justifyContent: 'center',    alignItems: 'center',    backgroundColor: '#45506e',    height: 50},

});

使用:

back = () => { this.props.navigation.dispatch(NavigationActions.back()); }

share = () => {    toastShort('share')}

render() { return ( <View> <Title leftVisibility={'visible'} rightVisibility={'visible'} name={'详情'} leftCallBack={ this.back.bind(this) } rightCallBack={ this.share.bind(this) } /> <View> ) }

转载于:https://my.oschina.net/u/3150996/blog/1573497

你可能感兴趣的文章
Android Activity 滑动返回
查看>>
javascript 词法作用域
查看>>
Wireshark捕获理解TCP三次握手四次断开
查看>>
Go面向对象编程
查看>>
小程序分包加载
查看>>
scrollIntoView与键盘遮挡
查看>>
Nodejs API - events 提纲式笔记
查看>>
以太坊ganache CLI命令行参数详解
查看>>
iOSURL中文解决方法
查看>>
快速掌握 MongoDB 数据库
查看>>
Kotlin和RecyclerView的一个demo
查看>>
【译】Bootstrap的网格体系
查看>>
在AS中自定义字体库报错:java.lang.RuntimeException: native typeface cannot be made
查看>>
在Linux系统里安装Virtual Box的详细步骤
查看>>
Python 日志库 logging 的理解和实践经验
查看>>
Vert.x 文件上传Client
查看>>
iOS之SVN
查看>>
MySQL日志故障的处理和分析
查看>>
tcp和udp使用总结
查看>>
koa,node,express通用方法连接mysql
查看>>