Skip to content

Commit

Permalink
Merge branch 'main' into Sebryu-DynamicChecklistPOC
Browse files Browse the repository at this point in the history
  • Loading branch information
sebryu committed Nov 9, 2023
2 parents 93efdf0 + 9862a3e commit b9e9a8c
Show file tree
Hide file tree
Showing 48 changed files with 187 additions and 69 deletions.
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 0 additions & 1 deletion assets/animations/ExpensifyLounge.json

This file was deleted.

Binary file added assets/animations/ExpensifyLounge.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/FastMoney.json

This file was deleted.

Binary file added assets/animations/FastMoney.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/Fireworks.json

This file was deleted.

Binary file added assets/animations/Fireworks.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/Hands.json

This file was deleted.

Binary file added assets/animations/Hands.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/Magician.json

This file was deleted.

Binary file added assets/animations/Magician.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/PreferencesDJ.json

This file was deleted.

Binary file added assets/animations/PreferencesDJ.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/ReviewingBankInfo.json

This file was deleted.

Binary file added assets/animations/ReviewingBankInfo.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/Safe.json

This file was deleted.

Binary file added assets/animations/Safe.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/SaveTheWorld.json

This file was deleted.

Binary file added assets/animations/SaveTheWorld.lottie
Binary file not shown.
1 change: 0 additions & 1 deletion assets/animations/WorkspacePlanet.json

This file was deleted.

Binary file added assets/animations/WorkspacePlanet.lottie
Binary file not shown.
4 changes: 4 additions & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
resourceQuery: /raw/,
type: 'asset/source',
},
{
test: /\.lottie$/,
type: 'asset/resource',
},
],
},
resolve: {
Expand Down
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ module.exports = {
setupFiles: ['<rootDir>/jest/setup.js', './node_modules/@react-native-google-signin/google-signin/jest/build/setup.js'],
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect', '<rootDir>/jest/setupAfterEnv.js'],
cacheDirectory: '<rootDir>/.jest-cache',
moduleNameMapper: {
'\\.(lottie)$': '<rootDir>/__mocks__/fileMock.js',
},
};
2 changes: 1 addition & 1 deletion metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const e2eSourceExts = ['e2e.js', 'e2e.ts'];
*/
const config = {
resolver: {
assetExts: _.filter(defaultAssetExts, (ext) => ext !== 'svg'),
assetExts: [..._.filter(defaultAssetExts, (ext) => ext !== 'svg'), 'lottie'],
// When we run the e2e tests we want files that have the extension e2e.js to be resolved as source files
sourceExts: [...(isE2ETesting ? e2eSourceExts : []), ...defaultSourceExts, 'jsx', 'svg'],
resolveRequest: (context, moduleName, platform) => {
Expand Down
13 changes: 10 additions & 3 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"@invertase/react-native-apple-authentication": "^2.2.2",
"@kie/act-js": "^2.0.1",
"@kie/mock-github": "^1.0.0",
"@lottiefiles/react-lottie-player": "^3.5.3",
"@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52",
"@onfido/react-native-sdk": "8.3.0",
"@react-native-async-storage/async-storage": "^1.17.10",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfirmationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from '@styles/styles';
import Button from './Button';
import FixedFooter from './FixedFooter';
import Lottie from './Lottie';
import * as LottieAnimations from './LottieAnimations';
import LottieAnimations from './LottieAnimations';
import Text from './Text';

const propTypes = {
Expand Down
45 changes: 31 additions & 14 deletions src/components/Lottie/Lottie.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
import LottieView, {LottieViewProps} from 'lottie-react-native';
import React, {forwardRef} from 'react';
import React, {ForwardedRef, forwardRef} from 'react';
import {View} from 'react-native';
import DotLottieAnimation from '@components/LottieAnimations/types';
import useNetwork from '@hooks/useNetwork';
import styles from '@styles/styles';

const Lottie = forwardRef<LottieView, LottieViewProps>((props: LottieViewProps, ref) => {
const aspectRatioStyle = styles.aspectRatioLottie(props.source);
type Props = {
source: DotLottieAnimation;
} & Omit<LottieViewProps, 'source'>;

function Lottie({source, webStyle, ...props}: Props, ref: ForwardedRef<LottieView>) {
const [isError, setIsError] = React.useState(false);

useNetwork({onReconnect: () => setIsError(false)});

const aspectRatioStyle = styles.aspectRatioLottie(source);

// If the image fails to load, we'll just render an empty view
if (isError) {
return <View style={aspectRatioStyle} />;
}

return (
<View style={[aspectRatioStyle, styles.w100]}>
<LottieView
// eslint-disable-next-line
{...props}
ref={ref}
style={[aspectRatioStyle, props.style]}
webStyle={{...aspectRatioStyle, ...props.webStyle}}
/>
</View>
<LottieView
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
source={source.file}
ref={ref}
style={[aspectRatioStyle, props.style]}
webStyle={{...aspectRatioStyle, ...webStyle}}
onAnimationFailure={() => setIsError(true)}
/>
);
});
}

Lottie.displayName = 'Lottie';

export default Lottie;
export default forwardRef(Lottie);
12 changes: 0 additions & 12 deletions src/components/LottieAnimations.ts

This file was deleted.

56 changes: 56 additions & 0 deletions src/components/LottieAnimations/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import DotLottieAnimation from './types';

const DotLottieAnimations: Record<string, DotLottieAnimation> = {
ExpensifyLounge: {
file: require('@assets/animations/ExpensifyLounge.lottie'),
w: 1920,
h: 1080,
},
FastMoney: {
file: require('@assets/animations/FastMoney.lottie'),
w: 375,
h: 240,
},
Fireworks: {
file: require('@assets/animations/Fireworks.lottie'),
w: 360,
h: 360,
},
Hands: {
file: require('@assets/animations/Hands.lottie'),
w: 375,
h: 375,
},
PreferencesDJ: {
file: require('@assets/animations/PreferencesDJ.lottie'),
w: 375,
h: 240,
},
ReviewingBankInfo: {
file: require('@assets/animations/ReviewingBankInfo.lottie'),
w: 280,
h: 280,
},
WorkspacePlanet: {
file: require('@assets/animations/WorkspacePlanet.lottie'),
w: 375,
h: 240,
},
SaveTheWorld: {
file: require('@assets/animations/SaveTheWorld.lottie'),
w: 375,
h: 240,
},
Safe: {
file: require('@assets/animations/Safe.lottie'),
w: 625,
h: 400,
},
Magician: {
file: require('@assets/animations/Magician.lottie'),
w: 853,
h: 480,
},
};

export default DotLottieAnimations;
9 changes: 9 additions & 0 deletions src/components/LottieAnimations/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {LottieViewProps} from 'lottie-react-native';

type DotLottieAnimation = {
file: LottieViewProps['source'];
w: number;
h: number;
};

export default DotLottieAnimation;
17 changes: 10 additions & 7 deletions src/components/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import styles from '@styles/styles';
import themeColors from '@styles/themes/default';
import CONST from '@src/CONST';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
Expand Down Expand Up @@ -39,13 +40,15 @@ function RadioButton(props) {
accessibilityLabel={props.accessibilityLabel}
role={CONST.ACCESSIBILITY_ROLE.RADIO}
>
<View style={[styles.radioButtonContainer, props.isChecked && styles.checkedContainer, props.hasError && styles.borderColorDanger, props.disabled && styles.cursorDisabled]}>
<Icon
src={Expensicons.Checkmark}
fill="white"
height={14}
width={14}
/>
<View style={[styles.radioButtonContainer, props.hasError && styles.borderColorDanger, props.disabled && styles.cursorDisabled]}>
{props.isChecked && (
<Icon
src={Expensicons.Checkmark}
fill={themeColors.checkBox}
height={14}
width={14}
/>
)}
</View>
</PressableWithFeedback>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/RadioButtonWithLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ function RadioButtonWithLabel(props) {
style={[styles.flexRow, styles.flexWrap, styles.flexShrink1, styles.alignItemsCenter]}
wrapperStyle={[styles.ml3, styles.pr2, styles.w100]}
// disable hover style when disabled
hoverDimmingValue={1}
pressDimmingValue={0.2}
hoverDimmingValue={0.8}
pressDimmingValue={0.5}
>
{Boolean(props.label) && <Text style={[styles.ml1]}>{props.label}</Text>}
{Boolean(LabelComponent) && <LabelComponent />}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReimbursementAccountLoadingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FullPageOfflineBlockingView from './BlockingViews/FullPageOfflineBlocking
import FullScreenLoadingIndicator from './FullscreenLoadingIndicator';
import HeaderWithBackButton from './HeaderWithBackButton';
import Lottie from './Lottie';
import * as LottieAnimations from './LottieAnimations';
import LottieAnimations from './LottieAnimations';
import ScreenWrapper from './ScreenWrapper';
import Text from './Text';

Expand Down
2 changes: 1 addition & 1 deletion src/pages/EnablePayments/ActivateStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import ConfirmationPage from '@components/ConfirmationPage';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import compose from '@libs/compose';
import * as PaymentMethods from '@userActions/PaymentMethods';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TeachersUnite/SaveTheWorldPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import MenuItem from '@components/MenuItem';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Preferences/PreferencesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import Switch from '@components/Switch';
import TestToolMenu from '@components/TestToolMenu';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Profile/LoungeAccessPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import Text from '@components/Text';
import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '@components/withCurrentUserPersonalDetails';
import useLocalize from '@hooks/useLocalize';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Security/SecuritySettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import * as Expensicons from '@components/Icon/Expensicons';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import MenuItemList from '@components/MenuItemList';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ConfirmationPage from '@components/ConfirmationPage';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import useLocalize from '@hooks/useLocalize';
import StepWrapper from '@pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper';
import useTwoFactorAuthContext from '@pages/settings/Security/TwoFactorAuth/TwoFactorAuthContext/useTwoFactorAuth';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/ActivatePhysicalCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import _ from 'underscore';
import BigNumberPad from '@components/BigNumberPad';
import Button from '@components/Button';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import MagicCodeInput from '@components/MagicCodeInput';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/WalletEmptyState.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from '@components/Button';
import FeatureList from '@components/FeatureList';
import * as Illustrations from '@components/Icon/Illustrations';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
import themeColors from '@styles/themes/default';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/SignInHeroImage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Lottie from '@components/Lottie';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import styles from '@styles/styles';
import variables from '@styles/variables';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspacesListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FeatureList from '@components/FeatureList';
import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import IllustratedHeaderPageLayout from '@components/IllustratedHeaderPageLayout';
import * as LottieAnimations from '@components/LottieAnimations';
import LottieAnimations from '@components/LottieAnimations';
import MenuItem from '@components/MenuItem';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import useLocalize from '@hooks/useLocalize';
Expand Down
Loading

0 comments on commit b9e9a8c

Please sign in to comment.