Skip to content

Commit

Permalink
[IS-2151] Fixed FAB position issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aliabbasmalik8 committed Apr 13, 2021
1 parent 08a55ab commit 9b673df
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/components/FAB.js → src/components/FAB/FAB.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import React, {PureComponent} from 'react';
import {Pressable, Animated, Easing} from 'react-native';
import PropTypes from 'prop-types';
import Icon from './Icon';
import {Plus} from './Icon/Expensicons';
import styles, {getAnimatedFABStyle} from '../styles/styles';
import themeColors from '../styles/themes/default';
import {
Pressable, Animated, Easing,
} from 'react-native';
import Icon from '../Icon';
import {Plus} from '../Icon/Expensicons';
import styles, {getAnimatedFABStyle} from '../../styles/styles';
import themeColors from '../../styles/themes/default';
import fabPropTypes from './fabPropTypes';

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

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

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

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

class FAB extends PureComponent {
constructor(props) {
super(props);
Expand Down Expand Up @@ -77,5 +71,5 @@ class FAB extends PureComponent {
}
}

FAB.propTypes = propTypes;
FAB.propTypes = fabPropTypes;
export default FAB;
11 changes: 11 additions & 0 deletions src/components/FAB/fabPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PropTypes from 'prop-types';

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

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

export default FabPropTypes;
18 changes: 18 additions & 0 deletions src/components/FAB/index.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import {
KeyboardAvoidingView,
} from 'react-native';

import FAB from './FAB';
import fabPropTypes from './fabPropTypes';

function Fab({onPress, isActive}) {
return (
<KeyboardAvoidingView behavior="position">
<FAB onPress={onPress} isActive={isActive} />
</KeyboardAvoidingView>
);
}

Fab.propTypes = fabPropTypes;
export default Fab;
11 changes: 11 additions & 0 deletions src/components/FAB/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import FAB from './FAB';
import fabPropTypes from './fabPropTypes';

function Fab({onPress, isActive}) {
return <FAB onPress={onPress} isActive={isActive} />;
}

Fab.propTypes = fabPropTypes;
export default Fab;

0 comments on commit 9b673df

Please sign in to comment.