Skip to content

Commit

Permalink
Merge pull request #314 from Real-Dev-Squad/staging
Browse files Browse the repository at this point in the history
to create changing in staging PR
  • Loading branch information
shreya-mishra authored Oct 25, 2023
2 parents bd4ef5d + 9185355 commit c5a92fb
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 24 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GEM
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.8.11)
i18n (1.9.1)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
Expand All @@ -85,7 +85,7 @@ GEM
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.3)
zeitwerk (2.5.4)

PLATFORMS
ruby
Expand Down
8 changes: 8 additions & 0 deletions __mocks__/react-native-encrypted-storage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const RNEncryptedStorage = {
setItem: jest.fn(() => Promise.resolve()),
getItem: jest.fn(() => Promise.resolve('{ "foo": 1 }')),
removeItem: jest.fn(() => Promise.resolve()),
clear: jest.fn(() => Promise.resolve()),
};

export default RNEncryptedStorage;
5 changes: 5 additions & 0 deletions jest-setup.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
import { jest } from '@jest/globals';
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';

require('react-native-reanimated/lib/reanimated2/jestUtils').setUpTests();
jest.mock('react-native-device-info', () => mockRNDeviceInfo);
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter');
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"test": "jest --runInBand --detectOpenHandles --forceExit",
"lint": "eslint . --fix --ext .js,.jsx,.ts,.tsx",
"format-check": "prettier --check ./src",
"format-fix": "prettier --write ./src",
Expand All @@ -26,7 +26,7 @@
"axios": "^0.26.0",
"eslint-plugin-prettier": "^4.1.0",
"react": "17.0.2",
"react-native": "0.67.0",
"react-native": "0.67.2",
"react-native-app-auth": "^6.4.2",
"react-native-asset": "^2.1.1",
"react-native-camera-kit": "^13.0.0",
Expand All @@ -48,8 +48,8 @@
"react-native-screens": "^3.9.0",
"react-native-tab-view": "^3.5.2",
"react-native-toast-message": "^2.1.5",
"react-native-webview": "^13.3.1",
"react-native-walkthrough-tooltip": "^1.5.0",
"react-native-webview": "^13.3.1",
"react-redux": "^8.1.1",
"redux": "^4.2.1",
"redux-saga": "^1.2.3"
Expand All @@ -60,7 +60,7 @@
"@react-native-community/eslint-config": "^2.0.0",
"@rnx-kit/align-deps": "^2.2.2",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-native": "^12.1.2",
"@testing-library/react-native": "^12.3.0",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.66.4",
"@types/react-native-datepicker": "^1.7.1",
Expand Down
41 changes: 34 additions & 7 deletions src/components/ToDoComponent/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Image, Text, View, TouchableOpacity } from 'react-native';
import { Image, Text, View, TouchableOpacity, Dimensions } from 'react-native';
import React, { useState, useEffect, memo } from 'react';
import Animated, {
Easing,
interpolate,
runOnJS,
useAnimatedGestureHandler,
useAnimatedStyle,
Expand Down Expand Up @@ -49,6 +50,11 @@ const Card = ({
timerRef = setTimeout(() => deleteCardFunction(), 4000);
};

const { width: SCREEN_WIDTH } = Dimensions.get('screen');
const SCREEN_WIDTH_30 = SCREEN_WIDTH / 3;
const ROTATION_DEG = 60;
const CARD_MOVEMENT_THRESHOLD = SCREEN_WIDTH / 2;

useEffect(() => {
// Clear the interval when the component unmounts
return () => clearTimeout(timerRef);
Expand All @@ -62,28 +68,42 @@ const Card = ({

const panGesture = useAnimatedGestureHandler({
onActive: (event) => {
if (translateY.value < 150) {
if (translateY.value < CARD_MOVEMENT_THRESHOLD) {
translateY.value = event.translationY;
}
if (translateX.value < 150) {
if (translateX.value < CARD_MOVEMENT_THRESHOLD) {
translateX.value = event.translationX;
}
if (translateY.value < -150) {
if (translateY.value < -CARD_MOVEMENT_THRESHOLD) {
translateY.value = event.translationY;
}
if (translateX.value < -150) {
if (translateX.value < -CARD_MOVEMENT_THRESHOLD) {
translateX.value = event.translationX;
}
},
onEnd: () => {
translateY.value = withTiming(0, { easing: Easing.linear });
translateX.value = withTiming(0, { easing: Easing.linear });

if (translateY.value > 100) {
if (
translateX.value > SCREEN_WIDTH_30 ||
translateX.value < -SCREEN_WIDTH_30
) {
translateX.value = withTiming(
translateX.value > 0 ? SCREEN_WIDTH : -SCREEN_WIDTH,
{ easing: Easing.linear },
(finished) => {
if (finished) {
return runOnJS(removeCard)(item.id);
}
},
);
}

if (translateY.value < -100 || translateY.value > 100) {
// item.id required but after removing this the function is not getting called
return runOnJS(changecard)(item.id);
}
runOnJS(changecard)(item.id);
},
});

Expand All @@ -95,6 +115,13 @@ const Card = ({
{
translateX: translateX.value,
},
{
rotate: `${interpolate(
translateX.value,
[-SCREEN_WIDTH, 0, SCREEN_WIDTH],
[-ROTATION_DEG, 0, ROTATION_DEG],
)} deg`,
},
],
}));

Expand Down
2 changes: 1 addition & 1 deletion src/screens/ProfileScreen/ProfileScreen2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const styles = StyleSheet.create({
color: 'black', // Change the text color as needed
},
activeTabName: {
fontWeight: 'bold', // Add styles for the active tab
fontWeight: 'bold',
},
});
export default ProfileScreen2;
68 changes: 58 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,13 @@
dependencies:
"@sinclair/typebox" "^0.27.8"

"@jest/schemas@^29.6.3":
version "29.6.3"
resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03"
integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==
dependencies:
"@sinclair/typebox" "^0.27.8"

"@jest/source-map@^26.6.2":
version "26.6.2"
resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535"
Expand Down Expand Up @@ -1482,12 +1489,14 @@
pretty-format "^29.0.1"
redent "^3.0.0"

"@testing-library/react-native@^12.1.2":
version "12.2.0"
resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-12.2.0.tgz#72d4feed1c21c9c089f6184a1564fb46c22bb9b1"
integrity sha512-0r9xCPfy8+IiB8en5viKjiOx0aVUoCOZDUH8lET0R8SEb4/R2sdCTO4UIZjpm9OIA+j5MKt6YSfc4yjF72hE8g==
"@testing-library/react-native@^12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@testing-library/react-native/-/react-native-12.3.0.tgz#ebf04dddb7e1c34c869b97b187ecd061211c9466"
integrity sha512-E2Prl8D/ey9sRgzLyfCPPmqvsevJW5tVUy4E/pBbO7nOP6OzI/jn2P3vctn/kFdkPY2aE/udlU5ZeNAben9U2A==
dependencies:
pretty-format "^29.0.0"
jest-matcher-utils "^29.6.2"
pretty-format "^29.6.2"
redent "^3.0.0"

"@tootallnate/once@1":
version "1.1.2"
Expand Down Expand Up @@ -2926,6 +2935,11 @@ diff-sequences@^29.4.3:
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2"
integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==

diff-sequences@^29.6.3:
version "29.6.3"
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921"
integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==

dir-glob@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
Expand Down Expand Up @@ -4503,6 +4517,16 @@ jest-diff@^29.0.1, jest-diff@^29.6.2:
jest-get-type "^29.4.3"
pretty-format "^29.6.2"

jest-diff@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a"
integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==
dependencies:
chalk "^4.0.0"
diff-sequences "^29.6.3"
jest-get-type "^29.6.3"
pretty-format "^29.7.0"

jest-docblock@^26.0.0:
version "26.0.0"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5"
Expand Down Expand Up @@ -4556,6 +4580,11 @@ jest-get-type@^29.4.3:
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5"
integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==

jest-get-type@^29.6.3:
version "29.6.3"
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1"
integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==

jest-haste-map@^26.5.2, jest-haste-map@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa"
Expand Down Expand Up @@ -4629,6 +4658,16 @@ jest-matcher-utils@^29.0.1:
jest-get-type "^29.4.3"
pretty-format "^29.6.2"

jest-matcher-utils@^29.6.2:
version "29.7.0"
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12"
integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==
dependencies:
chalk "^4.0.0"
jest-diff "^29.7.0"
jest-get-type "^29.6.3"
pretty-format "^29.7.0"

jest-message-util@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07"
Expand Down Expand Up @@ -6063,7 +6102,7 @@ pretty-format@^26.0.0, pretty-format@^26.5.2, pretty-format@^26.6.2:
ansi-styles "^4.0.0"
react-is "^17.0.1"

pretty-format@^29.0.0, pretty-format@^29.0.1, pretty-format@^29.6.2:
pretty-format@^29.0.1, pretty-format@^29.6.2:
version "29.6.2"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.6.2.tgz#3d5829261a8a4d89d8b9769064b29c50ed486a47"
integrity sha512-1q0oC8eRveTg5nnBEWMXAU2qpv65Gnuf2eCQzSjxpWFkPaPARwqZZDGuNE0zPAZfTCHzIk3A8dIjwlQKKLphyg==
Expand All @@ -6072,6 +6111,15 @@ pretty-format@^29.0.0, pretty-format@^29.0.1, pretty-format@^29.6.2:
ansi-styles "^5.0.0"
react-is "^18.0.0"

pretty-format@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==
dependencies:
"@jest/schemas" "^29.6.3"
ansi-styles "^5.0.0"
react-is "^18.0.0"

process-nextick-args@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
Expand Down Expand Up @@ -6373,10 +6421,10 @@ react-native-webview@^13.3.1:
escape-string-regexp "2.0.0"
invariant "2.2.4"

[email protected].0:
version "0.67.0"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.67.0.tgz#401c0ab75566f1086ad194ef9c3e4551c10c14e5"
integrity sha512-LTrLbZhapgsF0J1fgKvkMVealNKVZ+Fp3XWVFHWmglVQvdmALdcafZR2Plvhe9IH8KJddj3LAU9nV3rHot7q4Q==
[email protected].2:
version "0.67.2"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.67.2.tgz#312224bc2271c3cecd374d4bc425619cff4ea5dc"
integrity sha512-grEtpOLLvtSg8Bivg0ffVRCjTkresqMt7Jdog/geF6VAYhb4RnLaaUCWvyrfyB9buf135FKnqg5BIuve/XQNXA==
dependencies:
"@jest/create-cache-key-function" "^27.0.1"
"@react-native-community/cli" "^6.0.0"
Expand Down

0 comments on commit c5a92fb

Please sign in to comment.