Skip to content

Commit

Permalink
Merge pull request #291 from code4romania/fix/reduced-animation
Browse files Browse the repository at this point in the history
fix: reduced animation support
  • Loading branch information
birloiflorian authored Jul 12, 2024
2 parents d4ff49b + b9dc3e5 commit 8597ea0
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const expoConfig: ExpoConfig = {
name: 'vic',
slug: 'vic',
scheme: 'vic',
version: '1.0.7',
version: '1.0.8',
orientation: 'portrait',
icon: './src/assets/images/icon.png',
userInterfaceStyle: 'light',
Expand All @@ -18,7 +18,7 @@ const expoConfig: ExpoConfig = {
},
assetBundlePatterns: ['**/*'],
ios: {
buildNumber: '10',
buildNumber: '11',
supportsTablet: false,
bundleIdentifier: 'org.commitglobal.vic',
entitlements: {
Expand All @@ -32,7 +32,7 @@ const expoConfig: ExpoConfig = {
},
},
android: {
versionCode: 8,
versionCode: 9,
adaptiveIcon: {
foregroundImage: './src/assets/images/adaptive-icon.png',
backgroundColor: '#ffffff',
Expand Down
4 changes: 2 additions & 2 deletions mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vic-mobile",
"version": "1.0.0",
"version": "1.0.1",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "NODE_ENV=development expo start",
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/screens/Contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import BottomSheet from '@gorhom/bottom-sheet';
import { renderBackdrop } from '../components/BottomSheet';
import Button from '../components/Button';
import InlineLink from '../components/InlineLink';
import { useReducedMotion } from 'react-native-reanimated';

const Contract = ({ navigation, route }: any) => {
const { t } = useTranslation('documents');
Expand All @@ -46,6 +47,8 @@ const Contract = ({ navigation, route }: any) => {
error: getContractError,
} = useContractQuery(id);

const reducedMotion = useReducedMotion();

// bottom sheet ref
const bottomSheetRef = useRef<BottomSheet>(null);
// bottom sheet snap points
Expand Down Expand Up @@ -240,6 +243,7 @@ const Contract = ({ navigation, route }: any) => {
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
animateOnMount={reducedMotion ? false : true}
>
<View style={styles.bottomSheetContainer}>
<View style={styles.textContainer}>
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/screens/JoinByAccessCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { SvgXml } from 'react-native-svg';
import successIcon from '../assets/svg/success-icon';
import Button from '../components/Button';
import InlineLink from '../components/InlineLink';
import { useReducedMotion } from 'react-native-reanimated';

type AccessCodeFormTypes = {
code: string;
Expand Down Expand Up @@ -59,6 +60,8 @@ const JoinByAccessCode = ({ navigation }: any) => {
// bottom sheet snap points
const snapPoints = useMemo(() => [1, 410], []);

const reducedMotion = useReducedMotion();

const {
control,
handleSubmit,
Expand Down Expand Up @@ -143,6 +146,7 @@ const JoinByAccessCode = ({ navigation }: any) => {
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
animateOnMount={reducedMotion ? false : true}
>
<View style={styles.container}>
<SvgXml xml={successIcon} height={100} width={100} />
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/screens/JoinOrganization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Button from '../components/Button';
import InlineLink from '../components/InlineLink';
import { SvgXml } from 'react-native-svg';
import { ALLOW_FONT_SCALLING } from '../common/constants/constants';
import { useReducedMotion } from 'react-native-reanimated';

export type JoinNgoFormTypes = {
referral: REFERRAL;
Expand Down Expand Up @@ -53,6 +54,8 @@ const JoinOrganization = ({ navigation, route }: any) => {
const { isLoading: isCreatingAccessRequest, mutate: createAccessRequest } =
useCreateAccessrequestMutation();

const reducedMotion = useReducedMotion();

const {
control,
handleSubmit,
Expand Down Expand Up @@ -143,6 +146,7 @@ const JoinOrganization = ({ navigation, route }: any) => {
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
animateOnMount={reducedMotion ? false : true}
>
<View style={styles.bottomSheetContainer}>
<SvgXml xml={successIcon} height={100} width={100} />
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/screens/LeaveOrganization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Paragraph from '../components/Paragraph';
import InlineLink from '../components/InlineLink';
import Button from '../components/Button';
import { ALLOW_FONT_SCALLING } from '../common/constants/constants';
import { useReducedMotion } from 'react-native-reanimated';

const LeaveOrganization = ({ navigation }: any) => {
const { t } = useTranslation('leave_ngo');
Expand All @@ -31,6 +32,8 @@ const LeaveOrganization = ({ navigation }: any) => {

const { organization } = useOrganization();

const reducedMotion = useReducedMotion();

const onLeaveOrganizationConfirm = () => {
if (organization) {
leaveOrganization(
Expand Down Expand Up @@ -87,6 +90,7 @@ const LeaveOrganization = ({ navigation }: any) => {
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
animateOnMount={reducedMotion ? false : true}
>
<View style={styles.bottomSheetContainer}>
<View style={styles.textContainer}>
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/screens/NotificationsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { renderBackdrop } from '../components/BottomSheet';
import { useUserProfile } from '../store/profile/profile.selector';
import useStore from '../store/store';
import { ALLOW_FONT_SCALLING } from '../common/constants/constants';
import { useReducedMotion } from 'react-native-reanimated';

interface NotificationSettingProps {
title: string;
Expand Down Expand Up @@ -97,6 +98,8 @@ const NotificationsSettings = ({ navigation }: any) => {
);
const [notificationBy, setNotificationBy] = useState<NotificationBy[]>([]);

const reducedMotion = useReducedMotion();

// mutation
const { mutate: updateNotificationsSettings } = useUpdateSettingsMutation();

Expand Down Expand Up @@ -207,6 +210,7 @@ const NotificationsSettings = ({ navigation }: any) => {
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
animateOnMount={reducedMotion ? false : true}
>
<View style={styles.contentContainer}>
{showNotificationFromOptions ? (
Expand Down
4 changes: 4 additions & 0 deletions mobile/src/screens/OrganizationProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Button from '../components/Button';
import InlineLink from '../components/InlineLink';
import { useUserProfile } from '../store/profile/profile.selector';
import { ALLOW_FONT_SCALLING } from '../common/constants/constants';
import { useReducedMotion } from 'react-native-reanimated';

const OrganizationProfile = ({ navigation, route }: any) => {
const { t } = useTranslation('organization_profile');
Expand All @@ -52,6 +53,8 @@ const OrganizationProfile = ({ navigation, route }: any) => {
[organization],
);

const reducedMotion = useReducedMotion();

const { isFetching: isFetchingOrganization, error: getOrganizationError } = useOrganizationQuery(
route.params.organizationId,
);
Expand Down Expand Up @@ -276,6 +279,7 @@ const OrganizationProfile = ({ navigation, route }: any) => {
ref={bottomSheetRef}
index={-1}
snapPoints={snapPoints}
animateOnMount={reducedMotion ? false : true}
>
<View style={styles.bottomSheetContainer}>
{organization?.organizationVolunteerStatus ===
Expand Down

0 comments on commit 8597ea0

Please sign in to comment.