Skip to content

Commit

Permalink
updated test counter example on handling touchables
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Oct 24, 2022
1 parent 74c2e0e commit b2eda26
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ function VueCounter() {
const count = signal(0)

function Counter() {
const handleClick = e => {
const handleInc = e => {
e.stopPropagation()
count.value += 1
count.value++
}

const handleDec = e => {
e.stopPropagation()
count.value--
}

return (
Expand All @@ -56,18 +61,32 @@ function Counter() {
<Text fontSize={30} margin={10} color="white">
{count.value}
</Text>
{/* Additional view to force check bubbling */}
<View>
<View
onClick={handleClick}
onClick={handleInc}
borderRadius={6}
width={250}
margin={10}
backgroundColor={'#333'}
alignItems="center"
justifyContent="center"
>
<Text fontSize={30} margin={10} color="white">
+
</Text>
</View>

<View
onClick={handleDec}
borderRadius={6}
width={250}
margin={10}
backgroundColor={'#333'}
alignItems="center"
justifyContent="center"
>
<Text fontSize={30} margin={10} color="white">
Inc
-
</Text>
</View>
</View>
Expand Down

0 comments on commit b2eda26

Please sign in to comment.