Skip to content

Commit

Permalink
chore: fixes tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Nov 28, 2024
1 parent 01d0bf1 commit 8f10154
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 18 deletions.
2 changes: 2 additions & 0 deletions apps/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@
"@testing-library/react": "^16.0.1",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/react-native": "^12.7.2",
"@types/d3-shape": "^3.1.6",
"@types/lodash": "^4.17.13",
"@types/pbkdf2": "^3.1.2",
"@types/react": "~18.2.79",
"@types/react-native-background-timer": "^2.0.2",
"@types/react-test-renderer": "^18.0.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.16.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BarCodeScanner,
BarCodeScannerResult,
} from 'expo-barcode-scanner'
import {Camera} from 'expo-camera'
import {CameraView, useCameraPermissions} from 'expo-camera'
import * as React from 'react'
import {StyleSheet, Text, useWindowDimensions, View} from 'react-native'
import {Path, Svg, SvgProps} from 'react-native-svg'
Expand All @@ -23,7 +23,7 @@ export const CameraCodeScanner = React.forwardRef<
CameraCodeScannerMethods,
CameraCodeScannerProps
>(({onRead, withMask, maskText = '', onCameraPermissionDenied}, ref) => {
const [status] = Camera.useCameraPermissions({request: true, get: true})
const [status] = useCameraPermissions({request: true, get: true})
const {height: deviceHeight, width: deviceWidth} = useWindowDimensions()
const qrScanned = React.useRef(false)

Expand Down Expand Up @@ -75,19 +75,19 @@ export const CameraCodeScanner = React.forwardRef<
* expo-barcode-scanner issue in android https://github.com/expo/expo/issues/5212
* so expo-camera is used
*/
<Camera
<CameraView
style={[StyleSheet.absoluteFill, styles.container]}
ratio="16:9"
barCodeScannerSettings={{
barCodeTypes: [
barcodeScannerSettings={{
barcodeTypes: [
BarCodeScanner.Constants.BarCodeType.qr,
BarCodeScanner.Constants.BarCodeType.pdf417,
],
}}
onBarCodeScanned={handleOnBarCodeScanned}
onBarcodeScanned={handleOnBarCodeScanned}
>
{withMask && <Mask maskText={maskText} />}
</Camera>
</CameraView>
)
})

Expand Down
6 changes: 3 additions & 3 deletions apps/wallet/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {useTheme} from '@yoroi/theme'
import React from 'react'
import * as React from 'react'
import {
Pressable,
StyleSheet,
Text,
TextProps,
TextStyle,
View,
ViewStyle,
} from 'react-native'
Expand All @@ -17,7 +17,7 @@ type Props = {
onChange: (checked: boolean) => void
style?: ViewStyle
testID?: string
textStyle?: TextProps
textStyle?: TextStyle
}
export const Checkbox = ({
checked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const LanguagePickerWarning = ({enabled}: {enabled: boolean}) => {
</TouchableOpacity>
</View>

{/* @ts-expect-error old react */}
<Markdown
style={{text: styles.markdownText, body: styles.markdownText}}
>
Expand Down
8 changes: 6 additions & 2 deletions apps/wallet/src/components/Modal/ModalContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NavigationProp, useNavigation} from '@react-navigation/native'
import React from 'react'
import * as React from 'react'
import {Keyboard} from 'react-native'

type ModalState = {
Expand Down Expand Up @@ -50,7 +50,11 @@ export const ModalProvider = ({
const onCloseRef = React.useRef<() => void>()
const actions = React.useRef<ModalActions>({
closeModal: () => {
if (getLastRouteName(navigation) === 'modal') {
if (
getLastRouteName(
navigation as NavigationProp<ReactNavigation.RootParamList>,
) === 'modal'
) {
dispatch({type: 'close'})
navigation.goBack()
onCloseRef.current?.()
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/components/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type TextInputProps = RNTextInputProps &
selectTextOnAutoFocus?: boolean
}

const useDebounced = (callback: VoidFunction, value: unknown, delay = 1000) => {
const useDebounced = (callback: Function, value: unknown, delay = 1_000) => {
const first = React.useRef(true)
React.useEffect(() => {
if (first.current) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const PrivacyPolicy = ({languageCode}: {languageCode: LanguageCode}) => {
<View>
<Spacer height={16} />

{/* @ts-expect-error old react */}
<Markdown style={styles}>{privacyPolicy}</Markdown>
</View>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const TermsOfService = ({
<View>
<Spacer height={16} />

{/* @ts-expect-error old react */}
<Markdown style={styles}>{tos}</Markdown>
</View>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export async function encryptWithPassword(
passwordBuf: Uint8Array,
dataBytes: Uint8Array,
): Promise<string> {
const salt = Buffer.from(cryptoRandomString({length: 2 * 16}), 'hex')
const nonce = Buffer.from(cryptoRandomString({length: 2 * 12}), 'hex')
const salt = Buffer.from(cryptoRandomString(2 * 16), 'hex')
const nonce = Buffer.from(cryptoRandomString(2 * 12), 'hex')
const data = Buffer.from(dataBytes)
const aad = Buffer.from('', 'hex')

Expand Down
17 changes: 17 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4194,6 +4194,18 @@
resolved "https://registry.yarnpkg.com/@types/blake2b/-/blake2b-2.1.3.tgz#bd6bf2fbabd888b5580d7e932de5960d087db094"
integrity sha512-MFCdX0MNxFBP/xEILO5Td0kv6nI7+Q2iRWZbTL/yzH2/eDVZS5Wd1LHdsmXClvsCyzqaZfHFzZaN6BUeUCfSDA==

"@types/d3-path@*":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-3.1.0.tgz#2b907adce762a78e98828f0b438eaca339ae410a"
integrity sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ==

"@types/d3-shape@^3.1.6":
version "3.1.6"
resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-3.1.6.tgz#65d40d5a548f0a023821773e39012805e6e31a72"
integrity sha512-5KKk5aKGu2I+O6SONMYSNflgiP0WfZIQvVUMan50wHsLG1G94JlxEVnCpQARfTtzytuY0p/9PXXZb3I7giofIA==
dependencies:
"@types/d3-path" "*"

"@types/graceful-fs@^4.1.3":
version "4.1.9"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4"
Expand Down Expand Up @@ -4349,6 +4361,11 @@
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.13.tgz#2af91918ee12d9d32914feb13f5326658461b451"
integrity sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==

"@types/react-native-background-timer@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@types/react-native-background-timer/-/react-native-background-timer-2.0.2.tgz#22f9126124068a0ee6a812e16f98e270c2b9b2c7"
integrity sha512-cMAep0M5yqUHjiiRPvGiviqiJYdI45KSjbI5ufsIFSQGFwHwrHJC/8yawNhy0G3Gix6fufWLsEj6jC5niUNHiQ==

"@types/react-test-renderer@^18.0.0", "@types/react-test-renderer@^18.0.7":
version "18.3.0"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-18.3.0.tgz#839502eae70058a4ae161f63385a8e7929cef4c0"
Expand Down

0 comments on commit 8f10154

Please sign in to comment.