-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1055 from Koniverse/issue-881
[Issue-881]: Update UI Scan QR screen by design
- Loading branch information
Showing
14 changed files
with
248 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/node_modules/@polkadot/ui-shared/cjs/icons/polkadot.js b/node_modules/@polkadot/ui-shared/cjs/icons/polkadot.js | ||
index 29211ea..9a8e774 100644 | ||
--- a/node_modules/@polkadot/ui-shared/cjs/icons/polkadot.js | ||
+++ b/node_modules/@polkadot/ui-shared/cjs/icons/polkadot.js | ||
@@ -20,7 +20,7 @@ const SCHEMES_TOTAL = SCHEMES | ||
const OUTER_CIRCLE = { | ||
cx: C, | ||
cy: C, | ||
- fill: '#eee', | ||
+ fill: 'transparent', | ||
r: C | ||
}; | ||
let zeroHash = new Uint8Array(); | ||
diff --git a/node_modules/@polkadot/ui-shared/icons/polkadot.js b/node_modules/@polkadot/ui-shared/icons/polkadot.js | ||
index b7f439d..766c0e0 100644 | ||
--- a/node_modules/@polkadot/ui-shared/icons/polkadot.js | ||
+++ b/node_modules/@polkadot/ui-shared/icons/polkadot.js | ||
@@ -17,7 +17,7 @@ const SCHEMES_TOTAL = SCHEMES | ||
const OUTER_CIRCLE = { | ||
cx: C, | ||
cy: C, | ||
- fill: '#eee', | ||
+ fill: 'trasparent', | ||
r: C | ||
}; | ||
let zeroHash = new Uint8Array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import React from 'react'; | ||
import QRCodeScanner from 'react-native-qrcode-scanner'; | ||
import { ScannerStyles } from 'styles/scanner'; | ||
import { StyleProp, View, ViewStyle } from 'react-native'; | ||
import Text from 'components/Text'; | ||
import i18n from 'utils/i18n/i18n'; | ||
import { IconButton } from 'components/IconButton'; | ||
import { CaretLeft, ImageSquare, Info } from 'phosphor-react-native'; | ||
import { BarcodeFinder } from 'screens/Shared/BarcodeFinder'; | ||
import { Warning } from 'components/Warning'; | ||
import { Button, Icon } from 'components/design-system-ui'; | ||
import { useSubWalletTheme } from 'hooks/useSubWalletTheme'; | ||
import { BarCodeReadEvent } from 'react-native-camera'; | ||
|
||
const CancelButtonStyle: StyleProp<ViewStyle> = { | ||
position: 'absolute', | ||
left: 16, | ||
zIndex: 10, | ||
width: 40, | ||
height: 40, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}; | ||
|
||
const LibraryButtonStyle: StyleProp<ViewStyle> = { | ||
position: 'absolute', | ||
right: 16, | ||
zIndex: 10, | ||
width: 40, | ||
height: 40, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}; | ||
|
||
const BottomSubContentStyle: StyleProp<ViewStyle> = { | ||
alignItems: 'center', | ||
justifyContent: 'flex-end', | ||
marginHorizontal: 16, | ||
flex: 1, | ||
}; | ||
|
||
interface Props { | ||
error?: string; | ||
onPressLibraryBtn?: () => Promise<void>; | ||
onPressCancel: () => void; | ||
onSuccess: (e: BarCodeReadEvent) => void; | ||
} | ||
|
||
export const QrCodeScanner = ({ error, onPressLibraryBtn, onPressCancel, onSuccess }: Props) => { | ||
const theme = useSubWalletTheme().swThemes; | ||
return ( | ||
<QRCodeScanner | ||
reactivate={true} | ||
reactivateTimeout={5000} | ||
showMarker={true} | ||
onRead={e => { | ||
onSuccess(e); | ||
}} | ||
containerStyle={ScannerStyles.ContainerStyle} | ||
cameraStyle={ScannerStyles.CameraStyle} | ||
topViewStyle={ScannerStyles.ContainerStyle} | ||
customMarker={ | ||
<View style={ScannerStyles.RectangleContainerStyle}> | ||
<View style={ScannerStyles.TopOverlayStyle}> | ||
<View style={[ScannerStyles.HeaderStyle]}> | ||
<Text style={ScannerStyles.HeaderTitleTextStyle}>{i18n.title.scanQrCode}</Text> | ||
<IconButton icon={CaretLeft} size={24} style={CancelButtonStyle} onPress={onPressCancel} /> | ||
<IconButton icon={Info} size={24} style={LibraryButtonStyle} /> | ||
</View> | ||
</View> | ||
<View style={ScannerStyles.CenterOverlayStyle}> | ||
<View style={ScannerStyles.LeftAndRightOverlayStyle} /> | ||
|
||
<View style={ScannerStyles.RectangleStyle}> | ||
<BarcodeFinder /> | ||
</View> | ||
|
||
<View style={ScannerStyles.LeftAndRightOverlayStyle} /> | ||
</View> | ||
<View style={ScannerStyles.BottomOverlayStyle}> | ||
<View style={[BottomSubContentStyle, { marginBottom: theme.padding }]}> | ||
{!!error && <Warning message={error} isDanger />} | ||
</View> | ||
{onPressLibraryBtn && ( | ||
<Button | ||
icon={<Icon phosphorIcon={ImageSquare} weight={'fill'} />} | ||
type={'secondary'} | ||
onPress={onPressLibraryBtn}> | ||
{i18n.buttonTitles.uploadFromPhotos} | ||
</Button> | ||
)} | ||
<View style={BottomSubContentStyle} /> | ||
</View> | ||
</View> | ||
} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.