0.0.1-alpha.1 • Published 4 years ago

react-native-drag-to-reveal v0.0.1-alpha.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-native-drag-to-reveal

🚀 Getting Started

Using Yarn:

yarn add react-native-drag-to-reveal

✏️ Example

import React, { useCallback, useState } from 'react';
import { useWindowDimensions } from "react-native-use-dimensions";

import { DragToReveal } from "react-native-drag-to-reveal";

export default function App() {
  const { width, height } = useWindowDimensions();
  const [open, onChange] = useState<boolean>(true);
  return (
    <DragToReveal
      origin={{
        x: -radius,
        y: -radius + height,
      }}
      open={open}
      onChange={onChange}
      radius={100}
      maxRadius={200}
      renderChildren={({ open, progress }) => (
        <>
          {/* revealed content here */}
        </>
      )}
    />
  );
}

🦄 Prop Types

NameTypeDescription
styleViewStyleThe container style of the obscured content.
radiusnumberMinimum visible drag radius.
maxRadiusnumberMaximum radius size.
origin{ x: number, y: number }Placement of the reveal radius w.r.t the container.
renderChildren({ open: boolean, progress: Animated }) => JSX.ElementRender prop. Progress (0 -> 1).
openbooleanContent revealed?
onChange(open: boolean) => unknownContent reveal state changed.
disabledbooleanPrevent the reveal state from changing.

✌️ License

MIT