473,609 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

React to native button blinking effect

3 New Member
Expand|Select|Wrap|Line Numbers
  1. Define the method first
  2.  
  3. this.state = {
  4. buttonBackgroundColor: 'green',
  5. isBlinking: false, // A new status is added to identify whether the button is blinking or not
  6. }
  7.  
  8.  
  9. autoStart=()=>{
  10.  
  11. this.setState({ isAutoSending: true });
  12. let dt = setInterval(()=>{
  13. this.init()
  14. }, 5000);
  15.  
  16. this.setState(
  17. {
  18. clearTime: dt,
  19. isBlinking: true, 
  20. },
  21. () => {
  22.  
  23. this.startBlinkAnimation();
  24. }
  25. );
  26.  
  27.  
  28. }
  29.  
  30. startBlinkAnimation = () => {
  31. if (this.state.isBlinking) {
  32. this.setState({ buttonBackgroundColor: 'red' });
  33. setTimeout(() => {
  34. this.setState({ buttonBackgroundColor: 'green' });
  35. setTimeout(this.startBlinkAnimation, 500);
  36. }, 500);
  37. }
  38. };
  39. <Button color={this.state.buttonBackgroundColor} title={'Start'} onPress={() => !this.state.isAutoSending && this.autoStart()}/>
  40. You can click the button to see the effect.
  41.  
  42.  

Sep 13 '23 #1
0 12366

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2034
by: Markus | last post by:
Blinking control Perhaps my question is not exactly an Access question, but may somebody might give me an answer.i have a very important control on my report, called "Stockflow" and in case the goods in the warehouse do not correspond to the documents i want to have some special effect, either voise, or blinking, or anything of the kind.
6
6596
by: Mark | last post by:
Hi All, Does anyone know of a way that I can get a task bar button to flash if a form is open? I have created something like a messenger application within my database but there are a few people who have it open but do not use it exclusivley. If someone was to send them a message, it could be hours before they see it so if I could get the taskbar button to flash if the form opens, they can be alerted instantly. Many thanks,
11
4208
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked. How I stop the buttons from posting back when they are clicked? Thanks
2
9189
by: tony wong | last post by:
i wish to make the button blinking for 5 times at 1 second interval. how come i cannot see the blinking effect? is there any screen update function? Thanks. ****************************** Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Button1.BackColor = Color.Red Then
5
1601
by: rayne | last post by:
Hi, I just new to programming visual basic. just want to ask how to put a blinking effect on a label. thanks.
2
3296
by: ismailc | last post by:
Good day, I need help. I know i'm asking a lot, no clue on how to do - please help I want to create a <Div>with an <frame> in on the click of a button which controls the droping & closing of the div Only on click of the button the <div><iframe> should be visible with objects there in & a button within the <div> to close the div collapse. I'm trying to create an expand effect & once the button within the expand has been clicked the...
0
3934
by: robertjohnson1 | last post by:
In the event that your definitive decision for a development option comes down to these two choices, you will need to acclimate yourself with the key highlights that make Ionic and React Native Technology. Developed Application Type – The major difference between react and Ionic is the application these two technologies create. Hybrid software is developed by ionic software. In order to develop special smartphone features with ionic,...
0
13862
by: lllomh | last post by:
How does React native implement an English player?
0
8035
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8509
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8374
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4059
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2502
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1630
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.