-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[new architecture] onScrollEndDrag missing event property #42533
Comments
|
Hi @mccraveiro, thanks for opening the issue, but this does not reproduce. I also tried in a new app from 0.73 and the events work fine with both
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React from 'react';
import {
SafeAreaView,
StatusBar,
Text,
FlatList,
ScrollView,
useColorScheme,
StyleSheet,
Button,
} from 'react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
type Props = {
setOnScrollEndDragInvoked: (value: boolean) => void;
};
function ScrollViewExample({
setOnScrollEndDragInvoked,
}: Props): React.JSX.Element {
return (
<ScrollView
onScrollEndDrag={() => {
setOnScrollEndDragInvoked(true);
}}
onScrollBeginDrag={() => {
setOnScrollEndDragInvoked(false);
}}>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
<Text style={styles.text}>Something</Text>
</ScrollView>
);
}
function FlatListExample({
setOnScrollEndDragInvoked,
}: Props): React.JSX.Element {
const items = [
{id: 1, content: 'Item 1'},
{id: 2, content: 'Item 2'},
{id: 3, content: 'Item 3'},
{id: 4, content: 'Item 4'},
{id: 5, content: 'Item 5'},
{id: 6, content: 'Item 6'},
{id: 7, content: 'Item 7'},
{id: 8, content: 'Item 8'},
{id: 9, content: 'Item 9'},
{id: 10, content: 'Item 10'},
{id: 11, content: 'Item 11'},
{id: 12, content: 'Item 12'},
{id: 13, content: 'Item 13'},
{id: 14, content: 'Item 14'},
{id: 15, content: 'Item 15'},
{id: 16, content: 'Item 16'},
{id: 17, content: 'Item 17'},
{id: 18, content: 'Item 18'},
{id: 19, content: 'Item 19'},
{id: 20, content: 'Item 20'},
{id: 21, content: 'Item 21'},
{id: 22, content: 'Item 22'},
{id: 23, content: 'Item 23'},
{id: 24, content: 'Item 24'},
{id: 25, content: 'Item 25'},
{id: 26, content: 'Item 26'},
{id: 27, content: 'Item 27'},
{id: 28, content: 'Item 28'},
{id: 29, content: 'Item 29'},
];
return (
<FlatList
onScrollEndDrag={() => {
setOnScrollEndDragInvoked(true);
}}
onScrollBeginDrag={() => {
setOnScrollEndDragInvoked(false);
}}
data={items}
renderItem={({item}) => {
return (
<Text style={styles.text} key={item.id}>
{item.content}
</Text>
);
}}
/>
);
}
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
const [onScrollEndDragInvoked, setOnScrollEndDragInvoked] =
React.useState(false);
const [useFlatList, setUseFlatlist] = React.useState(false);
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<Text style={styles.title}>
Is onScrollEndDrag invoked: {onScrollEndDragInvoked ? 'YES' : 'NO'}
</Text>
<Button
onPress={() => {
setUseFlatlist(!useFlatList);
setOnScrollEndDragInvoked(false);
}}
title={useFlatList ? 'Use ScrollView' : 'Use FlatList'}
/>
{useFlatList ? (
<FlatListExample
setOnScrollEndDragInvoked={setOnScrollEndDragInvoked}
/>
) : (
<ScrollViewExample
setOnScrollEndDragInvoked={setOnScrollEndDragInvoked}
/>
)}
</SafeAreaView>
);
}
const styles = StyleSheet.create({
text: {
fontSize: 25,
textAlign: 'center',
},
title: {
fontSize: 20,
textAlign: 'center',
color: '#FA0',
},
});
export default App; |
Any update on this issue? I'd like to use velocity to figure out whether onMomentumScrollEnd will be triggered. |
it is invoked. but the callback param event.nativeEvent, is missing velocity parameter :( |
May fix it in #48319 |
Description
On new architecture the onScrollEndDrag event is missing the velocity property
Steps to reproduce
React Native Version
0.73.2
Affected Platforms
Runtime - iOS
Areas
Fabric - The New Renderer
Output of
npx react-native info
Stacktrace or Logs
Log on new architecture:
Reproducer
missing (I'll create later)
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: