Dimitri Kopriwa
Dimitri Kopriwa

Reputation: 14363

How to make icon spin in react-native-paper?

I am having this react-native-paper button:

      <Button
        disabled={loading}
        icon="refresh"
        mode="contained"
        onPress={this.refreshData.bind(this)}
      >
        Refresh
      </Button>

How can I make the icon spin when loading=true?

Upvotes: 1

Views: 3324

Answers (1)

rajan tank
rajan tank

Reputation: 247

for the spinning icon do this.

declare one variable refreshing any boolean value when data refresh value set to be true and icon spinning start.

      <Button
        loading={loading}
        disabled={loading}
        icon="refresh"
        mode="contained"
        onPress={this.refreshData.bind(this)}
      >
        Refresh
      </Button>

react-native-paper button have props like.. loading it's simply spinning icon

here snack link

Upvotes: 6

Related Questions