Skip to content

Commit

Permalink
fix yarn lock file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Hamilton committed Mar 14, 2021
2 parents df96b21 + c049e00 commit d3341cc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
33 changes: 17 additions & 16 deletions src/buttons/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useCallback, useEffect } from 'react';
import {
View,
Text,
Expand Down Expand Up @@ -54,26 +54,18 @@ export type ButtonProps = TouchableOpacityProps &
};

const Button: React.FunctionComponent<ButtonProps> = (props: ButtonProps) => {
if (props.linearGradientProps && !props.ViewComponent) {
console.error(
"You need to pass a ViewComponent to use linearGradientProps !\nExample: ViewComponent={require('react-native-linear-gradient')}"
);
}

const handleOnPress = (evt) => {
const {
loading,
onPress = () => console.log('Please attach a method to this component'),
} = props;
if (!loading) {
onPress(evt);
useEffect(() => {
if (props.linearGradientProps && !props.ViewComponent) {
console.error(
"You need to pass a ViewComponent to use linearGradientProps !\nExample: ViewComponent={require('react-native-linear-gradient')}"
);
}
};
});

const {
TouchableComponent,
containerStyle,
onPress,
onPress = () => console.log('Please attach a method to this component'),
buttonStyle,
type = 'solid',
loading = false,
Expand All @@ -95,6 +87,15 @@ const Button: React.FunctionComponent<ButtonProps> = (props: ButtonProps) => {
...attributes
} = props;

const handleOnPress = useCallback(
(evt) => {
if (!loading) {
onPress(evt);
}
},
[loading, onPress]
);

// Refactor to Pressable
const TouchableComponentInternal =
TouchableComponent ||
Expand Down
14 changes: 10 additions & 4 deletions src/social/SocialIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ const SocialIcon: React.FunctionComponent<SocialIconProps> = (props) => {
...attributes
} = props;

const shouldShowExpandedButton = button && title;

return (
<Component
{...attributes}
Expand All @@ -159,14 +161,18 @@ const SocialIcon: React.FunctionComponent<SocialIconProps> = (props) => {
])}
>
<View style={styles.wrapper}>
<Icon
{
(shouldShowExpandedButton || !loading) &&
<Icon
//@ts-ignore
iconStyle={StyleSheet.flatten([iconStyle && iconStyle])}
color={light ? colors[type] : iconColor}
name={type}
size={iconSize}
type={iconType}
/>
{button && title && (
/>
}
{shouldShowExpandedButton && (
<Text
//@ts-ignore
style={StyleSheet.flatten([
Expand All @@ -188,7 +194,7 @@ const SocialIcon: React.FunctionComponent<SocialIconProps> = (props) => {
styles.activityIndicatorStyle,
activityIndicatorStyle,
])}
color={light ? iconColor : 'white'}
color={light ? colors[type] : iconColor}
size={(small && 'small') || 'large'}
/>
)}
Expand Down

0 comments on commit d3341cc

Please sign in to comment.