Skip to content

Adding shape prop in SpotlightTourProvider causes app to crash when stop() is triggered #167

@larrythng96

Description

@larrythng96

When adding the shape prop to the SpotlightTourProvider, the app crashes unexpectedly when stop() method is triggered, and there is no console output or error message to help diagnose the issue.

Steps to Reproduce

  1. Wrap a component with SpotlightTourProvider.
    Pass a shape prop to the SpotlightTourProvider, for example:
const introTourSteps: TourStep[] = [
	{
		render: ({ stop }) => {
			return (
				<View>
					<Text>
						This is the first step of tour!
					</Text>
					<Button
						title='Stop!'
						onPress={stop}
					/>
				</View>
			);
		},
	},
]

return (
  <SpotlightTourProvider
    steps={introTourSteps}
    shape="rectangle"
  >
    {/* your component here that triggers start tour */}
  </SpotlightTourProvider>
)

2. Call the stop() method inside a tour step.
Expected Behavior: The tour ends.
Actual Behavior: The app crashes without logs when the shape prop is added to the SpotlightTourProvider.

Environment:
"react-native": "0.76.5",
"expo": "~52.0.20",
"react": "18.3.1",
"react-native-svg": "15.8.0"
Device/Simulator: iPhone 16 pro max
OS: iOS

Additional Information:
The issue only occurs when the shape prop is set in the SpotlightTourProvider. The value of the shape prop does not matter.

Work-around:
define shape prop inside introTourSteps instead like so:

	const introTourSteps: TourStep[] = [
		{
			shape: 'rectangle',
			render: ({ next }) => {
				return (
					<View style={styles.introTourView}>
						<Text style={styles.introTourText}>
							This is the first step of tour!
						</Text>
						<Button
							title='Stop!'
							onPress={stop}
						/>
					</View>
				);
			},
		},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions