11import dedent from "dedent" ;
22import { type ReactElement , useCallback , useMemo } from "react" ;
3- import { Alert , Animated , Button , Dimensions , SafeAreaView , Text , useAnimatedValue } from "react-native" ;
3+ import { Alert , Animated , Button , Dimensions , Platform , StatusBar , Text , View , useAnimatedValue } from "react-native" ;
4+ import { SafeAreaProvider , useSafeAreaInsets } from "react-native-safe-area-context" ;
45import {
56 AttachStep ,
7+ type RenderProps ,
8+ type SpotlightTour ,
69 SpotlightTourProvider ,
710 TourBox ,
811 type TourState ,
@@ -19,8 +22,9 @@ import {
1922} from "./App.styles" ;
2023import { DocsTooltip } from "./DocsTooltip" ;
2124
22- export function App ( ) : ReactElement {
25+ function AppContent ( ) : ReactElement {
2326 const gap = useAnimatedValue ( 0 , { useNativeDriver : true } ) ;
27+ const insets = useSafeAreaInsets ( ) ;
2428
2529 const showSummary = useCallback ( ( { index, isLast } : TourState ) => {
2630 Alert . alert (
@@ -40,7 +44,7 @@ export function App(): ReactElement {
4044 } , [ ] ) ;
4145
4246 const tourSteps = useMemo ( ( ) : TourStep [ ] => [ {
43- render : ( { next, pause } ) => (
47+ render : ( { next, pause } : RenderProps ) => (
4448 < SpotDescriptionView >
4549 < DescriptionText >
4650 < BoldText > { "Tour: Intro section\n" } </ BoldText >
@@ -59,7 +63,7 @@ export function App(): ReactElement {
5963 render : DocsTooltip ,
6064 } , {
6165 arrow : true ,
62- render : props => (
66+ render : ( props : RenderProps ) => (
6367 < TourBox
6468 title = "Tour: Customization"
6569 backText = "Previous"
@@ -92,7 +96,9 @@ export function App(): ReactElement {
9296 . start ( ( ) => resolve ( ) ) ;
9397 } ) ;
9498 } ,
95- render : ( { previous, stop } ) => (
99+ flip : true ,
100+ placement : "top" ,
101+ render : ( { previous, stop } : RenderProps ) => (
96102 < SpotDescriptionView >
97103 < DescriptionText >
98104 < BoldText > { "Tour: Try it!\n" } </ BoldText >
@@ -115,7 +121,12 @@ export function App(): ReactElement {
115121 } ] , [ ] ) ;
116122
117123 return (
118- < SafeAreaView >
124+ < View style = { {
125+ flex : 1 ,
126+ paddingTop : insets . top ,
127+ } }
128+ >
129+ < StatusBar translucent = { true } backgroundColor = "transparent" barStyle = "dark-content" />
119130 < SpotlightTourProvider
120131 steps = { tourSteps }
121132 overlayColor = "gray"
@@ -127,15 +138,16 @@ export function App(): ReactElement {
127138 motion = "bounce"
128139 shape = "circle"
129140 arrow = { { color : "#B0C4DE" } }
141+ coordinateAdjustment = { Platform . OS === "android" ? { y : insets . top } : undefined }
130142 >
131- { ( { resume, start, status } ) => (
143+ { ( { resume, start, status } : SpotlightTour ) => (
132144 < >
133145 { status !== "paused" && < Button title = "Start" onPress = { start } /> }
134146 { status === "paused" && < Button title = "Resume" onPress = { resume } /> }
135147
136148 < SectionContainerView >
137- < AttachStep index = { 1 } >
138- < TitleText > { "Introduction" } </ TitleText >
149+ < AttachStep index = { 0 } >
150+ < TitleText > { "Introduction. " } </ TitleText >
139151 </ AttachStep >
140152 < DescriptionText >
141153 { dedent `
@@ -146,7 +158,7 @@ export function App(): ReactElement {
146158 </ SectionContainerView >
147159
148160 < SectionContainerView >
149- < AttachStep index = { 0 } >
161+ < AttachStep index = { 1 } >
150162 < TitleText > { "Documentation" } </ TitleText >
151163 </ AttachStep >
152164 < DescriptionText >
@@ -176,6 +188,14 @@ export function App(): ReactElement {
176188 </ >
177189 ) }
178190 </ SpotlightTourProvider >
179- </ SafeAreaView >
191+ </ View >
192+ ) ;
193+ }
194+
195+ export function App ( ) : ReactElement {
196+ return (
197+ < SafeAreaProvider >
198+ < AppContent />
199+ </ SafeAreaProvider >
180200 ) ;
181201}
0 commit comments