Skip to content

Added Back Button Functionality #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StyleSheet, View, Modal, ViewPropTypes } from 'react-native';
import { StyleSheet, View, Modal, ViewPropTypes, BackHandler } from 'react-native';
import PropTypes from 'prop-types';
import LottieAnimation from 'lottie-react-native';

Expand All @@ -12,6 +12,7 @@ export default class AnimatedLoader extends React.PureComponent {
animationStyle: {},
speed: 1,
loop: true,
backButtonPress: () => Backhandler.exitApp(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Backhandler' is not defined

Typo error.

};

static propTypes = {
Expand All @@ -22,6 +23,7 @@ export default class AnimatedLoader extends React.PureComponent {
animationStyle: ViewPropTypes.style,
speed: PropTypes.number,
loop: PropTypes.bool,
backButtonPress: PropTypes.func,
};

animation = React.createRef();
Expand Down Expand Up @@ -63,7 +65,7 @@ export default class AnimatedLoader extends React.PureComponent {
visible={visible}
animationType={animationType}
supportedOrientations={['portrait']}
onRequestClose={() => {}}
onRequestClose={backButtonPress}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'backButtonPress' is not defined.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backButtonPress is defined

>
<View style={[styles.container, { backgroundColor: overlayColor }]}>
<View>{this._renderLottie()}</View>
Expand Down