Skip to content

Commit

Permalink
fix(share): add placeholder button to prevent flicker on load
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert27 committed Nov 19, 2024
1 parent 3fa68d0 commit ddfd014
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
13 changes: 13 additions & 0 deletions src/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import CrashView from '@/components/Error/CrashView'
import PlatformIcon from '@/components/Universal/Icon'
import ShareHeaderButton from '@/components/Universal/ShareHeaderButton'
import Provider from '@/components/provider'
import i18n from '@/localization/i18n'
import '@/styles/unistyles'
Expand Down Expand Up @@ -182,6 +183,9 @@ function RootLayout(): JSX.Element {
presentation: 'modal',
},
}),
headerRight: () => (
<ShareHeaderButton onPress={() => {}} />
),
}}
/>
<Stack.Screen
Expand All @@ -193,6 +197,9 @@ function RootLayout(): JSX.Element {
presentation: 'modal',
},
}),
headerRight: () => (
<ShareHeaderButton onPress={() => {}} />
),
}}
/>
<Stack.Screen
Expand Down Expand Up @@ -292,6 +299,9 @@ function RootLayout(): JSX.Element {
presentation: 'modal',
},
}),
headerRight: () => (
<ShareHeaderButton onPress={() => {}} />
),
}}
/>
<Stack.Screen
Expand All @@ -303,6 +313,9 @@ function RootLayout(): JSX.Element {
presentation: 'modal',
},
}),
headerRight: () => (
<ShareHeaderButton onPress={() => {}} />
),
}}
/>
<Stack.Screen
Expand Down
33 changes: 22 additions & 11 deletions src/components/Universal/ShareHeaderButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,37 @@ export default function ShareHeaderButton({
}}
android={{
name: 'share',
size: 18,
size: 20,
}}
style={Platform.select({
android: {
marginRight: 2,
},
ios: {
marginBottom: 3,
},
})}
style={styles.icon}
/>
</Pressable>
)
}

const stylesheet = createStyleSheet((theme) => ({
icon: {
...Platform.select({
android: {
marginRight: 2,
color: theme.colors.text,
},
ios: {
marginBottom: 3,
color: theme.colors.primary,
},
}),
},
shareButton: {
alignItems: 'center',
backgroundColor: theme.colors.background,
borderRadius: 25,
backgroundColor: Platform.select({
android: undefined,
ios: theme.colors.background,
}),
borderRadius: Platform.select({
android: undefined,
ios: theme.radius.infinite,
}),
height: 34,
justifyContent: 'center',
marginRight: -5,
Expand Down

0 comments on commit ddfd014

Please sign in to comment.