【发布时间】:2016-10-12 14:05:29
【问题描述】:
下面是我的代码:
// Styling for the common loader
const loader = StyleSheet.create({
centering: {
flex: 1,
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
padding: 8,
zIndex: 1005,
backgroundColor: '#fff',
opacity: 0.8
},
});
// State
this.state = {
animating: false
};
// Component
{
this.state.animating ?
<ActivityIndicator
animating={this.state.animating}
color="#8bcb43"
style={loader.centering}
size="large"
/>
:
null
}
我附上了当 this.state.animating 为 true 和 false 时加载程序的外观截图。
我很惊讶为什么当this.state.animating 为假时组件没有消失。我不确定我做错了什么。
【问题讨论】:
-
您找到解决此问题的方法了吗?我现在也在为同样的事情苦苦挣扎..
-
@irruputuncu 我已经写了一个答案来帮助。我不确定这是否是最好的解决方案。
标签: android reactjs react-native react-native-android activity-indicator