Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created September 12, 2020 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunosabot/dcd186a2e30979c880e90783194c5460 to your computer and use it in GitHub Desktop.
Save brunosabot/dcd186a2e30979c880e90783194c5460 to your computer and use it in GitHub Desktop.
import React, { useState } from "react";
import { Text, TouchableHighlight, View } from "react-native";
export default function MyClickableComponent() {
const [clicked, setClicked] = useState(false);
return (
<TouchableHighlight
activeOpacity={0.6}
onPress={() => setClicked(true)}
underlayColor="rgba(0, 0, 0, 0.3)"
>
<View>
<Text>{clicked ? "Click me" : "Clicked"}</Text>
</View>
</TouchableHighlight>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment