473,418 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,418 developers and data experts.

React to native button blinking effect

3
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 12340

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

Similar topics

5
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...
6
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...
11
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....
2
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. ******************************...
5
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
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...
0
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...
0
by: lllomh | last post by:
How does React native implement an English player?
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.