Skip to content

Commit

Permalink
chore(js-ts): Convert app/components/Views/AndroidBackHandler/index.j…
Browse files Browse the repository at this point in the history
…s to TypeScript (#11546)

chore(js-ts): Convert app/components/Views/AndroidBackHandler/index.js
to TypeScript

## Description
This PR converts the `AndroidBackHandler` component from JavaScript to
TypeScript. The `navigation` prop is now typed using
`NavigationProp<any>`, and `propTypes` have been removed.

## Labels
- needs-dev-review
- team-mobile-platform
- skip-sonar-cloud
- Run Smoke E2E

[This Devin
run](https://preview.devin.ai/devin/fe052a3553114a6dbeec9dc4aecd3384)
was requested by naveen.


If you have any feedback, you can leave comments in the PR and I'll
address them in the app!

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Kylan Hurt <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and kylanhurt authored Oct 10, 2024
1 parent f6d0a1a commit 092d567
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { NavigationProp, ParamListBase } from '@react-navigation/native';
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { BackHandler, InteractionManager } from 'react-native';

interface AndroidBackHandlerProps {
/**
* react-navigation object used to switch between screens
*/
navigation?: NavigationProp<ParamListBase>;
/**
* Custom callback to call on back press event
*/
customBackPress: () => void;
}

/**
* PureComponent that handles android hardware back button
*/
export default class AndroidBackHandler extends PureComponent {
static propTypes = {
/**
* react-navigation object used to switch between screens
*/
navigation: PropTypes.object,
/**
* Custom callback to call on back press event
*/
customBackPress: PropTypes.func,
};

export default class AndroidBackHandler extends PureComponent<AndroidBackHandlerProps> {
pressed = false;

componentDidMount() {
Expand Down Expand Up @@ -46,6 +46,7 @@ export default class AndroidBackHandler extends PureComponent {
}
setTimeout(() => (this.pressed = false), 300);
}
return undefined;
};

render() {
Expand Down

0 comments on commit 092d567

Please sign in to comment.