npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-guide-mark

v1.0.61

Published

React Native Guide Mark / Coach Mark to guide first time app users

Downloads

21

Readme

React Native Guide Mark

This React Native module is for guiding the first time user throughout the app.

guide mark in action

Installation

yarn: yarn add react-native-guide-mark, npm: npm install react-native-guide-mark

Example

  1. import react-native-guide-mark:
import { GuideMark } from 'react-native-guide-mark';
  1. create a guide mark mask:
export const App = () => {
    const [visible, setVisible] = React.useState(true);
    return (
        <GuideMark
            title="Step 1"
            description="This is the first step"
            visible={visible}
            onButtonPress={() => setVisible(false)}
            top={100}
            left={150}
        />
    );
};

Using ref

export const App = () => {
    const buttonRef = useRef(null); //1. creating ref for the pointing element
    const [visible, setvisible] = useState(false);

    return (
        <View>
            <GuideMark
                visible={visible}
                title="Click here"
                description="To see a magic!"
                buttonTitle={'Show me!'}
                onButtonPress={() => {
                    setvisible(false);
                    setvisible2(true);
                    setshowImage(true);
                }}
                pointRef={buttonRef} //3. Passing ref of pointing element to guide mark
            />
            <View style={{ flexDirection: 'row', justifyContent: 'center' }}>
                <View style={{ paddingHorizontal: 30 }} ref={buttonRef} collapsable={false}>
                    {/* 2. assign ref to required pointing element */}
                    <Button
                        title="Click Here"
                        onPress={() => {
                            setvisible(true);
                        }}
                    />
                </View>
            </View>
        </View>
    );
};
  1. Create a ref with userRef.
  2. assign that ref to required View element and add collapsable={false} to it.
  3. pass the ref to pointRef prop.

Note: Make sure to add collapsable={false} to the View element, otherwise ref measurement will not be available in Android.

Props

| Name | Type | Default | Description | | ------------------ | ----------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | visible | Boolean | false | true:show | false:hide the mask | | title | String | null | title of the mask | | titleTextStyle | Object | {fontSize: 34, fontWeight: "bold",color: 'white'} | Title text style | | description | String | null | Description of mask | | descriptionStyle | Object | {fontSize: 14,color: 'white',fontWeight:"100"} | Description text style | | buttonTitle | String | null | Title of the button (Built in button will be enabled only if onButtonPress is set with function) | | onButtonPress | Function | null | Event on button press | | onMarkPress | Function | null | Event on press of marked spot | | left | number | String | 0 | Position from left of the screen, Number: 0 to maximum display width, String: percentage valuefrom 0% to 100% | | top | Number | String | 0 | Position from top of the screen, Number: 0 to maximum display height, String: percentage value from 0% to 100% | | markSize | Number | 150 | size of mark | | markImage | Require | Object | require('mark.png') | PNG image with transparent at middle & semi transparent at the edges (matching to mask color), Note: Make sure the image matches with mask, otherwise, square patch will be visible around the mark. | | maskBgColor | String | "rgba(0,0,0,0.75)" | Mask color. | | buttonElm | React Component | null | Custom button component | | pointRef | Ref | null | To pont the mark on required View element, need to pass ref of the elemnt, mark will automatically calculates the measurements. |

Tips on using single guide mark

Here are the some cool tips how you can use it in better way to guide users

  • When user open your app first time, trigger visible prop with true with componentDidMount ,useEffect or may be by default by keeping state to true.
  • You can make use of onButtonPress action to navigate to next screen, do some action or may be set the state of this mark to false & next mark as true. You can make use of onMarkPress action to do similar stuff as well
  • Make use of AsyncStorage by setting some status in store not to open the mask next time or you may use custom api call to do the same.

Next up

  • [x] Provide ref to element
  • [ ] Wizard
  • [ ] Custom hook (if its worthy of doing!)