-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: display error messages for PIN screens inline mode (#1253)
Signed-off-by: Mostafa Gamal <[email protected]> Signed-off-by: Mostafa Gamal <[email protected]> Signed-off-by: Mostafa Youssef <[email protected]> Co-authored-by: Mostafa Youssef <[email protected]>
- Loading branch information
Showing
13 changed files
with
479 additions
and
332 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions
50
packages/legacy/core/App/components/inputs/InlineErrorText.tsx
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,50 @@ | ||
import React from 'react' | ||
import { View, StyleSheet, Text } from 'react-native' | ||
|
||
import { useTheme } from '../../contexts/theme' | ||
import { SvgProps } from 'react-native-svg' | ||
import { InlineErrorConfig } from '../../types/error' | ||
|
||
export enum InlineErrorType { | ||
error, | ||
warning, | ||
} | ||
|
||
export interface InlineMessageProps { | ||
message: string | ||
inlineType: InlineErrorType | ||
config: InlineErrorConfig | ||
} | ||
|
||
const InlineErrorText: React.FC<InlineMessageProps> = ({ message, inlineType, config }) => { | ||
const { InputInlineMessage } = useTheme() | ||
const style = StyleSheet.create({ | ||
container: { | ||
flexDirection: 'row', | ||
alignContent: 'center', | ||
marginVertical: 5, | ||
paddingRight: 20, | ||
}, | ||
icon: { marginRight: 4 }, | ||
}) | ||
|
||
const color = | ||
inlineType === InlineErrorType.warning | ||
? InputInlineMessage.inlineWarningText.color | ||
: InputInlineMessage.inlineErrorText.color | ||
|
||
const props: SvgProps = { height: 16, width: 16, color: color, style: style.icon } | ||
|
||
return ( | ||
<View style={[style.container, config.style]}> | ||
{inlineType === InlineErrorType.warning ? ( | ||
<InputInlineMessage.InlineWarningIcon {...props} /> | ||
) : ( | ||
<InputInlineMessage.InlineErrorIcon {...props} /> | ||
)} | ||
<Text style={[InputInlineMessage.inlineErrorText]}>{message}</Text> | ||
</View> | ||
) | ||
} | ||
|
||
export default InlineErrorText |
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
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.