2.0.3 • Published 3 years ago

react-native-action-tips v2.0.3

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

react-native-action-tips

All Contributors

npm npm licence npm downloads

Cross platform tooltip for React Native.

Install

To get started install via npm:

 npm install react-native-action-tips --save

Usage

Import:

 import ActionTip from 'react-native-action-tips';

You can use the imperative API to control the action tip:

const actionTipRef = useRef(null);

<ActionTip
  ref={actionTipRef}
  position={{ top: 50 }}
/>

someMethod() {
  actionTipRef.current.show("Link has been copied");
}

The declarative API for controlling the action tip:

const [isVisible, setIsVisible] = useState(false);

<ActionTip
  visible={isVisible}
  text="Link has been copied"
  position={{ top: 50 }}
/>

Notes

The action tip exposes imperative show() and hide() functions.

The position of the component can be customised through the position prop by passing an object as such { top: 0, bottom: 0, left: 0, right: 0 }. By default the component uses "absolute" positioning. This can be changed by passing style through the containerStyle prop.

Props

PropTypeOptionalDefaultDescription
refstringYesref allows you to call the show() and hide() methods.
textstringYesText which is displayed inside the action tip.
visiblebooleanYesControls the tooltip visibility.
durationnumberYes2000 msDuration until the action tip dismisses.
animationInDurationnumberYes150 msDuration of fade-in animation.
animationOutDurationnumberYes700 msDuration of fade-out animation.
opacitynumberYes0.85Maximum opacity the tip should animate to.
positionobjectYes0Absolute positioning of the component.
containerStylestyleYesStyle applied to the action tip container.
textStylestyleYesStyle applied to the action tip text.
onHidefunctionYesCallback when tooltip is hidden

Contributing

If you want to issue a PR, go ahead ;)

Authors

License

This project is licensed under the MIT License

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago