Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

amlan
amlan

Posted on

     

[React-Native]Run a code before close

I want to run a code before a React-native app close. So when we close the app, before it closes, I want to run a JS code. Does anyone know a way to achieve that? I used useState clean up but doesnt seem to be firing when I close the app.

Top comments(4)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
256hz profile image
Abe Dolinger
Frontend / React Native dev
  • Location
    Seattle
  • Education
    Flatiron School
  • Pronouns
    He/him
  • Work
    Mobile Engineer @ Treecard
  • Joined

Pretty sure AppState - background will fire when you close the app.reactnative.dev/docs/appstate

CollapseExpand
 
amlana24 profile image
amlan
A Cloud architect by profession and a nerd by nature..
  • Location
    Vancouver, Canada
  • Work
    Cloud Architect
  • Joined

Thats really helpful..Didnt know about this..Thanks Abe..

CollapseExpand
 
256hz profile image
Abe Dolinger
Frontend / React Native dev
  • Location
    Seattle
  • Education
    Flatiron School
  • Pronouns
    He/him
  • Work
    Mobile Engineer @ Treecard
  • Joined

No problem, let me know if it works out for you!

CollapseExpand
 
seanmclem profile image
Seanmclem
Developer looking to be awesome
  • Location
    Floridia
  • Work
    Senior web developer at Earth
  • Joined

it doesn't

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

A Cloud architect by profession and a nerd by nature..
  • Location
    Vancouver, Canada
  • Work
    Cloud Architect
  • Joined

More fromamlan

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp