Здесь я отображаю три кнопки счета, платежи и платежи.по умолчанию кнопка «Счет-фактура» выбрана активной, а остальные два отключены, когда я захожу на эту страницу.Но если я скрываю эту кнопку «счета» через разрешение, она должна автоматически перейти на вкладку «пополнение счета», и пополнение должно быть активным.пожалуйста, предложите.
export default class Financial extends Component {
constructor(props){
super(props)
this.state ={
activeTab: 'invoices'
}
}
render(){
const { activeTab } = this.state;
const { customer,rechargeDeatails,navigation,permission } = this.props;
console.log("permission-------",permission);
return (
<View
style={{
flex: 1,
paddingLeft: 10,
paddingRight: 10,
backgroundColor: '#f1f1f1',
flexDirection: 'column'
}}
>
<View style={{flexDirection:'row', padding: 10}}>
{permission.invoiceTab &&
<View style={{marginRight: 5}}>
<TouchableOpacity onPress={()=>this.setState({activeTab:'invoices'})}>
<Button small rounded disabled={activeTab!=='invoices'} style={{padding:2, height: 28}}>
<Text style={styles.btnLabel}> Invoices </Text>
</Button>
</TouchableOpacity>
</View>}
<View style={{marginRight: 5}}>
<TouchableOpacity onPress={()=>this.setState({activeTab:'recharges'})}>
<Button small rounded disabled={activeTab!=='recharges'} style={{padding:2, height: 28}}>
<Text style={styles.btnLabel}> Recharges </Text>
</Button>
</TouchableOpacity>
</View>
<View style={{marginRight: 5}}>
<TouchableOpacity onPress={()=>this.setState({activeTab:'payments'})}>
<Button small rounded disabled={activeTab!=='payments'} style={{padding:2, height: 28}}>
<Text style={styles.btnLabel}> Payments </Text>
</Button>
</TouchableOpacity>
</View>
</View>
<View style={{flexDirection:'column'}}>
{ activeTab=='recharges' && <Recharges customer={customer} rechargeDeatails={rechargeDeatails}/>}
{ activeTab=='invoices' && <Invoices navigation={navigation}/>}
{ activeTab=='payments' && <Payments/>}
</View>
</View>
);
}
}