Skip to content

Commit

Permalink
Merge pull request #33329 from Expensify/jasperhuangg-cherry-pick-sta…
Browse files Browse the repository at this point in the history
…ging-33325-1

🍒 Cherry pick PR #33325 to staging 🍒
  • Loading branch information
jasperhuangg authored Dec 20, 2023
2 parents 9ea140d + c47870c commit 18165f3
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 206 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001041401
versionName "1.4.14-1"
versionCode 1001041402
versionName "1.4.14-2"
}

flavorDimensions "default"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.14.1</string>
<string>1.4.14.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.14.1</string>
<string>1.4.14.2</string>
</dict>
</plist>
31 changes: 28 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,35 @@ PODS:
- React-Core
- RNReactNativeHapticFeedback (1.14.0):
- React-Core
- RNReanimated (3.6.1):
- RCT-Folly (= 2021.07.22.00)
- RNReanimated (3.5.4):
- DoubleConversion
- FBLazyVector
- glog
- hermes-engine
- RCT-Folly
- RCTRequired
- RCTTypeSafety
- React-callinvoker
- React-Core
- React-Core/DevSupport
- React-Core/RCTWebSocket
- React-CoreModules
- React-cxxreact
- React-hermes
- React-jsi
- React-jsiexecutor
- React-jsinspector
- React-RCTActionSheet
- React-RCTAnimation
- React-RCTAppDelegate
- React-RCTBlob
- React-RCTImage
- React-RCTLinking
- React-RCTNetwork
- React-RCTSettings
- React-RCTText
- ReactCommon/turbomodule/core
- Yoga
- RNScreens (3.21.0):
- React-Core
- React-RCTImage
Expand Down Expand Up @@ -1255,7 +1280,7 @@ SPEC CHECKSUMS:
rnmapbox-maps: 6f638ec002aa6e906a6f766d69cd45f968d98e64
RNPermissions: 9b086c8f05b2e2faa587fdc31f4c5ab4509728aa
RNReactNativeHapticFeedback: 1e3efeca9628ff9876ee7cdd9edec1b336913f8c
RNReanimated: fdbaa9c964bbab7fac50c90862b6cc5f041679b9
RNReanimated: ab2e96c6d5591c3dfbb38a464f54c8d17fb34a87
RNScreens: d037903436160a4b039d32606668350d2a808806
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.14-1",
"version": "1.4.14-2",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down Expand Up @@ -148,7 +148,7 @@
"react-native-plaid-link-sdk": "10.8.0",
"react-native-qrcode-svg": "^6.2.0",
"react-native-quick-sqlite": "^8.0.0-beta.2",
"react-native-reanimated": "^3.6.1",
"react-native-reanimated": "3.5.4",
"react-native-render-html": "6.3.1",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "3.21.0",
Expand Down
132 changes: 132 additions & 0 deletions src/components/FloatingActionButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import {Animated, Easing, View} from 'react-native';
import compose from '@libs/compose';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PressableWithFeedback from './Pressable/PressableWithFeedback';
import Tooltip from './Tooltip/PopoverAnchorTooltip';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import withStyleUtils, {withStyleUtilsPropTypes} from './withStyleUtils';
import withTheme, {withThemePropTypes} from './withTheme';
import withThemeStyles, {withThemeStylesPropTypes} from './withThemeStyles';

const AnimatedIcon = Animated.createAnimatedComponent(Icon);
AnimatedIcon.displayName = 'AnimatedIcon';

const AnimatedPressable = Animated.createAnimatedComponent(PressableWithFeedback);
AnimatedPressable.displayName = 'AnimatedPressable';

const propTypes = {
// Callback to fire on request to toggle the FloatingActionButton
onPress: PropTypes.func.isRequired,

// Current state (active or not active) of the component
isActive: PropTypes.bool.isRequired,

// Ref for the button
buttonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),

...withLocalizePropTypes,
...withThemePropTypes,
...withThemeStylesPropTypes,
...withStyleUtilsPropTypes,
};

const defaultProps = {
buttonRef: () => {},
};

class FloatingActionButton extends PureComponent {
constructor(props) {
super(props);
this.animatedValue = new Animated.Value(props.isActive ? 1 : 0);
}

componentDidUpdate(prevProps) {
if (prevProps.isActive === this.props.isActive) {
return;
}

this.animateFloatingActionButton();
}

/**
* Animates the floating action button
* Method is called when the isActive prop changes
*/
animateFloatingActionButton() {
const animationFinalValue = this.props.isActive ? 1 : 0;

Animated.timing(this.animatedValue, {
toValue: animationFinalValue,
duration: 340,
easing: Easing.inOut(Easing.ease),
useNativeDriver: false,
}).start();
}

render() {
const rotate = this.animatedValue.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '135deg'],
});

const backgroundColor = this.animatedValue.interpolate({
inputRange: [0, 1],
outputRange: [this.props.theme.success, this.props.theme.buttonDefaultBG],
});

const fill = this.animatedValue.interpolate({
inputRange: [0, 1],
outputRange: [this.props.theme.textLight, this.props.theme.textDark],
});

return (
<Tooltip text={this.props.translate('common.new')}>
<View style={this.props.themeStyles.floatingActionButtonContainer}>
<AnimatedPressable
ref={(el) => {
this.fabPressable = el;
if (this.props.buttonRef) {
this.props.buttonRef.current = el;
}
}}
accessibilityLabel={this.props.accessibilityLabel}
role={this.props.role}
pressDimmingValue={1}
onPress={(e) => {
// Drop focus to avoid blue focus ring.
this.fabPressable.blur();
this.props.onPress(e);
}}
onLongPress={() => {}}
style={[this.props.themeStyles.floatingActionButton, this.props.StyleUtils.getAnimatedFABStyle(rotate, backgroundColor)]}
>
<AnimatedIcon
src={Expensicons.Plus}
fill={fill}
/>
</AnimatedPressable>
</View>
</Tooltip>
);
}
}

FloatingActionButton.propTypes = propTypes;
FloatingActionButton.defaultProps = defaultProps;

const FloatingActionButtonWithLocalize = withLocalize(FloatingActionButton);

const FloatingActionButtonWithLocalizeWithRef = React.forwardRef((props, ref) => (
<FloatingActionButtonWithLocalize
// eslint-disable-next-line
{...props}
buttonRef={ref}
/>
));

FloatingActionButtonWithLocalizeWithRef.displayName = 'FloatingActionButtonWithLocalizeWithRef';

export default compose(withThemeStyles, withTheme, withStyleUtils)(FloatingActionButtonWithLocalizeWithRef);
49 changes: 0 additions & 49 deletions src/components/FloatingActionButton/FabPlusIcon.js

This file was deleted.

Loading

0 comments on commit 18165f3

Please sign in to comment.