|
| 1 | +import React, { Component } from 'react'; |
| 2 | +import { |
| 3 | + ScrollView, |
| 4 | + SafeAreaView, |
| 5 | + Text, |
| 6 | + View |
| 7 | +} from 'react-native'; |
| 8 | +import styles from './styles/AppStyles'; |
| 9 | +import SpinnerButton from 'react-native-spinner-button'; |
| 10 | +// import SpinnerButton from './components/SpinnerButton'; |
| 11 | +const colors = [ |
| 12 | + '#893346', |
| 13 | + '#1aafb8', |
| 14 | + '#bf57c3', |
| 15 | + '#dead00', |
| 16 | + '#666666', |
| 17 | + '#4CA0F7', |
| 18 | + '#123456', |
| 19 | + '#F87217', |
| 20 | +]; |
| 21 | +export default class App extends Component { |
| 22 | + constructor(props) { |
| 23 | + super(props); |
| 24 | + this.state = { |
| 25 | + defaultLoading: false, |
| 26 | + barLoading: false, |
| 27 | + dotLoading: false, |
| 28 | + materialLoading: false, |
| 29 | + pacmanLoading: false, |
| 30 | + pulseLoading: false, |
| 31 | + skypeLoading: false, |
| 32 | + uiAcivityLoading: false, |
| 33 | + waveLoading: false, |
| 34 | + }; |
| 35 | + } |
| 36 | + render() { |
| 37 | + return ( |
| 38 | + <SafeAreaView style={styles.safeArea}> |
| 39 | + <ScrollView> |
| 40 | + <View style={styles.container}> |
| 41 | + <SpinnerButton |
| 42 | + buttonStyle={[ |
| 43 | + styles.buttonStyle, |
| 44 | + { backgroundColor: colors[0] } |
| 45 | + ]} |
| 46 | + isLoading={this.state.defaultLoading} |
| 47 | + onPress={() => { |
| 48 | + this.setState({ defaultLoading: true }); |
| 49 | + setTimeout(() => { |
| 50 | + this.setState({ defaultLoading: false }); |
| 51 | + }, 3000); |
| 52 | + }} |
| 53 | + indicatorCount={10} |
| 54 | + > |
| 55 | + <Text style={styles.buttonText}>Default Or Ball SpinnerButton</Text> |
| 56 | + </SpinnerButton> |
| 57 | + <SpinnerButton |
| 58 | + buttonStyle={[ |
| 59 | + styles.buttonStyle, |
| 60 | + { backgroundColor: colors[1] } |
| 61 | + ]} |
| 62 | + isLoading={this.state.barLoading} |
| 63 | + spinnerType='BarIndicator' |
| 64 | + onPress={() => { |
| 65 | + this.setState({ barLoading: true }); |
| 66 | + setTimeout(() => { |
| 67 | + this.setState({ barLoading: false }); |
| 68 | + }, 3000); |
| 69 | + }} |
| 70 | + animationType={'flipInY'} |
| 71 | + > |
| 72 | + <Text style={styles.buttonText}>Bar SpinnerButton</Text> |
| 73 | + </SpinnerButton> |
| 74 | + <SpinnerButton |
| 75 | + buttonStyle={[ |
| 76 | + styles.buttonStyle, |
| 77 | + { backgroundColor: colors[2] } |
| 78 | + ]} |
| 79 | + isLoading={this.state.dotLoading} |
| 80 | + indicatorCount={10} |
| 81 | + size={10} |
| 82 | + spinnerType='DotIndicator' |
| 83 | + onPress={() => { |
| 84 | + this.setState({ dotLoading: true }); |
| 85 | + setTimeout(() => { |
| 86 | + this.setState({ dotLoading: false }); |
| 87 | + }, 3000); |
| 88 | + }} |
| 89 | + animationType={'flipInX'} |
| 90 | + > |
| 91 | + <Text style={styles.buttonText}>Dot SpinnerButton</Text> |
| 92 | + </SpinnerButton> |
| 93 | + <SpinnerButton |
| 94 | + buttonStyle={[ |
| 95 | + styles.buttonStyle, |
| 96 | + { backgroundColor: colors[3] } |
| 97 | + ]} |
| 98 | + isLoading={this.state.materialLoading} |
| 99 | + spinnerType='MaterialIndicator' |
| 100 | + onPress={() => { |
| 101 | + this.setState({ materialLoading: true }); |
| 102 | + setTimeout(() => { |
| 103 | + this.setState({ materialLoading: false }); |
| 104 | + }, 3000); |
| 105 | + }} |
| 106 | + > |
| 107 | + <Text style={styles.buttonText}>Material SpinnerButton</Text> |
| 108 | + </SpinnerButton> |
| 109 | + <SpinnerButton |
| 110 | + buttonStyle={[ |
| 111 | + styles.buttonStyle, |
| 112 | + { backgroundColor: colors[4] } |
| 113 | + ]} |
| 114 | + isLoading={this.state.pacmanLoading} |
| 115 | + spinnerType='PacmanIndicator' |
| 116 | + onPress={() => { |
| 117 | + this.setState({ pacmanLoading: true }); |
| 118 | + setTimeout(() => { |
| 119 | + this.setState({ pacmanLoading: false }); |
| 120 | + }, 3000); |
| 121 | + }} |
| 122 | + > |
| 123 | + <Text style={styles.buttonText}>Pacman SpinnerButton</Text> |
| 124 | + </SpinnerButton> |
| 125 | + <SpinnerButton |
| 126 | + buttonStyle={[ |
| 127 | + styles.buttonStyle, |
| 128 | + { backgroundColor: colors[5] } |
| 129 | + ]} |
| 130 | + isLoading={this.state.pulseLoading} |
| 131 | + spinnerType='PulseIndicator' |
| 132 | + onPress={() => { |
| 133 | + this.setState({ pulseLoading: true }); |
| 134 | + setTimeout(() => { |
| 135 | + this.setState({ pulseLoading: false }); |
| 136 | + }, 3000); |
| 137 | + }} |
| 138 | + > |
| 139 | + <Text style={styles.buttonText}>Pulse SpinnerButton</Text> |
| 140 | + </SpinnerButton> |
| 141 | + <SpinnerButton |
| 142 | + buttonStyle={[ |
| 143 | + styles.buttonStyle, |
| 144 | + { backgroundColor: colors[6] } |
| 145 | + ]} |
| 146 | + isLoading={this.state.skypeLoading} |
| 147 | + spinnerType='SkypeIndicator' |
| 148 | + spinnerOptions={{ |
| 149 | + maxScale: 2 |
| 150 | + }} |
| 151 | + onPress={() => { |
| 152 | + this.setState({ skypeLoading: true }); |
| 153 | + setTimeout(() => { |
| 154 | + this.setState({ skypeLoading: false }); |
| 155 | + }, 3000); |
| 156 | + }} |
| 157 | + > |
| 158 | + <Text style={styles.buttonText}>Skype SpinnerButton</Text> |
| 159 | + </SpinnerButton> |
| 160 | + <SpinnerButton |
| 161 | + buttonStyle={[ |
| 162 | + styles.buttonStyle, |
| 163 | + { backgroundColor: colors[7] } |
| 164 | + ]} |
| 165 | + isLoading={this.state.uiAcivityLoading} |
| 166 | + spinnerType='UIActivityIndicator' |
| 167 | + onPress={() => { |
| 168 | + this.setState({ uiAcivityLoading: true }); |
| 169 | + setTimeout(() => { |
| 170 | + this.setState({ uiAcivityLoading: false }); |
| 171 | + }, 3000); |
| 172 | + }} |
| 173 | + > |
| 174 | + <Text style={styles.buttonText}>UIActivity SpinnerButton</Text> |
| 175 | + </SpinnerButton> |
| 176 | + <SpinnerButton |
| 177 | + buttonStyle={[ |
| 178 | + styles.buttonStyle, |
| 179 | + { backgroundColor: colors[8] } |
| 180 | + ]} |
| 181 | + isLoading={this.state.waveLoading} |
| 182 | + spinnerType='WaveIndicator' |
| 183 | + spinnerOptions={{ |
| 184 | + waveMode: "outline" |
| 185 | + }} |
| 186 | + onPress={() => { |
| 187 | + this.setState({ waveLoading: true }); |
| 188 | + setTimeout(() => { |
| 189 | + this.setState({ waveLoading: false }); |
| 190 | + }, 3000); |
| 191 | + }} |
| 192 | + > |
| 193 | + <Text style={styles.buttonText}>Wave SpinnerButton</Text> |
| 194 | + </SpinnerButton> |
| 195 | + </View> |
| 196 | + </ScrollView> |
| 197 | + </SafeAreaView> |
| 198 | + ); |
| 199 | + } |
| 200 | +} |
0 commit comments