0.1.6 • Published 1 year ago

@ray-js/gesture v0.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

English | 简体中文

@ray-js/gesture

latest download

Tuya Ray 手势库

Installation

$ npm install @ray-js/gesture
# or
$ yarn add @ray-js/gesture

Usage

Class Component

import React from 'react';
import { View, Text } from '@ray-js/components';
import Gesture from '@ray-js/gesture';

export default () => (
  <Gesture
    onTap={event => {
      console.log('onTap', event);
    }}
  >
    <View />
  </Gesture>
);

useGesture

import React from 'react';
import { View, Text } from '@ray-js/components';
import { useGesture } from '@ray-js/gesture';

export default () => {
  const gesture = useGesture({
    onTap: event => {
      console.log('onTap', event);
    },
  });
  <View {...gesture} />;
};

useRect

import React from 'react';
import { View, Text } from '@ray-js/components';
import useRect from '@ray-js/gesture';

export default props => {
  const [id, ref, rect] = useRect();
  console.log(rect.width, rect.height); // 150 150
  return <View ref={ref} id={id} style={{ width: '150px', height: '150px' }} />;
};

References

0.1.6-beta-1

1 year ago

0.1.6

1 year ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2-beta-1

3 years ago

0.1.2

3 years ago

0.1.0-beta-1

3 years ago

0.1.0

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago