smart dev screen selector (#1421)

* use the actual navigation object instead of an array of strings so that any time we add a screen its automatically available from dev settings.

* correct type
This commit is contained in:
Aaron DeRuvo
2025-11-17 15:37:41 +01:00
committed by GitHub
parent 60e1cb3fc5
commit ee2d72e801

View File

@@ -22,7 +22,7 @@ import { useSafeBottomPadding } from '@selfxyz/mobile-sdk-alpha/hooks';
import BugIcon from '@/images/icons/bug_icon.svg';
import IdIcon from '@/images/icons/id_icon.svg';
import WarningIcon from '@/images/icons/warning.svg';
import type { RootStackParamList } from '@/navigation';
import { navigationScreens, type RootStackParamList } from '@/navigation';
import { unsafe_clearSecrets } from '@/providers/authProvider';
import { usePassport } from '@/providers/passportDataProvider';
import { usePointEventStore } from '@/stores/pointEventStore';
@@ -183,40 +183,6 @@ function ParameterSection({
);
}
const items = [
'DevSettings',
'CountryPicker',
'DevLoadingScreen',
'AadhaarUpload',
'DevFeatureFlags',
'DevHapticFeedback',
'DevPrivateKey',
'Splash',
'Launch',
'DocumentOnboarding',
'DocumentCamera',
'DocumentNFCScan',
'DocumentDataInfo',
'Loading',
'AccountVerifiedSuccess',
'ConfirmBelonging',
'CreateMock',
'Home',
'Disclaimer',
'QRCodeViewFinder',
'Prove',
'ProofRequestStatus',
'Referral',
'Settings',
'AccountRecovery',
'SaveRecoveryPhrase',
'RecoverWithPhrase',
'ShowRecoveryPhrase',
'CloudBackupSettings',
'ComingSoon',
'DocumentCameraTrouble',
'DocumentNFCTrouble',
] satisfies (keyof RootStackParamList)[];
const ScreenSelector = ({}) => {
const navigation = useNavigation();
const [open, setOpen] = useState(false);
@@ -274,16 +240,22 @@ const ScreenSelector = ({}) => {
<Select.Group>
{useMemo(
() =>
items.sort().map((item, i) => {
return (
<Select.Item index={i} key={item} value={item}>
<Select.ItemText>{item}</Select.ItemText>
<Select.ItemIndicator marginLeft="auto">
<Check size={16} />
</Select.ItemIndicator>
</Select.Item>
);
}),
(
Object.keys(
navigationScreens,
) as (keyof typeof navigationScreens)[]
)
.sort()
.map((item, i) => {
return (
<Select.Item index={i} key={item} value={item}>
<Select.ItemText>{item}</Select.ItemText>
<Select.ItemIndicator marginLeft="auto">
<Check size={16} />
</Select.ItemIndicator>
</Select.Item>
);
}),
[],
)}
</Select.Group>