Skip to content

Commit d7160f6

Browse files
committed
refactor: Remove navigation prop from SettWrapper in multiple components for consistency
1 parent 2e1628e commit d7160f6

35 files changed

+38
-39
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
- Do not add unnecessary comments for my understanding.
44

55
- Icons are used from hugeicons if you want to add extra icons to the library, you can add it running `ic-old iconName` command.
6-
`iconName` is from the hugeicons website.
6+
`iconName` is from the hugeicons website.
77

8-
- No need to fix formatting related issues.
8+
- No need to fix formatting related issues.

src/components/RoundNotification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function RoundNotification({ n }: { n: number }) {
55
if (n === 0) return null
66
return (
77
<View className='items-center justify-center rounded-full bg-red-500' style={{ height: 22, width: 22 }}>
8-
<SemiBold className='text-xs text-white pt-0.5' numberOfLines={1}>
8+
<SemiBold className='pt-0.5 text-xs text-white' numberOfLines={1}>
99
{n}
1010
</SemiBold>
1111
</View>

src/components/Settings/SettWrapper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import { Gap20 } from '@components/Gap'
33
import KeyboardAvoid from '@components/KeyboardAvoid'
44
import { PaddingBottom } from '@components/SafePadding'
55
import { AutoStatusBar } from '@components/StatusBar'
6+
import { useNavigation } from '@react-navigation/native'
67
import { StackNav } from '@utils/types'
78
import React from 'react'
89
import { ScrollViewProps, useColorScheme, View } from 'react-native'
910

1011
type SettWrapperProps = ScrollViewProps & {
1112
Header?: React.ReactNode
1213
title?: string
13-
navigation?: StackNav
1414
}
15-
export default function SettWrapper({ Header, title, navigation, children, ...rest }: SettWrapperProps) {
15+
export default function SettWrapper({ Header, title, children, ...rest }: SettWrapperProps) {
16+
const navigation = useNavigation<StackNav>()
1617
const scheme = useColorScheme()
1718
return (
1819
<View className='bg flex-1'>

src/screens/CoordinateNotes/CoordinateNote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default function CoordinateNote({ navigation, route }: CoordinateNoteProp
7777

7878
return (
7979
<>
80-
<SettWrapper navigation={navigation} title={name || 'Location Note'}>
80+
<SettWrapper title={name || 'Location Note'}>
8181
<Gap12 className='mt-3'>
8282
<SettGroup title='Location Name'>
8383
<Input

src/screens/CoordinateNotes/CoordinateNotes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function CoordinateNotes({ navigation }: NavProp) {
1818
const notes = coordinateNotesStore((state) => state.notes)
1919
return (
2020
<>
21-
<SettWrapper navigation={navigation} title='Coordinate Notes'>
21+
<SettWrapper title='Coordinate Notes'>
2222
<NoNotes notes={notes} />
2323
<NotesList notes={notes} />
2424
</SettWrapper>

src/screens/CoordinateNotes/LocationTags.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ export default function LocationTags() {
1010
<StatusBar barStyle='default' />
1111
<AppBar />
1212
<ScrollView contentContainerClassName='p-5 flex-1 justify-center items-center'>
13-
<Bold className='text-3xl text text-center'>Coming Soon!</Bold>
14-
<Medium className='text opacity-80 text-base mt-3 text-center'>This feature is currently under development. Stay tuned for updates!</Medium>
13+
<Bold className='text text-center text-3xl'>Coming Soon!</Bold>
14+
<Medium className='text mt-3 text-center text-base opacity-80'>
15+
This feature is currently under development. Stay tuned for updates!
16+
</Medium>
1517
<PaddingBottom />
1618
</ScrollView>
1719
</View>

src/screens/DeveloperOptions/DeveloperOptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function DeveloperOptions({ navigation }: NavProp) {
6767
}
6868

6969
return (
70-
<SettWrapper title='Developer Options' navigation={navigation}>
70+
<SettWrapper title='Developer Options'>
7171
<Gap12>
7272
<SettGroup>
7373
<SettOption

src/screens/DeveloperOptions/MMKVDataEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export default function MMKVDataEditor({
7272
return (
7373
<>
7474
<SettWrapper
75-
navigation={navigation}
7675
title={isNew ? (key ? key : 'New MMKV data') : key}
7776
Header={
7877
<BackHeader

src/screens/DeveloperOptions/MMKVDataList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export default function MMKVDataList({ navigation }: NavProp) {
4949
return (
5050
<>
5151
<SettWrapper
52-
navigation={navigation}
5352
Header={
5453
<>
5554
<BackHeader title='MMKV data editor' navigation={navigation} />

src/screens/Example/Skia.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const App = () => {
2828

2929
export default function Skia({ navigation }: NavProp) {
3030
return (
31-
<SettWrapper navigation={navigation} title='Blank Settings'>
31+
<SettWrapper title='Blank Settings'>
3232
<Gap12>
3333
<SettText className='mt-3'>Beginning Text</SettText>
3434
<SettGroup title='Sample title'>

src/screens/OS/FCFS.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function FCFS({ navigation }: NavProp) {
5555

5656
return (
5757
<>
58-
<SettWrapper navigation={navigation} title='FCFS Process Scheduling'>
58+
<SettWrapper title='FCFS Process Scheduling'>
5959
<Gap12 className='pb-8'>
6060
<SettText className='mt-3'>
6161
FCFS (First Come First Serve) is a scheduling algorithm that schedules according to the arrival time of the

src/screens/OS/SJF.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function SJF({ navigation }: NavProp) {
5555

5656
return (
5757
<>
58-
<SettWrapper navigation={navigation} title='SJF Process Scheduling'>
58+
<SettWrapper title='SJF Process Scheduling'>
5959
<Gap12 className='pb-8'>
6060
<SettText className='mt-3'>
6161
SJF (Shortest Job First) is a scheduling algorithm that selects the process with the smallest burst time.

src/screens/Settings/Admin/EditVersion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default function EditVersion({ navigation }: NavProp) {
110110
}, [version])
111111

112112
return (
113-
<SettWrapper navigation={navigation} title='Edit Version'>
113+
<SettWrapper title='Edit Version'>
114114
<Gap12>
115115
<View>
116116
<SettText className='mt-3'>

src/screens/Settings/Admin/Users/AllUsers.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export default function AllUsers({ navigation }: NavProp) {
3838

3939
return (
4040
<SettWrapper
41-
navigation={navigation}
4241
Header={
4342
<>
4443
<BackHeader title='All users' navigation={navigation} />

src/screens/Settings/Admin/Users/User.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function User({ navigation, route }: { navigation: StackNav; rout
5858
}
5959

6060
return (
61-
<SettWrapper navigation={navigation} title={username}>
61+
<SettWrapper title={username}>
6262
<Gap gap={10}>
6363
<SettText className='mt-3'>You can see all details of the user here.</SettText>
6464
<SettGroup title='Full Name'>

src/screens/Settings/AppLock/AppLock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function AppLock({ navigation }: NavProp) {
3535
}, [isAppLockEnabled])
3636

3737
return (
38-
<SettWrapper navigation={navigation} title='App Lock'>
38+
<SettWrapper title='App Lock'>
3939
<Gap12>
4040
<SettText className='mt-3 text-blue-500'>This feature will be available in the next release. CodeAntu</SettText>
4141
<SettGroup title='App Lock Settings'>

src/screens/Settings/BackupAndRestore.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { NavProp } from '@utils/types'
55

66
export default function BackupAndRestore({ navigation }: NavProp) {
77
return (
8-
<SettWrapper navigation={navigation} title='Backup and Restore'>
8+
<SettWrapper title='Backup and Restore'>
99
<Gap12>
1010
<SettText className='mt-3'>In this section, you can backup and restore your data.</SettText>
1111
</Gap12>

src/screens/Settings/BlankSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { NavProp } from '@utils/types'
99

1010
export default function BlankSettings({ navigation }: NavProp) {
1111
return (
12-
<SettWrapper navigation={navigation} title='Blank Settings'>
12+
<SettWrapper title='Blank Settings'>
1313
<Gap12>
1414
<SettText className='mt-3'>Beginning Text</SettText>
1515
<SettGroup title='Sample title'>

src/screens/Settings/Devices/Device.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default function Device({ navigation, route }: { navigation: StackNav; ro
9090
<Medium className='mt-10 text-center text-2xl text-white'>Device</Medium>
9191
</View>
9292
</View> */}
93-
<SettWrapper title={device?.name || 'Unknown Device'} navigation={navigation}>
93+
<SettWrapper title={device?.name || 'Unknown Device'}>
9494
<Gap gap={15}>
9595
<SettText className='mt-3'>If you cannot identify this device, you can remove it from the list.</SettText>
9696
<SettGroup title='Device' className='pb-4'>

src/screens/Settings/Devices/Devices.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function Devices({ navigation }: NavProp) {
5050
}
5151

5252
return (
53-
<SettWrapper title='Devices' navigation={navigation}>
53+
<SettWrapper title='Devices'>
5454
<Gap12>
5555
<SettText className='mt-3'>You can remove unwanted devices from the list.</SettText>
5656
<SettGroup title='This Device'>

src/screens/Settings/ManageStorage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const colors = [
2323

2424
export default function ManageStorage({ navigation }: NavProp) {
2525
return (
26-
<SettWrapper navigation={navigation} title='Manage Storage'>
26+
<SettWrapper title='Manage Storage'>
2727
<Gap12>
2828
<SettText className='mt-3'>
2929
Manage different types of storage in the app. This screen is under development.

src/screens/Settings/UiAndComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function UiAndComponents({ navigation }: NavProp) {
4444
}, [option1])
4545

4646
return (
47-
<SettWrapper navigation={navigation} title='UI & Components'>
47+
<SettWrapper title='UI & Components'>
4848
<>
4949
<Gap12>
5050
<SettText className='mt-3'>This is a test screen to show the different settings components</SettText>

src/screens/Settings/YourProfile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function YourProfile({ navigation }: NavProp) {
3737
const setGender = profileStore((s) => s.setGender)
3838

3939
return (
40-
<SettWrapper navigation={navigation} title='Your Profile'>
40+
<SettWrapper title='Your Profile'>
4141
<Gap12>
4242
<SettText className='mt-3'>Enter your details below to get the best experience from the app.</SettText>
4343
<SettGroup title='First and Last Name'>

src/screens/Test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { NavProp } from '@utils/types'
77
export default function Test({ navigation }: NavProp) {
88
return (
99
<>
10-
<SettWrapper navigation={navigation} title='Test Screen'>
10+
<SettWrapper title='Test Screen'>
1111
<SettText className='mt-5'>This is a test screen</SettText>
1212
<SettGroup title='Normal Input'>
1313
<Input placeholder='Test Input' />

src/screens/Try/RandomPassword.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Colors } from '@utils/colors'
1313
import { W } from '@utils/dimensions'
1414
import { Medium, SemiBold } from '@utils/fonts'
1515
import type { NavProp } from '@utils/types'
16-
import React, { memo, useCallback, useEffect, useState } from 'react'
16+
import React, { memo, useCallback, useEffect, useState, JSX } from 'react'
1717
import { ToastAndroid, TouchableOpacity, View } from 'react-native'
1818

1919
const MAX = 50
@@ -55,7 +55,7 @@ export default function RandomPassword({ navigation }: NavProp) {
5555
)
5656
}, [len, lowercase, numerical, special, uppercase])
5757
return (
58-
<SettWrapper navigation={navigation} title='Random Password'>
58+
<SettWrapper title='Random Password'>
5959
<Gap12>
6060
<Lottie source={Animations.lock} style={{ marginTop: 20, width: W * 0.5, height: W * 0.5 }} />
6161
<SettText>Here you will set some options to generate a random password</SettText>

src/screens/Try/YourAge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function YourAge({ navigation }: NavProp) {
3333

3434
useEffect(() => getAge(), [birthDay, getAge])
3535
return (
36-
<SettWrapper navigation={navigation} title='Your Age'>
36+
<SettWrapper title='Your Age'>
3737
<Gap12>
3838
<SettText className='mt-3'>Here you can see your age in years, months, days etc.</SettText>
3939
<Medium className='mt-6 text-center text-3xl text-black/70 dark:text-white/70'>{second}s</Medium>

src/screens/Update/Update.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export default function Update({ navigation, route }: { navigation: StackNav; ro
4343

4444
return (
4545
<SettWrapper
46-
navigation={navigation}
4746
title='App Update'
4847
Header={<BackHeader title='App Update' navigation={navigation} onBackPress={cannotSkipBack} />}
4948
>

src/screens/Weather/Main/components/DailyForecast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Icons } from '@screens/Weather/utils'
77
import { F, Medium, Regular } from '@utils/fonts'
88
import type { Theme } from '@utils/types'
99
import { getDay, tempConverter } from '@utils/utils'
10-
import React, { useMemo } from 'react'
10+
import React, { JSX, useMemo } from 'react'
1111
import { View } from 'react-native'
1212
import Animated, { FadeIn } from 'react-native-reanimated'
1313
import WeatherLabel, { Underline } from './WeatherLabel'

src/screens/Weather/Settings/AtmPressureUnit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function AtmPressureUnit({ navigation }: NavProp) {
1111
const atmPressureUnit = weatherStore((state) => state.atmPressureUnit)
1212
const setAtmPressureUnit = weatherStore((state) => state.setAtmPressureUnit)
1313
return (
14-
<SettWrapper navigation={navigation} title='Atmospheric Pressure Unit'>
14+
<SettWrapper title='Atmospheric Pressure Unit'>
1515
<Gap12>
1616
<SettText className='mt-3'>Select the unit of atmospheric pressure you want to use.</SettText>
1717
<SettGroup>

src/screens/Weather/Settings/DistanceUnit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function DistanceUnit({ navigation }: NavProp) {
1313
const distanceUnit = weatherStore((state) => state.distanceUnit)
1414
const setDistUnit = weatherStore((state) => state.setDistanceUnit)
1515
return (
16-
<SettWrapper navigation={navigation} title='Distance Unit'>
16+
<SettWrapper title='Distance Unit'>
1717
<Gap12>
1818
<SettText className='mt-3'>Select the unit of distance you want to use.</SettText>
1919
<SettGroup>

src/screens/Weather/Settings/TempUnit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function TempUnit({ navigation }: NavProp) {
1313
const temperatureUnit = weatherStore((state) => state.temperatureUnit)
1414
const setTmpUnit = weatherStore((state) => state.setTemperatureUnit)
1515
return (
16-
<SettWrapper navigation={navigation} title='Temperature Unit'>
16+
<SettWrapper title='Temperature Unit'>
1717
<Gap12>
1818
<SettText className='mt-3'>Select the unit of temperature you want to use.</SettText>
1919
<SettGroup>

src/screens/Weather/Settings/TimeFormatUnit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function TimeFormatUnit({ navigation }: NavProp) {
1313
const timeFormatUnit = weatherStore((state) => state.weatherTimeFormat)
1414
const setWeatherTimeFormat = weatherStore((state) => state.setWeatherTimeFormat)
1515
return (
16-
<SettWrapper navigation={navigation} title='Time Format Unit'>
16+
<SettWrapper title='Time Format Unit'>
1717
<Gap12>
1818
<SettText className='mt-3'>Choose between 12 hour and 24 hour time format</SettText>
1919
<SettGroup>

src/screens/Weather/Settings/WeatherSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default function WeatherScienceSettings({ navigation }: NavProp) {
7575
}, [focused])
7676

7777
return (
78-
<SettWrapper navigation={navigation} title='Weather Settings'>
78+
<SettWrapper title='Weather Settings'>
7979
<Gap12>
8080
<SettText className='mt-3'>Customize the weather settings to your preference.</SettText>
8181
<SettGroup title='General Settings'>

src/screens/Weather/Settings/WindSpeedUnit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function WindSpeedUnit({ navigation }: NavProp) {
1919
const windSpeedUnit = weatherStore((state) => state.windSpeedUnit)
2020
const setWindSpeedUnit = weatherStore((state) => state.setWindSpeedUnit)
2121
return (
22-
<SettWrapper navigation={navigation} title='Wind Speed Unit'>
22+
<SettWrapper title='Wind Speed Unit'>
2323
<Gap12>
2424
<SettText className='mt-3'>Select the unit of wind speed you want to use.</SettText>
2525
<SettGroup>

src/screens/randomPasswordGenerator/randomPasswordGenerator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function randomPasswordGenerator({ navigation }: NavProp) {
6262
}
6363

6464
return (
65-
<SettWrapper navigation={navigation} title='Blank Settings'>
65+
<SettWrapper title='Blank Settings'>
6666
<Gap12>
6767
<SettText className='mt-3'>Beginning Text</SettText>
6868
<SettGroup title='Sample title'>

0 commit comments

Comments
 (0)