ReactNative ActivityIndicator not showing when animating property initiate false

后端 未结 10 1586

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:22

    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.

提交回复
热议问题