React native 当屏幕加载到react native时,如何在按钮上显示动画? 当屏幕加载到react native时,如何在按钮上显示动画?

React native 当屏幕加载到react native时,如何在按钮上显示动画? 当屏幕加载到react native时,如何在按钮上显示动画?,react-native,react-native-android,react-native-ios,react-native-animatable,React Native,React Native Android,React Native Ios,React Native Animatable,我想在按钮上应用动画,并在其加载到屏幕时显示其效果。因此,请帮助我。如何在react native中实现此功能。使用此库并根据api响应更改您的标志。使用此库并根据api响应更改您的标志。使用react native animatable和react native button您可以在按钮上实现动画,其中一个简单表达式如下所示 <View style={styles.container}> <Button onPress={this.onPress}>

我想在按钮上应用动画,并在其加载到屏幕时显示其效果。因此,请帮助我。如何在react native中实现此功能。

使用此库并根据api响应更改您的标志。

使用此库并根据api响应更改您的标志。

使用react native animatable和react native button您可以在按钮上实现动画,其中一个简单表达式如下所示

<View style={styles.container}>
     <Button onPress={this.onPress}>
          <Animatable.Text 
               animation="pulse"
               easing="ease-out" 
               iterationCount="infinite" 
               style={{ textAlign: 'center', fontSize: 100 }}>
                  OK
         </Animatable.Text>
      </Button>
 </View>
您可以使用react native animatable和react native button将isLoading的状态设置为0,并在加载完成时将iterationCount设置为0。您可以在按钮上实现动画,其中一个简单表达式如下所示

<View style={styles.container}>
     <Button onPress={this.onPress}>
          <Animatable.Text 
               animation="pulse"
               easing="ease-out" 
               iterationCount="infinite" 
               style={{ textAlign: 'center', fontSize: 100 }}>
                  OK
         </Animatable.Text>
      </Button>
 </View>
<View style={styles.container}>
     <Button onPress={this.onPress}>
{this.state.isLoading ? 
<React.Fragment>
          <Text style={{ textAlign: 'center', fontSize: 100 }}>
                  Loading ...
         </Text>


<ActivityIndicator/>

</React.Fragment> : <Text>Press me <Text>
      </Button>
 </View>
您可以设置isLoading的状态,并在加载完成时将iterationCount设置为0

<View style={styles.container}>
     <Button onPress={this.onPress}>
{this.state.isLoading ? 
<React.Fragment>
          <Text style={{ textAlign: 'center', fontSize: 100 }}>
                  Loading ...
         </Text>


<ActivityIndicator/>

</React.Fragment> : <Text>Press me <Text>
      </Button>
 </View>