enx-uikit-react-native
Version:
It is a react native component for Enablex users.
74 lines (65 loc) • 2.33 kB
JavaScript
import React, { Component } from "react";
import { TouchableHighlight,View,Image,Modal,Text,Button,Switch} from "react-native";
import { styles } from "../style/EnxTopViewStyle";
class EnxTopView extends Component {
constructor(props) {
super(props);
this.state={
isVisible:false,
switchValue: false,
color: props.topBarColor,
topOption: props.topOption,
}
}
createTopBar(a){
try{
if(a.USER_LIST)
{
return(
<View>
<TouchableHighlight
underlayColor="transparent"
onPress={()=>{this.props.onParticipantClick()}}>
<Image
source={require("../image_asset/participant_icon.png")}
style={styles.inlineImg}
/>
</TouchableHighlight>
</View>
)
}
else if(a.MENU)
{
return(
<View>
<TouchableHighlight
underlayColor="transparent"
onPress={()=>{this.props.onMoreClick()}}>
<Image
source={require("../image_asset/more_vertical.png")}
style={styles.inlineImg}
/>
</TouchableHighlight>
</View>
)
}
}catch(err){
console.log("=========== err ==========",err.message)
}
}
render() {
return (
<View style={styles.topBar}>
<View style ={{flexDirection:'row',width:'auto' ,backgroundColor:this.state.color,borderRadius:20,paddingLeft:15,paddingRight:15}}>
{
this.state.topOption.map((a) => {
return(
this.createTopBar(a)
)
})}
</View>
</View>
);
}
}
export default EnxTopView;