Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/waynekim92/react-native-good-tooltip

react-native tooltip that do not interfere with user interaction
https://github.com/waynekim92/react-native-good-tooltip

component react-native tooltip ui

Last synced: about 4 hours ago
JSON representation

react-native tooltip that do not interfere with user interaction

Awesome Lists containing this project

README

        

# React Native Good Tooltip

Tooltips do not interrupt the user's flow. I'm not positive about the flow of using the app after touching the tooltip to close it.
So this component doesn't use Modal.

## Installation

```sh
npm install react-native-good-tooltip
```

## Usage

**⚠️Warning⚠️️**
This component will need to be used with styles (z-Index and Overflow).
You will immediately see the need for zIndex if you use "bottom" placement.
Please refer to the example project and video.

```tsx
import Tooltip from 'react-native-good-tooltip';

// ...

{/* your component */}

```

## Video





## Props

## Props
| Prop | Type | Default | Description |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|-----------------------------------------------------------------------------------------------|
| `visible` | `boolean` | `undefined` | Whether the tooltip is visible. |
| `rerenderKey` | `any` | `undefined` | Key to force re-rendering of the tooltip. |
| `placement` | `'top' \| 'bottom' \| 'left' \| 'right'` | **required** | The position of the tooltip relative to the anchor. |
| `anchor` | `'center' \| 'left' \| 'right' \| 'top' \| 'bottom'` | `'center'` | The alignment of the tooltip relative to the anchor. |
| `offset` | `{ position?: { x?: number, y?: number }, arrow?: { x?: number, y?: number } }` | `undefined` | The offset for the tooltip and arrow position. |
| `arrowElement` | `React.ReactElement` | `undefined` | Custom arrow element. |
| `styles` | `{color?: ColorValue \| 'primary', containerStyle?: ViewStyle, tooltipStyle?: ViewStyle, arrowSize?: { width?: number, height?: number }, closeSize?: { width?: number, height?: number} }` | `undefined` | Custom styles for the tooltip. |
| `text` | `string \| React.ReactElement` | **required** | The content of the tooltip. |
| `children` | `React.ReactElement` | `undefined` | The element to which the tooltip is anchored. |
| `onPress` | `() => void` | `undefined` | Function to call when the tooltip is pressed. |
| `onVisibleChange` | `(isVisible: boolean) => void` | `undefined` | Function to call when the visibility of the tooltip changes. |
| `delayShowTime` | `number` | `0` | The delay time before showing the tooltip. |
| `autoHideTime` | `number` | `5000` | The time after which the tooltip will automatically hide. |
| `disableAutoHide` | `boolean` | `false` | Whether to disable the auto-hide feature. |
| `disablePressToClose` | `boolean` | `false` | Whether to disable the press-to-close feature. |
| `numberOfLines` | `number` | `2` | The number of lines to display in the tooltip text. |

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)