Skip to content

Commit

Permalink
Added lazy loading to ProgressButton MaskedView
Browse files Browse the repository at this point in the history
  • Loading branch information
Canciller committed Jul 19, 2022
1 parent ae32f93 commit 8bbd4ad
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 287 deletions.
26 changes: 10 additions & 16 deletions example/src/ActionSheets/ActionsSheets.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ScrollView, Alert, SafeAreaView, Platform } from 'react-native';
import { ScrollView, Alert, SafeAreaView } from 'react-native';

import {
Button,
Expand Down Expand Up @@ -56,11 +56,9 @@ export default function ActionSheets() {
padding: 20,
}}
>
<Button
marginBottom={20}
onPress={() => setVisibleChangePicture(true)}
text="Change your profile picture"
/>
<Button marginBottom={20} onPress={() => setVisibleChangePicture(true)}>
Change your profile picture
</Button>
<ActionSheet
title="Change your profile picture"
message="Select a new profile picture"
Expand All @@ -74,11 +72,9 @@ export default function ActionSheets() {
}}
showCancelIcon
/>
<Button
marginBottom={20}
onPress={() => setVisibleShare(true)}
text="Share document"
/>
<Button marginBottom={20} onPress={() => setVisibleShare(true)}>
Share document
</Button>
<ActionSheet
options={shareDocumentOptions}
visible={visibleShare}
Expand All @@ -90,11 +86,9 @@ export default function ActionSheets() {
}}
showCancelIcon
/>
<Button
marginBottom={20}
onPress={() => setNativeVisible(true)}
text="Share document (Native)"
/>
<Button marginBottom={20} onPress={() => setNativeVisible(true)}>
Share document (Native)
</Button>
<ActionSheet
native
title="Share document"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ export default function () {
padding: 20,
}}
>
<Button
onPress={() => setVisible(true)}
text="Show swipe confirmation"
/>
<Button onPress={() => setVisible(true)}>
Show swipe confirmation
</Button>
<SwipeConfirmation
title="Swipe to confirm"
visible={visible}
Expand Down
2 changes: 1 addition & 1 deletion example/src/BottomSheets/BottomSheets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function BottomSheets() {
padding: 20,
}}
>
<Button onPress={() => setVisible(true)} text="Show Bottom Sheet" />
<Button onPress={() => setVisible(true)}>Show Bottom Sheet</Button>
<BottomSheet
visible={visible}
height={160}
Expand Down
44 changes: 0 additions & 44 deletions example/src/CalendarStrips/CalendarStrips.tsx

This file was deleted.

1 change: 0 additions & 1 deletion example/src/CalendarStrips/index.ts

This file was deleted.

143 changes: 0 additions & 143 deletions example/src/LineValueSelectors/LineValueSelectors.tsx

This file was deleted.

1 change: 0 additions & 1 deletion example/src/LineValueSelectors/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions example/src/screens/CalendarListScreen.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function useStyles({
const borderRadius = variant === 'rounded' ? height / 2 : 12;

let backgroundColor = Color(inverse ? foreground : background).rgb();
let foregroundColor = Color(inverse ? background : foreground).rgb();

const rippleColor = getRippleColor(backgroundColor).string();

Expand All @@ -48,7 +49,9 @@ export default function useStyles({
backgroundColor = backgroundColor.alpha(0);
}

if (transparent) backgroundColor = backgroundColor.alpha(0);
if (transparent) {
backgroundColor = backgroundColor.alpha(0);
}

return StyleSheet.create({
container: {
Expand Down Expand Up @@ -94,7 +97,7 @@ export default function useStyles({
justifyContent: 'center',
},
loading: {
color: inverse ? background : foreground,
color: foregroundColor.string(),
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ function IconButton({
iconStyle,
variant = 'rounded',
inverse,
transparent,
...props
}: IconButtonProps) {
const { foreground, background } = useColors(c => c.button[color]);

const iconSize = iconSizeProp ?? Math.round(size * 0.4);
const iconColor = iconColorProp
? iconColorProp
: inverse
? background
: foreground;
let iconColor = iconColorProp;

if (iconColor === undefined) {
iconColor = inverse ? background : foreground;
}

const children = Icon ? (
React.isValidElement(Icon) ? (
Expand All @@ -57,6 +58,7 @@ function IconButton({
inverse={inverse}
height={size}
variant={variant}
transparent={transparent}
{...props}
>
{children}
Expand Down
Loading

0 comments on commit 8bbd4ad

Please sign in to comment.