Skip to content

Commit

Permalink
Added bug reproducing code
Browse files Browse the repository at this point in the history
  • Loading branch information
GionnyBanana committed Jul 1, 2024
1 parent 25b5dc0 commit 55e4ca1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 103 deletions.
129 changes: 27 additions & 102 deletions ReproducerApp/App.tsx
Original file line number Diff line number Diff line change
@@ -1,117 +1,42 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/

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;
}>;
import {Animated, SectionList, StyleSheet, Text} from 'react-native';

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>
);
}
const TEST_DATA = Array(6).fill({
title: 'test Title',
data: Array(15).fill({
name: 'data name',
}),
});

function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const testRef = React.useRef<Animated.Value>(new Animated.Value(0));

const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
React.useEffect(() => {
Animated.timing(testRef.current, {
toValue: 1,
duration: 150,
useNativeDriver: true,
}).start();
}, []);

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 />
</View>
</ScrollView>
</SafeAreaView>
<SectionList
sections={TEST_DATA}
stickySectionHeadersEnabled={true}
renderItem={() => <Text>item</Text>}
renderSectionHeader={({section: {title}}) => (
<Text style={styles.sectionTitle}>{title}</Text>
)}
/>
);
}

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

Expand Down
2 changes: 1 addition & 1 deletion ReproducerApp/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down

0 comments on commit 55e4ca1

Please sign in to comment.