Skip to content

Commit 2f39f14

Browse files
committed
refactor: separate styles for fab button
1 parent bcd7a39 commit 2f39f14

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

App.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,7 @@ const FabButton = () => {
272272
className='absolute bottom-7 right-5 z-10'
273273
>
274274
<Press
275-
style={{
276-
shadowColor: '#000',
277-
shadowOffset: {
278-
width: 2,
279-
height: 2,
280-
},
281-
elevation: 6,
282-
shadowOpacity: 0.5,
283-
height: 60,
284-
width: 60,
285-
}}
275+
style={fabStyles.fabShadow}
286276
onPress={() => navigation.navigate('DeveloperOptions')}
287277
activeOpacity={0.9}
288278
activeScale={0.95}

src/screens/Home/styles/fabStyles.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { StyleSheet } from 'react-native'
2+
3+
const fabStyles = StyleSheet.create({
4+
fabShadow: {
5+
shadowColor: '#000',
6+
shadowOffset: {
7+
width: 2,
8+
height: 2,
9+
},
10+
elevation: 6,
11+
shadowOpacity: 0.5,
12+
height: 60,
13+
width: 60,
14+
},
15+
})
16+
17+
export default fabStyles

src/screens/OS/components/RunButton.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PlaySolidIcon } from '@assets/icons/icons'
22
import Press from '@components/Press'
3+
import fabStyles from '@screens/Home/styles/fabStyles'
34
import Animated, { ZoomIn, ZoomOut } from 'react-native-reanimated'
45

56
export default function RunButton({ onPlay }: { onPlay: () => void }) {
@@ -10,17 +11,7 @@ export default function RunButton({ onPlay }: { onPlay: () => void }) {
1011
className='absolute bottom-7 right-5 z-10'
1112
>
1213
<Press
13-
style={{
14-
shadowColor: '#000',
15-
shadowOffset: {
16-
width: 2,
17-
height: 2,
18-
},
19-
elevation: 6,
20-
shadowOpacity: 0.5,
21-
height: 60,
22-
width: 60,
23-
}}
14+
style={fabStyles.fabShadow}
2415
activeOpacity={0.9}
2516
activeScale={0.95}
2617
className='items-center justify-center rounded-full bg-accent'

0 commit comments

Comments
 (0)