Skip to content

Commit

Permalink
added repro
Browse files Browse the repository at this point in the history
Co-authored-by: Kacper Kafara <kacper.kafara@swmansion.com>
  • Loading branch information
alduzy committed Oct 9, 2024
1 parent 358d4c9 commit 98e25f8
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
98 changes: 98 additions & 0 deletions apps/src/tests/Test2395.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import * as React from 'react';
import {
FlatList,
Image,
Pressable,
StyleSheet,
Text,
View,
ViewProps,
} from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

const Stack = createNativeStackNavigator();

export default function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Title"
component={Screen}
options={{
headerLargeTitle: true,
headerRight: () => (
<View
style={{
backgroundColor: 'lightblue',
padding: 3,
height: 100,
}}>
<Text>Right</Text>
</View>
),
headerLeft: () => (
<View
style={{
backgroundColor: 'goldenrod',
padding: 8,
}}>
<Text>Left</Text>
</View>
),
}}
/>
</Stack.Navigator>
</NavigationContainer>
);
}

function Item({ children, ...props }: ViewProps) {
return (
<View style={styles.item} {...props}>
<Image source={require('../assets/trees.jpg')} style={styles.image} />
<Text style={styles.text}>{children}</Text>
</View>
);
}

function Screen() {
return (
<FlatList
style={styles.container}
data={Array.from({ length: 20 }).fill(0) as number[]}
renderItem={({ index }) => (
<Pressable
key={index}
style={({ pressed }) => (pressed ? styles.pressed : undefined)}>
<Item>List item {index + 1}</Item>
</Pressable>
)}
/>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'mediumseagreen',
},
item: {
flexDirection: 'row',
alignItems: 'center',
padding: 10,
gap: 10,
},
text: {
fontSize: 24,
color: 'black',
},
image: {
width: 50,
height: 50,
},
pressed: {
backgroundColor: 'seagreen',
},
});
1 change: 1 addition & 0 deletions apps/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export { default as Test2271 } from './Test2271';
export { default as Test2282 } from './Test2282';
export { default as Test2317 } from './Test2317';
export { default as Test2332 } from './Test2332';
export { default as Test2395 } from './Test2395';
export { default as TestScreenAnimation } from './TestScreenAnimation';
export { default as TestHeader } from './TestHeader';
export { default as TestHeaderTitle } from './TestHeaderTitle';
Expand Down

0 comments on commit 98e25f8

Please sign in to comment.