Skip to content

Commit

Permalink
fix: touchables not registering touches after scrolling
Browse files Browse the repository at this point in the history
Stopping the scroll was causing a glitch.
Seems like a react-native bug of some sort.

Fixes #123
  • Loading branch information
andreialecu committed Feb 18, 2021
1 parent cc9aeab commit 5598b11
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
30 changes: 19 additions & 11 deletions example/src/Shared/Contacts.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import * as React from 'react'
import { View, Text, StyleSheet, Platform } from 'react-native'
import {
View,
Text,
StyleSheet,
Platform,
TouchableOpacity,
} from 'react-native'
import * as Tabs from 'react-native-collapsible-tab-view'
import Animated, {
useAnimatedStyle,
Expand Down Expand Up @@ -70,17 +76,19 @@ class ContactItem extends React.PureComponent<{
const { item } = this.props

return (
<View style={styles.item}>
<View style={styles.avatar}>
<Text style={styles.letter}>
{item.name.slice(0, 1).toUpperCase()}
</Text>
<TouchableOpacity>
<View style={styles.item}>
<View style={styles.avatar}>
<Text style={styles.letter}>
{item.name.slice(0, 1).toUpperCase()}
</Text>
</View>
<View style={styles.details}>
<Text style={styles.name}>{item.name}</Text>
<Text style={styles.number}>{item.number}</Text>
</View>
</View>
<View style={styles.details}>
<Text style={styles.name}>{item.name}</Text>
<Text style={styles.number}>{item.number}</Text>
</View>
</View>
</TouchableOpacity>
)
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,6 @@ export const useScrollHandlerY = (
onBeginDrag: () => {
if (!enabled) return

// workaround to stop animated scrolls
scrollTo(
refMap[name],
0,
scrollY.value[tabIndex] + 0.1,
false,
`[${name}] stop scroll`
)

// ensure the header stops snapping
cancelAnimation(accDiffClamp)

Expand Down

0 comments on commit 5598b11

Please sign in to comment.