-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Add check version to new arch on TimetoTisplay (#4160)
* add check version to new arch * screen rename, nits on if condition * lint? * lint * lint * make more data from sample, requested changes * remove before effect
- Loading branch information
1 parent
4412b4c
commit 52c0562
Showing
6 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
samples/react-native/src/Screens/HeavyNavigationScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import * as React from 'react'; | ||
import { Button, View, StyleSheet, Text, ScrollView } from 'react-native'; | ||
|
||
import * as Sentry from '@sentry/react-native'; | ||
import { StackNavigationProp } from '@react-navigation/stack'; | ||
|
||
interface Props { | ||
navigation: StackNavigationProp<any, 'HeavyNatigavionScreen'>; | ||
route?: { | ||
params?: { | ||
manualTrack: boolean; | ||
}; | ||
}; | ||
} | ||
const buttonTitles = Array.from( | ||
{ length: 500 }, | ||
(_, index) => `Sample button ${index + 1}`, | ||
); | ||
|
||
/** | ||
* this page takes around 300ms to initially display, we navigate to another page in 100ms. | ||
* The time to initial display will never be finished on this page. | ||
*/ | ||
const HeavyNavigationScreen = (props: Props) => { | ||
const content = ( | ||
<ScrollView style={styles.screen}> | ||
<View style={styles.titleContainer}> | ||
<Text style={styles.title}> | ||
Heavy page only intended for navigating to another page while the page | ||
is loading. | ||
</Text> | ||
</View> | ||
{buttonTitles.map((title, index) => ( | ||
<Button key={index} title={title} /> | ||
))} | ||
</ScrollView> | ||
); | ||
|
||
React.useEffect(() => { | ||
setTimeout(() => { | ||
props.navigation.goBack(); | ||
}, 1); | ||
}); | ||
return ( | ||
<> | ||
{props.route?.params?.manualTrack ? ( | ||
<Sentry.TimeToInitialDisplay record={true}> | ||
{content} | ||
</Sentry.TimeToInitialDisplay> | ||
) : ( | ||
content | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default Sentry.withProfiler(HeavyNavigationScreen); | ||
|
||
const styles = StyleSheet.create({ | ||
screen: { | ||
flex: 1, | ||
padding: 16, | ||
}, | ||
titleContainer: { | ||
paddingBottom: 12, | ||
}, | ||
title: { | ||
fontSize: 24, | ||
fontWeight: '700', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters