模式在 ios 上未隐藏 - React Native

问题描述 投票:0回答:1

我有一个带有 View 和 ActivityIndicator 的模式,我用它来向用户显示正在加载的内容。这是组件:

const ActivityIndicatorView: React.FC<Props> = ({show}) => {
  return (
    <Modal animationType="fade" transparent={true} visible={show}>
      <View style={styles.centeredView}>
        <ActivityIndicator size={'large'} color={FOREGROUND_YELLOW} />
      </View>
    </Modal>
  );
};

这一直运行良好。但现在我有一个特定的情况,变量

show
从 true 变为 false,但模态并没有消失。这只发生在 iOS 上,它在 Android 上按预期工作。

知道为什么吗?

react-native activity-indicator
1个回答
0
投票

我遇到了同样的问题,并设法通过将透明度值更改为 false 'transparent={false}' 来解决它

© www.soinside.com 2019 - 2024. All rights reserved.