1.0.1 • Published 5 years ago

react-native-spotlight-view v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

react-native-spotlight-view npm version

Getting started

$ npm install react-native-spotlight-view --save

Example

alt text

Usage

import { SpotLight, SpotLightFromRef } from 'react-native-spotlight-view';

<SpotLight
  diameter={100}
  offsetX={100}
  offsetY={100}
  visible={true}>
  <View style={{ flex: 1 }}>
    {// Add any children here}
  </View>
</SpotLight>

Or

<SpotLightFromRef
  viewRef={someViewReference}
  visible={true}>
  <View style={{ flex: 1 }}>
    {// Add any children here}
  </View>
</SpotLightFromRef>

###Supported Props:

####For SpotLight

NameTypeDescription
durationnumber(optional)animation duration to show or hide in ms
visiblebooleanView visibility indicator
opacitynumber(optional) value between 0 to 1 for background opacity
diameternumberdiameter of spotlight view
offsetXnumberoffset from center of screen
offsetYnumberoffset from center of screen
circleImagenumber{ uri: string }image for circle
renderCirclefunction(style)(optional)function to render inner circle of spotlight
onRequestClosefunction()(optional)called when hardware back button is pressed on android

####For SpotLightFromRef

NameTypeDescription
durationnumber(optional)animation duration to show or hide in ms
visiblebooleanView visibility indicator
diameterOffsetnumber(optional)increase or decrease calculated diameter by this value
viewRefReact viewreact view reference to calculate offset
circleImagenumber{ uri: string }image for circle
opacitynumber(optional) value between 0 to 1 for background opacity
renderCirclefunction(style)(optional)function to render inner circle of spotlight
onRequestClosefunction()(optional)called when hardware back button is pressed on android

TroubleShooting

  1. If on android using SpotLightFromRef, the spotlight is not showing then please ensure that on the reference view collapsible property is false
    i.e. collapsable={false}