All Projects โ†’ xcarpentier โ†’ Rn Tourguide

xcarpentier / Rn Tourguide

Licence: other
๐ŸšฉMake an interactive step by step tour guide for your react-native app (a rewrite of react-native-copilot)

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Rn Tourguide

Sunset Cyberspace
๐ŸŽฎ๐Ÿ‘พRetro-runner Game made in Expo, Three.js, OpenGL, WebGL, Tween. ๐Ÿ•น
Stars: โœญ 54 (-79.93%)
Mutual labels:  tutorial, expo
Viewtooltip
A fluent tooltip for Android
Stars: โœญ 1,029 (+282.53%)
Mutual labels:  tutorial, tooltip
Firebase Instagram
๐Ÿ“ธ Instagram clone with Firebase Cloud Firestore, Expo, and React Native ๐Ÿ˜๐Ÿ˜
Stars: โœญ 389 (+44.61%)
Mutual labels:  tutorial, expo
Pillar Valley
๐Ÿ‘พA cross-platform video game built with Expo, three.js, and Firebase! ๐ŸŽฎ๐Ÿ•น
Stars: โœญ 242 (-10.04%)
Mutual labels:  tutorial, expo
Expo Native Firebase
๐Ÿ”ฅ Native Firebase Expo App (iOS, Android) Demo for Firestore, Notifications, Analytics, Storage, Messaging, Database ๐Ÿšจ
Stars: โœญ 197 (-26.77%)
Mutual labels:  tutorial, expo
Snake
๐Ÿ๐ŸŽฎ Snake game made with Expo & PIXI.js ๐Ÿ‘พ iOS, Android, and Web
Stars: โœญ 67 (-75.09%)
Mutual labels:  tutorial, expo
Expo Crossy Road
๐Ÿฅ๐Ÿš™ Crossy Road game clone made in Expo (iOS, Android, web), THREE.js, Tween, React Native. ๐Ÿ”
Stars: โœญ 701 (+160.59%)
Mutual labels:  tutorial, expo
Expo Three Demo
๐ŸŽ๐Ÿ‘ฉโ€๐Ÿซ Collection of Demos for THREE.js in Expo!
Stars: โœญ 76 (-71.75%)
Mutual labels:  tutorial, expo
Awesome React Native Web
๐Ÿ’™ React Native Web patterns, techniques, tips, and tricks โœจ
Stars: โœญ 215 (-20.07%)
Mutual labels:  tutorial, expo
react-native-popable
Popovers, tooltips for React Native
Stars: โœญ 298 (+10.78%)
Mutual labels:  tooltip, expo
Vaporschool
Learn how to build vapor applications from rookie to champion in a constructive way!
Stars: โœญ 259 (-3.72%)
Mutual labels:  tutorial
Doc
๐Ÿฆ‹ Raku documentation (tools and docs)
Stars: โœญ 259 (-3.72%)
Mutual labels:  tutorial
Understanding Nn
Tensorflow tutorial for various Deep Neural Network visualization techniques
Stars: โœญ 261 (-2.97%)
Mutual labels:  tutorial
Choo Handbook
๐Ÿš‚โœ‹๐Ÿ“– - Learn the choo framework through a set of exercises
Stars: โœญ 266 (-1.12%)
Mutual labels:  tutorial
Learn Generators
JavaScript ES(6|2015) generators workshopper. Learn in practice. ๐Ÿค˜
Stars: โœญ 257 (-4.46%)
Mutual labels:  tutorial
Dotnet Db Samples
.NET code samples for Oracle database developers
Stars: โœญ 260 (-3.35%)
Mutual labels:  tutorial
Deep Learning In Production
In this repository, I will share some useful notes and references about deploying deep learning-based models in production.
Stars: โœญ 3,104 (+1053.9%)
Mutual labels:  tutorial
Instagram
A universal instagram clone built with Expo
Stars: โœญ 258 (-4.09%)
Mutual labels:  expo
Karaf Tutorial
Stars: โœญ 256 (-4.83%)
Mutual labels:  tutorial
Line Bot Tutorial
line-bot-tutorial use python flask
Stars: โœญ 267 (-0.74%)
Mutual labels:  tutorial

RN-TourGuide

A flexible tourguide for your react native app!
๐ŸŽ‰ Webable ๐ŸŽ‰
(a rewriting of react-native-copilot)

RN Tourguide

๐ŸŽ‰DEMO WEB ๐ŸŽ‰

Installation

yarn add rn-tourguide
yarn add react-native-svg
react-native link react-native-svg

If you are using Expo:

expo install react-native-svg

Usage

import {
  TourGuideProvider, // Main provider
  TourGuideZone, // Main wrapper of highlight component
  TourGuideZoneByPosition, // Component to use mask on overlay (ie, position absolute)
  useTourGuideController, // hook to start, etc.
} from 'rn-tourguide'

// Add <TourGuideProvider/> at the root of you app!
function App() {
  return (
    <TourGuideProvider {...{ borderRadius: 16 }}>
      <AppContent />
    </TourGuideProvider>
  )
}

const AppContent = () => {
  const iconProps = { size: 40, color: '#888' }

  // Use Hooks to control!
  const {
    canStart, // a boolean indicate if you can start tour guide
    start, // a function to start the tourguide
    stop, // a function  to stopping it
    eventEmitter, // an object for listening some events
  } = useTourGuideController()

  // Can start at mount ๐ŸŽ‰
  // you need to wait until everything is registered ๐Ÿ˜
  React.useEffect(() => {
    if (canStart) {
      // ๐Ÿ‘ˆ test if you can start otherwise nothing will happen
      start()
    }
  }, [canStart]) // ๐Ÿ‘ˆ don't miss it!
  
  const handleOnStart = () => console.log('start')
  const handleOnStop = () => console.log('stop')
  const handleOnStepChange = () => console.log(`stepChange`)
  
  React.useEffect(() => {
    eventEmitter.on('start', handleOnStart)
    eventEmitter.on('stop', handleOnStop)
    eventEmitter.on('stepChange', handleOnStepChange)

    return () => {
      eventEmitter.off('start', handleOnStart)
      eventEmitter.off('stop', handleOnStop)
      eventEmitter.off('stepChange', handleOnStepChange)
    }
  }, [])

  return (
    <View style={styles.container}>
      {/*

          Use TourGuideZone only to wrap your component

      */}
      <TourGuideZone
        zone={2}
        text={'A react-native-copilot remastered! ๐ŸŽ‰'}
        borderRadius={16}
      >
        <Text style={styles.title}>
          {'Welcome to the demo of\n"rn-tourguide"'}
        </Text>
      </TourGuideZone>
      <View style={styles.middleView}>
        <TouchableOpacity style={styles.button} onPress={() => start()}>
          <Text style={styles.buttonText}>START THE TUTORIAL!</Text>
        </TouchableOpacity>

        <TourGuideZone zone={3} shape={'rectangle_and_keep'}>
          <TouchableOpacity style={styles.button} onPress={() => start(4)}>
            <Text style={styles.buttonText}>Step 4</Text>
          </TouchableOpacity>
        </TourGuideZone>
        <TouchableOpacity style={styles.button} onPress={() => start(2)}>
          <Text style={styles.buttonText}>Step 2</Text>
        </TouchableOpacity>
        <TouchableOpacity style={styles.button} onPress={stop}>
          <Text style={styles.buttonText}>Stop</Text>
        </TouchableOpacity>
        <TourGuideZone
          zone={1}
          shape='circle'
          text={'With animated SVG morphing with awesome flubber ๐Ÿฎ๐Ÿ’ฏ'}
        >
          <Image source={{ uri }} style={styles.profilePhoto} />
        </TourGuideZone>
      </View>
      <View style={styles.row}>
        <TourGuideZone zone={4} shape={'circle'}>
          <Ionicons name='ios-contact' {...iconProps} />
        </TourGuideZone>
        <Ionicons name='ios-chatbubbles' {...iconProps} />
        <Ionicons name='ios-globe' {...iconProps} />
        <TourGuideZone zone={5}>
          <Ionicons name='ios-navigate' {...iconProps} />
        </TourGuideZone>
        <TourGuideZone zone={6} shape={'circle'}>
          <Ionicons name='ios-rainy' {...iconProps} />
        </TourGuideZone>
        <TourGuideZoneByPosition
          zone={7}
          shape={'circle'}
          isTourGuide
          bottom={30}
          left={35}
          width={300}
          height={300}
        />
      </View>
    </View>
  )
}

TourGuide props:

interface TourGuideZoneProps {
  zone: number // A positive number indicating the order of the step in the entire walkthrough.
  isTourGuide?: boolean // return children without wrapping id false
  text?: string // text in tooltip
  shape?: Shape // which shape
  maskOffset?: number // offset around zone
  borderRadius?: number // round corner when rectangle
  startAtMount?: boolean //  start at mount
  keepTooltipPosition?: boolean
  tooltipBottomOffset?: number
  children: React.ReactNode
}

type Shape = 'circle' | 'rectangle' | 'circle_and_keep' | 'rectangle_and_keep'

export interface TourGuideProviderProps {
  tooltipComponent?: React.ComponentType<TooltipProps>
  tooltipStyle?: StyleProp<ViewStyle>
  labels?: Labels
  androidStatusBarVisible?: boolean
  backdropColor?: string
  verticalOffset?: number
  wrapperStyle?: StyleProp<ViewStyle>
  maskOffset?: number
  borderRadius?: number
  animationDuration?: number
  children: React.ReactNode
}

interface TooltipProps {
  isFirstStep?: boolean
  isLastStep?: boolean
  currentStep: Step
  labels?: Labels
  handleNext?(): void
  handlePrev?(): void
  handleStop?(): void
}

interface Labels {
  skip?: string
  previous?: string
  next?: string
  finish?: string
}

In order to start the tutorial, you can call the start function from useTourGuideController hook:

function HomeScreen() {
  const { start } = useTourGuideController()

  React.useEffect(() => {
    start()
  }, [])


  render() {
    // ...
  }
}

export default HomeScreen

If you are looking for a working example, please check out this link.

Custom tooltip component

You can customize the tooltip by passing a component to the copilot HOC maker. If you are looking for an example tooltip component, take a look at the default tooltip implementation.

const TooltipComponent = ({
  isFirstStep,
  isLastStep,
  handleNext,
  handlePrev,
  handleStop,
  currentStep,
}) => (
  // ...
);

<TourGuideProvider {...{tooltipComponent: TooltipComponent}}>
// ...
</TourGuideProvider>

Custom tooltip styling

You can customize tooltips style:

const style = {
  backgroundColor: '#9FA8DA',
  borderRadius: 10,
  paddingTop: 5,
}

<TourGuideProvider {...{ tooltipStyle: style }}>
// ...
</TourGuideProvider>

Custom mask color

You can customize the mask color - default is rgba(0, 0, 0, 0.4), by passing a color string to the copilot HOC maker.

<TourGuideProvider {...{ backdropColor: 'rgba(50, 50, 100, 0.9)' }}>
  // ...
</TourGuideProvider>

Custom labels (for i18n)

You can localize labels:

<TourGuideProvider
  {...{
    labels: {
      previous: 'Vorheriger',
      next: 'Nรคchster',
      skip: 'รœberspringen',
      finish: 'Beenden',
    },
  }}
>
  // ...
</TourGuideProvider>

Listening to the events

Along with start(), useTourGuideController passes copilotEvents function to the component to help you with tracking of tutorial progress. It utilizes mitt under the hood, you can see how full API there.

List of available events is:

  • start โ€” Copilot tutorial has started.
  • stop โ€” Copilot tutorial has ended or skipped.
  • stepChange โ€” Next step is triggered. Passes Step instance as event handler argument.

Contributing

Issues and Pull Requests are always welcome.

Hire an expert!

Looking for a ReactNative freelance expert with more than 14 years experience? Contact me from my website!

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].