Skip to content

React Navigation is not working on TouchableOpacity #1225

@ajaysaini-sgvu

Description

@ajaysaini-sgvu

I tried react navigation on Button which is working fine. I want to customize Button so this made me to go for TouchableOpacity. I am trying to setup react native navigation like below which is not working now with TouchableOpacity.

/**
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from "react";
import {
  AppRegistry,
  Image,
  View,
  Text,
  Button,
  StyleSheet,
  TouchableOpacity
} from "react-native";
import { StackNavigator } from "react-navigation";
import EnableNotificationScreen from "./EnableNotificationScreen";
import styles from "./Styles";
import * as strings from "./Strings";

class SplashScreen extends Component {
  render() {
	console.disableYellowBox = true;
	const { navigate } = this.props.navigation;
	return (
	  <View style={styles.container}>
		<Image source={require("./img/talk_people.png")} />
		<Text style={styles.textStyle}> {strings.talk_people} </Text>

		<TouchableOpacity>
		  <View
			style={{
			  backgroundColor: "#FE434C",
			  alignItems: "center",
			  justifyContent: "center",
			  borderRadius: 10,
			  width: 240,
			  marginTop: 30,
			  height: 40
			}}
			onPress={() => {
			  navigate("EnableNotifcation");
			}}
		  >
			<Text style={{ color: "white" }}>CONTINUE</Text>
		  </View>
		</TouchableOpacity>
	  </View>
	);
  }
}

const ScheduledApp = StackNavigator(
  {
	Splash: {
	  screen: SplashScreen,
	  navigationOptions: {
		header: {
		  visible: false
		}
	  }
	},
	EnableNotification: {
	  screen: EnableNotificationScreen,
	  navigationOptions: {
		header: {
		  visible: false
		}
	  }
	}
  },
  {
	initialRouteName: "Splash"
  }
);

AppRegistry.registerComponent("Scheduled", () => ScheduledApp); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions