Skip to content

Commit

Permalink
Merge pull request #47 from SimformSolutionsPvtLtd/develop
Browse files Browse the repository at this point in the history
Release v0.0.4
  • Loading branch information
mukesh-simform committed Jul 11, 2023
2 parents c6cc4fb + ba2bace commit fe6c050
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# react-native-reactions

[![npm version](https://img.shields.io/badge/npm%20package-0.0.3-orange)](https://www.npmjs.org/package/react-native-country-code-select) [![Android](https://img.shields.io/badge/Platform-Android-green?logo=android)](https://www.android.com) [![iOS](https://img.shields.io/badge/Platform-iOS-green?logo=apple)](https://developer.apple.com/ios) [![MIT](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)
[![react-native-reactions on npm](https://badgen.net/npm/v/react-native-reactions)](https://www.npmjs.com/package/react-native-reactions) [![react-native-reactions downloads](https://badgen.net/npm/dm/react-native-reactions)](https://www.npmtrends.com/react-native-reactions) [![react-native-reactions install size](https://packagephobia.com/badge?p=react-native-reactions)](https://packagephobia.com/result?p=react-native-reactions) [![Android](https://img.shields.io/badge/Platform-Android-green?logo=android)](https://www.android.com) [![iOS](https://img.shields.io/badge/Platform-iOS-green?logo=apple)](https://developer.apple.com/ios) [![MIT](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT)

---

Expand Down
23 changes: 21 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-reactions",
"version": "0.0.3",
"version": "0.0.4",
"description": "A React Native component to provide animated reaction picker",
"main": "lib/index",
"types": "lib/index.d.ts",
Expand All @@ -16,7 +16,26 @@
"typescript",
"reactions",
"animated-reactions",
"rn"
"rn",
"react-native-reactions",
"reanimated",
"component",
"react-component",
"ios",
"android",
"react-native-reaction",
"seamless-reactions",
"seamless",
"seamless-gesture-reaction",
"emoji-reactions",
"reactions-picker",
"reactions-component",
"animated-reactions-picker",
"picker",
"reaction",
"animation",
"react-reaction",
"react-native-fb-reactions-animation"
],
"license": "MIT",
"files": [
Expand Down
10 changes: 4 additions & 6 deletions src/components/ReactionView/ReactionView.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect, useRef, useState } from 'react';
import {
LayoutRectangle,
Pressable,
SafeAreaView,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
import EmojiView from '../EmojiView';
Expand Down Expand Up @@ -49,7 +49,6 @@ const ReactionView = (props: ReactionViewProps) => {
showCardInCenter,
panResponder,
position,
mainViewWidth,
} = useReaction(props);

const onPressHandler = () => {
Expand Down Expand Up @@ -77,7 +76,7 @@ const ReactionView = (props: ReactionViewProps) => {
const hoverIndex: number = showTopEmojiCard ? -itemIndex : 1;
const checkTouchRelease =
position &&
position > emojiViewCoordinates.x + mainViewWidth &&
position > emojiViewCoordinates.x &&
position <= emojiViewCoordinates.width + emojiViewCoordinates.x;
const onStartShouldSetResponder = () => {
setShowPopUpCard(!showPopUpCard);
Expand Down Expand Up @@ -131,11 +130,10 @@ const ReactionView = (props: ReactionViewProps) => {
}}
{...panResponder.panHandlers}>
{React.isValidElement(children) && (
<TouchableOpacity
<Pressable
{...touchableProps}
hitSlop={{ top: 20, left: 20, right: 20, bottom: 20 }}
disabled={disabled}
activeOpacity={1}
onLongPress={() => {
isLongPress ? onPressHandler() : !isSinglePress && onPress();
onLongPress();
Expand All @@ -145,7 +143,7 @@ const ReactionView = (props: ReactionViewProps) => {
onPress();
}}>
{children}
</TouchableOpacity>
</Pressable>
)}
</View>
</SafeAreaView>
Expand Down
7 changes: 3 additions & 4 deletions src/components/ReactionView/ReactionViewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {
useRef,
useState,
} from 'react';
import { LayoutRectangle, TouchableOpacity, View } from 'react-native';
import { LayoutRectangle, Pressable, View } from 'react-native';
import { reactionModalRef } from '../ReactionModal';
import { useReaction } from './hooks';
import type { GetCoordinateRef, ReactionViewProps } from './types';
Expand Down Expand Up @@ -95,11 +95,10 @@ const ReactionViewModal = ({ touchableProps, ...props }: ReactionViewProps) => {
}}
{...panResponder.panHandlers}>
{React.isValidElement(children) && (
<TouchableOpacity
<Pressable
{...touchableProps}
hitSlop={{ top: 20, left: 20, right: 20, bottom: 20 }}
disabled={disabled}
activeOpacity={1}
onLongPress={() => {
isLongPress ? onPressHandler() : !isSinglePress && onPress();
onLongPress();
Expand All @@ -109,7 +108,7 @@ const ReactionViewModal = ({ touchableProps, ...props }: ReactionViewProps) => {
onPress();
}}>
{children}
</TouchableOpacity>
</Pressable>
)}
</View>
);
Expand Down
9 changes: 8 additions & 1 deletion src/components/ReactionView/hooks/useReaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@ const useReaction = (props: ReactionViewProps) => {
const isLongPress = showPopupType === GlobalConstants.default;
const panResponder = useRef(
PanResponder.create({
onMoveShouldSetPanResponder: () => true,
onStartShouldSetPanResponder: () => true,
onPanResponderGrant: () => {},
onPanResponderMove: event => onGesture(event),
onPanResponderEnd: () => {
setPosition(0);
},
onMoveShouldSetPanResponder: (_, gestureState) => {
const { dx, dy } = gestureState;
return dx > 2 || dx < -2 || dy > 2 || dy < -2;
},
onMoveShouldSetPanResponderCapture: (_, gestureState) => {
const { dx, dy } = gestureState;
return dx > 2 || dx < -2 || dy > 2 || dy < -2;
},
})
).current;

Expand Down
4 changes: 2 additions & 2 deletions src/components/ReactionView/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
LayoutRectangle,
PressableProps,
StyleProp,
TouchableOpacityProps,
ViewStyle,
} from 'react-native';
import type { emojiProps } from '../EmojiItem/types';
Expand All @@ -13,7 +13,7 @@ export interface ReactionViewProps extends emojiProps, EmojiAnimationProps {
items?: EmojiItemProp[];
onTap?: (e: EmojiItemProp | undefined) => void;
cardStyle?: StyleProp<ViewStyle>;
touchableProps?: TouchableOpacityProps;
touchableProps?: PressableProps;
itemIndex?: number;
onShowDismissCard?: (onShowDismissCardType?: boolean) => void;
isShowCardInCenter?: boolean;
Expand Down

0 comments on commit fe6c050

Please sign in to comment.