const textOverflow = { textOverflow: 'ellipsis' }; statesDom.push(<View style={styles.statusTitle}> <Text style={[styles.statusTitleText,titleStyle,textOverflow]}> {this.state.topStatusBarTip}</Text> <Touchable onPress={() => { console.log('测试数据测试数据1'); this.setState({ isStateDoms: true,}); }} > <Text style={[styles.statusTitleText,subTitleStyle]} >{this.state.topStatusBarSubTip}</Text> </Touchable> </View>); const statesDom1 = []; // 顶部的状态栏 statesDom1.push(<View style={styles.statusTitle1}> <Text style={[styles.statusTitleText,titleStyle]}>{this.state.topStatusBarTip}</Text> <Touchable onPress={() => { console.log('测试数据测试数据2'); this.setState({ isStateDoms: false,subTitleStyle]} >{this.state.topStatusBarSubTip}</Text> </Touchable> </View>);
{this.
state.
isStateDoms ?
statesDom1 :
statesDom
}