Skip to content

Commit

Permalink
feat: add reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
Jungwirth, Scott committed Apr 23, 2024
1 parent b9ecc30 commit e10a22d
Showing 1 changed file with 14 additions and 102 deletions.
116 changes: 14 additions & 102 deletions ReproducerApp/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,113 +6,25 @@
*/

import React from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';

import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

type SectionProps = PropsWithChildren<{
title: string;
}>;

function Section({children, title}: SectionProps): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
}
import {FlatList, Text, View} from 'react-native';

function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';

const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};

return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
</Section>
<Section title="See Your Changes">
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
<FlatList
data={[1, 2, 3, 4]}
onScrollEndDrag={() => console.log('onScrollEndDrag')}
renderItem={() => (
<View style={{height: 400, borderWidth: 1}}>
<Text>
- Scroll fast, notice no log message [Android only]
{'\n\n'}- Scroll and hold (zero velocity), notice log message
appears
</Text>
</View>
</ScrollView>
</SafeAreaView>
)}
scrollEventThrottle={250}
/>
);
}

const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});

export default App;

0 comments on commit e10a22d

Please sign in to comment.