1.0.8 • Published 5 years ago

alopeyk-tooltip v1.0.8

Weekly downloads
30
License
-
Repository
-
Last release
5 years ago

alopeyk-tooltip

Tooltip for React-native

Getting started

$ npm install alopeyk-tooltip --save

Mostly automatic installation

$ react-native link alopeyk-tooltip

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]

  2. Go to node_modulesalopeyk-tooltip and add Tooltip.xcodeproj

  3. In XCode, in the project navigator, select your project. Add libTooltip.a to your project's Build PhasesLink Binary With Libraries

  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.alopeyk.nativemodule.tooltip.TooltipPackage; to the imports at the top of the file

  • Add new TooltipPackage() to the list returned by the getPackages() method

  1. Append the following lines to android/settings.gradle:
include ':alopeyk-tooltip'

project(':alopeyk-tooltip').projectDir = new File(rootProject.projectDir, '../node_modules/alopeyk-tooltip/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
compile project(':alopeyk-tooltip')

Usage

import Tooltip from 'alopeyk-tooltip';
  • By React View
<Tooltip 
	text={"Description"} 
	visible={this.state.visible} 
	target={this.state.target} 
	parent={this.state.parent}
	onClick={(e) => {
		if(e.position === Tooltip.ClickPosition.OVERLAY){
			Tooltip.dismiss();
		}
	}}
	... />
  • By React Method
Tooltip.show(
    this.state.target,
    this.state.parent,
    {
        text: 'Description'
    }
)

Methods

MethodArgsDefaultNote
show(target: Ref, parent: Ref, Props: Object)Show Tooltip
dismissDismiss all Tooltips

Props

  • General
PropTypeDefaultNote
textstringText which needs to be displayed
autoHidebooltrueShould tip view get auto dismiss
durationnumber4000Duration after which tooltip view should be dismissed
clickToHideboolfalseOn click should tooltip view be dismissed
cornernumber30Radius of corner
tintColorstring#1F7C82Color of tooltip view background
textColorstring#FFFFFFColor of text
overlayColorstringColor of overlay
textSizenumber12Size of text displayed
gravitynumberGravity.CENTERGravity of text
visibleboolShould tooltip be displayed
shadowbooltrueShadow on tooltip view
arrowbooltrueDisplay Arrow
positionnumberPosition.TopPosition of the tooltip view
targetobjectReference of react component of which you need the tooltip
onHidefuncEvent function invoked on tooltip hide
onDisplayfuncEvent function invoked on tooltip display
onPressfuncEvent function invoked on tooltip click
  • IOS
PropTypeDefaultNote
parentobjectReference of the parent component of which you need the tooltip to fit in
  • Android
PropTypeDefaultNote
alignnumberAlign.CENTERAlignment of tooltip

Constants

Position: {
  LEFT
  TOP
  RIGHT
  BOTTOM
}
ClickPosition: {
  OVERLAY
  TOOLTIP
  TARGET
}
Gravity  = {
  START
  CENTER
  END
}
Align  = {
  START
  CENTER
  END
}
1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago