1- import React , { ClassAttributes , isValidElement , useContext , useEffect , useRef } from "react" ;
2- import { StyleProp , View , ViewProps , ViewStyle } from "react-native" ;
1+ import React , { useContext , useEffect , useRef } from "react" ;
2+ import { StyleProp , View , ViewStyle } from "react-native" ;
3+ import styled from "styled-components/native" ;
34
45import { SpotlightTourContext } from "./SpotlightTour.context" ;
56
@@ -9,6 +10,10 @@ interface AttachStepProps {
910 style ?: StyleProp < ViewStyle > ;
1011}
1112
13+ const StepView = styled . View `
14+ align-self: flex-start;
15+ ` ;
16+
1217export const AttachStep : React . FC < AttachStepProps > = ( { children, disabled, index, style } ) => {
1318 const { current, changeSpot, spot } = useContext ( SpotlightTourContext ) ;
1419
@@ -26,16 +31,9 @@ export const AttachStep: React.FC<AttachStepProps> = ({ children, disabled, inde
2631 }
2732 } , [ current , disabled ] ) ;
2833
29- if ( isValidElement ( children ) && React . Children . count ( children ) === 1 ) {
30- return React . cloneElement < ClassAttributes < View > & ViewProps > (
31- React . Children . only ( children ) ,
32- { ref : childRef , collapsable : false }
33- ) ;
34- }
35-
3634 return (
37- < View ref = { childRef } collapsable = { false } style = { style } >
35+ < StepView ref = { childRef } collapsable = { false } style = { style } >
3836 { children }
39- </ View >
37+ </ StepView >
4038 ) ;
4139} ;
0 commit comments