ReactNative ActivityIndicator not showing when animating property initiate false

后端 未结 10 1721
悲哀的现实
悲哀的现实 2021-02-12 21:31

I\'m playing with react native and got a strange behaviour.

When I try to show a ActitvityIndicator for Android setting its animating property

10条回答
  •  孤街浪徒
    2021-02-12 22:26

    The transition of animating from false to true is too slow on Android. But you can force a re-render using the key prop:

    
    

    When props.animating changes from false to true, they key also changes. This forces a re-render, meaning that a new component is rendered with animating = true, which will instantly start your spinner.

提交回复
热议问题