Skip to content

Commit

Permalink
feat: add visibility toggle for scan error info button (#1399)
Browse files Browse the repository at this point in the history
Signed-off-by: ZouidiSamih <[email protected]>
  • Loading branch information
ZouidiSamih authored Jan 20, 2025
1 parent a94474e commit c15dcd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/legacy/core/App/components/misc/QRScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface Props {

const QRScanner: React.FC<Props> = ({ handleCodeScan, error, enableCameraOnError }) => {
const navigation = useNavigation<StackNavigationProp<ConnectStackParams>>()
const [{ showScanHelp, showScanButton }] = useServices([TOKENS.CONFIG])
const [{ showScanHelp, showScanButton, showScanErrorButton = true }] = useServices([TOKENS.CONFIG])
const [torchActive, setTorchActive] = useState(false)
const [showInfoBox, setShowInfoBox] = useState(false)
const [showErrorDetailsModal, setShowErrorDetailsModal] = useState(false)
Expand Down Expand Up @@ -109,15 +109,17 @@ const QRScanner: React.FC<Props> = ({ handleCodeScan, error, enableCameraOnError
<Text testID={testIdWithKey('ErrorMessage')} style={styles.textStyle}>
{error.message}
</Text>
<Pressable
onPress={() => setShowErrorDetailsModal(true)}
accessibilityLabel={t('Scan.ShowDetails')}
accessibilityRole={'button'}
testID={testIdWithKey('ShowDetails')}
hitSlop={hitSlop}
>
<Icon name="information-outline" size={40} style={styles.icon} />
</Pressable>
{showScanErrorButton && (
<Pressable
onPress={() => setShowErrorDetailsModal(true)}
accessibilityLabel={t('Scan.ShowDetails')}
accessibilityRole={'button'}
testID={testIdWithKey('ShowDetails')}
hitSlop={hitSlop}
>
<Icon name="information-outline" size={40} style={styles.icon} />
</Pressable>
)}
</>
) : (
<>
Expand Down
1 change: 1 addition & 0 deletions packages/legacy/core/App/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface Config {
whereToUseWalletUrl?: string
showScanHelp?: boolean
showScanButton?: boolean
showScanErrorButton?: boolean
globalScreenOptions?: StackNavigationOptions
showDetailsInfo?: boolean
contactHideList?: string[]
Expand Down

0 comments on commit c15dcd3

Please sign in to comment.