Skip to content
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

onPress for "back button" on Android only works sometimes #2221

Closed
oakis opened this issue Aug 11, 2017 · 3 comments
Closed

onPress for "back button" on Android only works sometimes #2221

oakis opened this issue Aug 11, 2017 · 3 comments

Comments

@oakis
Copy link

oakis commented Aug 11, 2017

Version

Tell us which versions you are using:

  • react-native-router-flux: github:aksonov/react-native-router-flux#92f055e52d11e0ff8c38bd5f1a5100bc927d5242
  • react-native: 0.47.1

Expected behaviour

Touch fires onPress event every time.

Actual behaviour

Touch fires randomly. Sometimes it takes 7 touches for it to respond.


This is my code for the back button.

<Router
	titleStyle={{ color: colors.alternative, alignSelf: 'center', fontSize: 14 }}
	navigationBarStyle={{ backgroundColor: colors.primary, paddingHorizontal: 10 }}
	rightButtonTextStyle={{ color: colors.alternative }}
	leftButtonTextStyle={{ color: colors.alternative }}
	renderBackButton={() => {
		return (
			<Icon 
				name="ios-arrow-back"
				style={{ color: colors.alternative, fontSize: 24 }}
				onPress={() => Actions.pop()}
			/>
		);
	}}
>
@oakis
Copy link
Author

oakis commented Aug 12, 2017

Solved it with the code below.. maybe not best practice but it works.

<Router
	titleStyle={{ color: colors.alternative, alignSelf: 'center', fontSize: 14 }}
	navigationBarStyle={{ backgroundColor: colors.primary, paddingHorizontal: 10 }}
	rightButtonTextStyle={{ color: colors.alternative }}
	leftButtonTextStyle={{ color: colors.alternative }}
	renderBackButton={() => {
		return (
			<TouchableWithoutFeedback
				onPress={() => Actions.pop()}
			>
				<View
					style={{
						width: 30,
						height: 30,
						justifyContent: 'center'
					}}
				>
					<Icon 
						name="ios-arrow-back"
						style={{ color: colors.alternative, fontSize: iconSize }}
					/>
				</View>
			</TouchableWithoutFeedback>
		);
	}}
>

@oakis
Copy link
Author

oakis commented Aug 13, 2017

Is there any better way to solve this? Please let me know..

@aksonov
Copy link
Owner

aksonov commented Aug 14, 2017

@oakis Sorry, but it doesn't have nothing with RNRF, but with React Native or React Navigation (used by RNRF) - try pure react-navigation demos and if it works well (I doubt so), reopen this issue.

@aksonov aksonov closed this as completed Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants