react-native-toast-message 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -2
- package/README.md +19 -235
- package/lib/index.d.ts +6 -0
- package/lib/index.js +6 -0
- package/lib/src/Toast.d.ts +7 -0
- package/lib/src/Toast.js +27 -0
- package/lib/src/ToastUI.d.ts +11 -0
- package/lib/src/ToastUI.js +40 -0
- package/lib/src/components/AnimatedContainer.d.ts +16 -0
- package/lib/src/components/AnimatedContainer.js +72 -0
- package/lib/src/components/AnimatedContainer.styles.d.ts +14 -0
- package/lib/src/components/AnimatedContainer.styles.js +15 -0
- package/lib/src/components/BaseToast.d.ts +3 -0
- package/lib/src/components/BaseToast.js +19 -0
- package/lib/src/components/BaseToast.styles.d.ts +41 -0
- package/lib/src/components/BaseToast.styles.js +39 -0
- package/lib/src/components/ErrorToast.d.ts +3 -0
- package/lib/src/components/ErrorToast.js +5 -0
- package/lib/src/components/InfoToast.d.ts +3 -0
- package/lib/src/components/InfoToast.js +5 -0
- package/lib/src/components/SuccessToast.d.ts +3 -0
- package/lib/src/components/SuccessToast.js +5 -0
- package/lib/src/components/Touchable.d.ts +8 -0
- package/lib/src/components/Touchable.js +7 -0
- package/lib/src/contexts/LoggerContext.d.ts +12 -0
- package/lib/src/contexts/LoggerContext.js +22 -0
- package/lib/src/contexts/index.d.ts +1 -0
- package/lib/src/contexts/index.js +1 -0
- package/lib/src/hooks/index.d.ts +5 -0
- package/lib/src/hooks/index.js +5 -0
- package/lib/src/hooks/useKeyboard.d.ts +4 -0
- package/lib/src/hooks/useKeyboard.js +31 -0
- package/lib/src/hooks/usePanResponder.d.ts +15 -0
- package/lib/src/hooks/usePanResponder.js +41 -0
- package/lib/src/hooks/useSlideAnimation.d.ts +24 -0
- package/lib/src/hooks/useSlideAnimation.js +49 -0
- package/lib/src/hooks/useTimeout.d.ts +6 -0
- package/lib/src/hooks/useTimeout.js +29 -0
- package/lib/src/hooks/useViewDimensions.d.ts +13 -0
- package/lib/src/hooks/useViewDimensions.js +20 -0
- package/lib/src/types/index.d.ts +165 -0
- package/lib/src/types/index.js +1 -0
- package/lib/src/useToast.d.ts +13 -0
- package/lib/src/useToast.js +79 -0
- package/lib/src/utils/array.d.ts +2 -0
- package/lib/src/utils/array.js +4 -0
- package/lib/src/utils/func.d.ts +1 -0
- package/lib/src/utils/func.js +1 -0
- package/lib/src/utils/number.d.ts +3 -0
- package/lib/src/utils/number.js +9 -0
- package/lib/src/utils/obj.d.ts +3 -0
- package/lib/src/utils/obj.js +11 -0
- package/lib/src/utils/platform.d.ts +1 -0
- package/lib/src/utils/platform.js +4 -0
- package/lib/src/utils/test-id.d.ts +1 -0
- package/lib/src/utils/test-id.js +3 -0
- package/package.json +46 -35
- package/.github/dependabot.yml +0 -17
- package/.github/workflows/publish.yml +0 -22
- package/.github/workflows/tag.yml +0 -16
- package/.github/workflows/tests.yml +0 -44
- package/babel.config.js +0 -3
- package/index.d.ts +0 -69
- package/index.js +0 -4
- package/jest.config.js +0 -5
- package/jest.setup.js +0 -1
- package/src/assets/icons/close.png +0 -0
- package/src/assets/icons/close@2x.png +0 -0
- package/src/assets/icons/close@3x.png +0 -0
- package/src/assets/icons/error.png +0 -0
- package/src/assets/icons/error@2x.png +0 -0
- package/src/assets/icons/error@3x.png +0 -0
- package/src/assets/icons/info.png +0 -0
- package/src/assets/icons/info@2x.png +0 -0
- package/src/assets/icons/info@3x.png +0 -0
- package/src/assets/icons/success.png +0 -0
- package/src/assets/icons/success@2x.png +0 -0
- package/src/assets/icons/success@3x.png +0 -0
- package/src/assets/index.js +0 -15
- package/src/colors/index.js +0 -10
- package/src/components/base/index.js +0 -134
- package/src/components/base/styles.js +0 -54
- package/src/components/error.js +0 -19
- package/src/components/icon/index.js +0 -40
- package/src/components/icon/styles.js +0 -8
- package/src/components/info.js +0 -19
- package/src/components/success.js +0 -19
- package/src/index.js +0 -420
- package/src/styles.js +0 -17
- package/src/utils/arr.js +0 -3
- package/src/utils/obj.js +0 -9
- package/src/utils/platform.js +0 -5
- package/src/utils/prop-types.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const noop: () => undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const noop = () => undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isIOS(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTestId(elementName: string): string;
|
package/package.json
CHANGED
|
@@ -1,49 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-toast-message",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Toast message component for React Native",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"lint-staged": {
|
|
14
|
-
"**/*.js": [
|
|
15
|
-
"prettier --write",
|
|
16
|
-
"eslint"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"husky": {
|
|
20
|
-
"hooks": {
|
|
21
|
-
"pre-commit": "lint-staged"
|
|
22
|
-
}
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"types": "./lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/lib"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/calintamas/react-native-toast-message.git"
|
|
23
13
|
},
|
|
24
14
|
"keywords": [
|
|
25
15
|
"react-native",
|
|
26
16
|
"toast"
|
|
27
17
|
],
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
18
|
+
"scripts": {
|
|
19
|
+
"prepare": "husky install",
|
|
20
|
+
"build": "rm -rf ./lib && tsc",
|
|
21
|
+
"prettier": "./node_modules/.bin/prettier --write",
|
|
22
|
+
"lint": "./node_modules/.bin/eslint --fix",
|
|
23
|
+
"lint-staged": "./node_modules/.bin/lint-staged",
|
|
24
|
+
"test": "./node_modules/.bin/jest"
|
|
33
25
|
},
|
|
26
|
+
"author": "Calin Tamas <calintamas2@gmail.com>",
|
|
27
|
+
"license": "MIT",
|
|
34
28
|
"devDependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@testing-library/
|
|
29
|
+
"@babel/core": "^7.15.8",
|
|
30
|
+
"@testing-library/jest-native": "^4.0.2",
|
|
31
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
32
|
+
"@testing-library/react-native": "^8.0.0",
|
|
37
33
|
"@types/jest": "^27.0.1",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"react-
|
|
34
|
+
"@types/react-native": "^0.66.2",
|
|
35
|
+
"eslint-config-backpacker-react-ts": "^0.1.0",
|
|
36
|
+
"husky": "^7.0.2",
|
|
37
|
+
"import-sort-style-module": "^6.0.0",
|
|
38
|
+
"jest": "^27.1.1",
|
|
39
|
+
"lint-staged": "^11.1.2",
|
|
40
|
+
"metro-react-native-babel-preset": "^0.66.2",
|
|
41
|
+
"prettier": "^2.4.1",
|
|
42
|
+
"prettier-plugin-import-sort": "^0.0.7",
|
|
43
|
+
"react-test-renderer": "^17.0.2",
|
|
44
|
+
"typescript": "^4.4.3"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": ">=17.0.2",
|
|
48
|
+
"react-native": ">=0.64.2"
|
|
45
49
|
},
|
|
46
|
-
"
|
|
47
|
-
"
|
|
50
|
+
"importSort": {
|
|
51
|
+
".js, .jsx, .ts, .tsx": {
|
|
52
|
+
"style": "module",
|
|
53
|
+
"parser": "typescript"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"lint-staged": {
|
|
57
|
+
"*.{js,jsx,ts,tsx,md}": "yarn prettier",
|
|
58
|
+
"*.{js,jsx,ts,tsx}": "yarn lint"
|
|
48
59
|
}
|
|
49
60
|
}
|
package/.github/dependabot.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: npm
|
|
4
|
-
directory: "/"
|
|
5
|
-
schedule:
|
|
6
|
-
interval: monthly
|
|
7
|
-
time: "03:00"
|
|
8
|
-
open-pull-requests-limit: 10
|
|
9
|
-
reviewers:
|
|
10
|
-
- calintamas
|
|
11
|
-
ignore:
|
|
12
|
-
- dependency-name: husky
|
|
13
|
-
versions:
|
|
14
|
-
- "> 3.1.0"
|
|
15
|
-
- dependency-name: husky
|
|
16
|
-
versions:
|
|
17
|
-
- ">= 4.a, < 5"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v1
|
|
13
|
-
- uses: actions/setup-node@v1
|
|
14
|
-
with:
|
|
15
|
-
node-version: 12
|
|
16
|
-
- run: npm install -g yarn
|
|
17
|
-
- name: Install dependencies
|
|
18
|
-
run: yarn
|
|
19
|
-
- id: publish
|
|
20
|
-
uses: JS-DevTools/npm-publish@v1
|
|
21
|
-
with:
|
|
22
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name: Create Tag
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v2
|
|
13
|
-
- uses: Klemensas/action-autotag@stable
|
|
14
|
-
with:
|
|
15
|
-
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
|
16
|
-
tag_prefix: 'v'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: tests
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
test:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- name: Checkout
|
|
10
|
-
uses: actions/checkout@v1
|
|
11
|
-
|
|
12
|
-
- name: Setup Node.js
|
|
13
|
-
uses: actions/setup-node@v1
|
|
14
|
-
with:
|
|
15
|
-
node-version: 12
|
|
16
|
-
|
|
17
|
-
- name: Get yarn cache directory path
|
|
18
|
-
id: yarn-cache-dir-path
|
|
19
|
-
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
20
|
-
|
|
21
|
-
- name: Restore yarn cache
|
|
22
|
-
uses: actions/cache@v2
|
|
23
|
-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
24
|
-
with:
|
|
25
|
-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
26
|
-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
27
|
-
restore-keys: |
|
|
28
|
-
${{ runner.os }}-yarn-
|
|
29
|
-
|
|
30
|
-
- name: Install dependencies
|
|
31
|
-
run: yarn --prefer-offline
|
|
32
|
-
|
|
33
|
-
- name: Setup React Native environment
|
|
34
|
-
run: |
|
|
35
|
-
yarn add react-native@0.63.4
|
|
36
|
-
yarn add react@16.13.1
|
|
37
|
-
|
|
38
|
-
- name: Run tests
|
|
39
|
-
run: yarn test --coverage
|
|
40
|
-
|
|
41
|
-
- name: Coveralls
|
|
42
|
-
uses: coverallsapp/github-action@master
|
|
43
|
-
with:
|
|
44
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
package/babel.config.js
DELETED
package/index.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle, TextStyle, ImageSourcePropType } from 'react-native'
|
|
3
|
-
|
|
4
|
-
declare module 'react-native-toast-message' {
|
|
5
|
-
interface AnyObject {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type ToastPosition = 'top' | 'bottom'
|
|
10
|
-
|
|
11
|
-
export interface BaseToastProps {
|
|
12
|
-
leadingIcon?: ImageSourcePropType,
|
|
13
|
-
trailingIcon?: ImageSourcePropType,
|
|
14
|
-
text1?: string,
|
|
15
|
-
text2?: string,
|
|
16
|
-
onPress?: () => void,
|
|
17
|
-
onTrailingIconPress?: () => void,
|
|
18
|
-
onLeadingIconPress?: () => void,
|
|
19
|
-
style?: StyleProp<ViewStyle>,
|
|
20
|
-
leadingIconContainerStyle?: StyleProp<ViewStyle>,
|
|
21
|
-
trailingIconContainerStyle?: StyleProp<ViewStyle>,
|
|
22
|
-
leadingIconStyle?: StyleProp<ViewStyle>,
|
|
23
|
-
trailingIconStyle?: StyleProp<ViewStyle>,
|
|
24
|
-
contentContainerStyle?: StyleProp<ViewStyle>,
|
|
25
|
-
text1Style?: StyleProp<TextStyle>,
|
|
26
|
-
text2Style?: StyleProp<TextStyle>,
|
|
27
|
-
activeOpacity?: number,
|
|
28
|
-
text1NumberOfLines: number,
|
|
29
|
-
text2NumberOfLines: number,
|
|
30
|
-
}
|
|
31
|
-
export const BaseToast: React.FC<BaseToastProps>
|
|
32
|
-
|
|
33
|
-
export interface ToastProps {
|
|
34
|
-
ref: (ref: any) => any;
|
|
35
|
-
config?: AnyObject,
|
|
36
|
-
style?: StyleProp<ViewStyle>,
|
|
37
|
-
topOffset?: number,
|
|
38
|
-
bottomOffset?: number,
|
|
39
|
-
keyboardOffset?: number,
|
|
40
|
-
visibilityTime?: number,
|
|
41
|
-
autoHide?: boolean,
|
|
42
|
-
height?: number,
|
|
43
|
-
position?: ToastPosition,
|
|
44
|
-
type?: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ToastShowOptions {
|
|
48
|
-
type: string,
|
|
49
|
-
position?: ToastPosition,
|
|
50
|
-
text1?: string,
|
|
51
|
-
text2?: string,
|
|
52
|
-
visibilityTime?: number,
|
|
53
|
-
autoHide?: boolean,
|
|
54
|
-
topOffset?: number,
|
|
55
|
-
bottomOffset?: number,
|
|
56
|
-
props?: AnyObject,
|
|
57
|
-
onShow?: () => void,
|
|
58
|
-
onHide?: () => void,
|
|
59
|
-
onPress?: () => void
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default class Toast extends React.Component<ToastProps> {
|
|
63
|
-
static show(options: ToastShowOptions): void;
|
|
64
|
-
|
|
65
|
-
static hide(): void;
|
|
66
|
-
|
|
67
|
-
static setRef(ref: any): any;
|
|
68
|
-
}
|
|
69
|
-
}
|
package/index.js
DELETED
package/jest.config.js
DELETED
package/jest.setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* eslint-env jest */
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/assets/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* eslint-disable global-require */
|
|
2
|
-
|
|
3
|
-
const assets = {
|
|
4
|
-
icons: {
|
|
5
|
-
success: require('./icons/success.png'),
|
|
6
|
-
error: require('./icons/error.png'),
|
|
7
|
-
info: require('./icons/info.png'),
|
|
8
|
-
close: require('./icons/close.png')
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const { icons } = assets;
|
|
13
|
-
|
|
14
|
-
export { icons };
|
|
15
|
-
export default assets;
|
package/src/colors/index.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, TouchableOpacity, Text } from 'react-native';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import Icon from '../icon';
|
|
6
|
-
import { icons } from '../../assets';
|
|
7
|
-
import { stylePropType } from '../../utils/prop-types';
|
|
8
|
-
import styles, { HEIGHT } from './styles';
|
|
9
|
-
|
|
10
|
-
function BaseToast({
|
|
11
|
-
leadingIcon,
|
|
12
|
-
trailingIcon,
|
|
13
|
-
text1,
|
|
14
|
-
text2,
|
|
15
|
-
onPress,
|
|
16
|
-
onLeadingIconPress,
|
|
17
|
-
onTrailingIconPress,
|
|
18
|
-
style,
|
|
19
|
-
leadingIconContainerStyle,
|
|
20
|
-
trailingIconContainerStyle,
|
|
21
|
-
leadingIconStyle,
|
|
22
|
-
trailingIconStyle,
|
|
23
|
-
contentContainerStyle,
|
|
24
|
-
text1Style,
|
|
25
|
-
text2Style,
|
|
26
|
-
activeOpacity,
|
|
27
|
-
text1NumberOfLines,
|
|
28
|
-
text2NumberOfLines
|
|
29
|
-
}) {
|
|
30
|
-
return (
|
|
31
|
-
<TouchableOpacity
|
|
32
|
-
testID='rootView'
|
|
33
|
-
style={[styles.base, styles.borderLeft, style]}
|
|
34
|
-
onPress={onPress}
|
|
35
|
-
activeOpacity={onPress ? activeOpacity : 1}>
|
|
36
|
-
{leadingIcon && (
|
|
37
|
-
<TouchableOpacity
|
|
38
|
-
testID='leadingIcon'
|
|
39
|
-
style={[styles.leadingIconContainer, leadingIconContainerStyle]}
|
|
40
|
-
onPress={onLeadingIconPress}
|
|
41
|
-
activeOpacity={onLeadingIconPress ? activeOpacity : 1}>
|
|
42
|
-
<Icon
|
|
43
|
-
style={{ ...styles.leadingIcon, ...leadingIconStyle }}
|
|
44
|
-
source={leadingIcon}
|
|
45
|
-
/>
|
|
46
|
-
</TouchableOpacity>
|
|
47
|
-
)}
|
|
48
|
-
|
|
49
|
-
<View
|
|
50
|
-
testID='contentContainer'
|
|
51
|
-
style={[styles.contentContainer, contentContainerStyle]}>
|
|
52
|
-
{text1?.length > 0 && (
|
|
53
|
-
<View>
|
|
54
|
-
<Text
|
|
55
|
-
testID='text1'
|
|
56
|
-
style={[styles.text1, text1Style]}
|
|
57
|
-
numberOfLines={text1NumberOfLines}>
|
|
58
|
-
{text1}
|
|
59
|
-
</Text>
|
|
60
|
-
</View>
|
|
61
|
-
)}
|
|
62
|
-
{text2?.length > 0 && (
|
|
63
|
-
<View>
|
|
64
|
-
<Text
|
|
65
|
-
testID='text2'
|
|
66
|
-
style={[styles.text2, text2Style]}
|
|
67
|
-
numberOfLines={text2NumberOfLines}>
|
|
68
|
-
{text2}
|
|
69
|
-
</Text>
|
|
70
|
-
</View>
|
|
71
|
-
)}
|
|
72
|
-
</View>
|
|
73
|
-
|
|
74
|
-
{trailingIcon && (
|
|
75
|
-
<TouchableOpacity
|
|
76
|
-
testID='trailingIcon'
|
|
77
|
-
style={[styles.trailingIconContainer, trailingIconContainerStyle]}
|
|
78
|
-
onPress={onTrailingIconPress}
|
|
79
|
-
activeOpacity={onTrailingIconPress ? activeOpacity : 1}>
|
|
80
|
-
<Icon
|
|
81
|
-
style={{ ...styles.trailingIcon, ...trailingIconStyle }}
|
|
82
|
-
source={trailingIcon}
|
|
83
|
-
/>
|
|
84
|
-
</TouchableOpacity>
|
|
85
|
-
)}
|
|
86
|
-
</TouchableOpacity>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
BaseToast.HEIGHT = HEIGHT;
|
|
91
|
-
|
|
92
|
-
BaseToast.propTypes = {
|
|
93
|
-
leadingIcon: Icon.propTypes.source,
|
|
94
|
-
trailingIcon: Icon.propTypes.source,
|
|
95
|
-
text1: PropTypes.string,
|
|
96
|
-
text2: PropTypes.string,
|
|
97
|
-
onPress: PropTypes.func,
|
|
98
|
-
onTrailingIconPress: PropTypes.func,
|
|
99
|
-
onLeadingIconPress: PropTypes.func,
|
|
100
|
-
style: stylePropType,
|
|
101
|
-
leadingIconContainerStyle: stylePropType,
|
|
102
|
-
trailingIconContainerStyle: stylePropType,
|
|
103
|
-
leadingIconStyle: stylePropType,
|
|
104
|
-
trailingIconStyle: stylePropType,
|
|
105
|
-
contentContainerStyle: stylePropType,
|
|
106
|
-
text1Style: stylePropType,
|
|
107
|
-
text2Style: stylePropType,
|
|
108
|
-
activeOpacity: PropTypes.number,
|
|
109
|
-
text1NumberOfLines: PropTypes.number,
|
|
110
|
-
text2NumberOfLines: PropTypes.number
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
BaseToast.defaultProps = {
|
|
114
|
-
leadingIcon: undefined,
|
|
115
|
-
trailingIcon: icons.close,
|
|
116
|
-
text1: undefined,
|
|
117
|
-
text2: undefined,
|
|
118
|
-
onPress: undefined,
|
|
119
|
-
onLeadingIconPress: undefined,
|
|
120
|
-
onTrailingIconPress: undefined,
|
|
121
|
-
style: undefined,
|
|
122
|
-
leadingIconContainerStyle: undefined,
|
|
123
|
-
trailingIconContainerStyle: undefined,
|
|
124
|
-
leadingIconStyle: undefined,
|
|
125
|
-
trailingIconStyle: undefined,
|
|
126
|
-
contentContainerStyle: undefined,
|
|
127
|
-
text1Style: undefined,
|
|
128
|
-
text2Style: undefined,
|
|
129
|
-
activeOpacity: 0.8,
|
|
130
|
-
text1NumberOfLines: 1,
|
|
131
|
-
text2NumberOfLines: 2
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export default BaseToast;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import colors from '../../colors';
|
|
3
|
-
|
|
4
|
-
export const HEIGHT = 60;
|
|
5
|
-
|
|
6
|
-
export default StyleSheet.create({
|
|
7
|
-
base: {
|
|
8
|
-
flexDirection: 'row',
|
|
9
|
-
height: HEIGHT,
|
|
10
|
-
width: '90%',
|
|
11
|
-
borderRadius: 6,
|
|
12
|
-
backgroundColor: colors.white,
|
|
13
|
-
shadowOffset: { width: 0, height: 0 },
|
|
14
|
-
shadowOpacity: 0.1,
|
|
15
|
-
shadowRadius: 6,
|
|
16
|
-
elevation: 2
|
|
17
|
-
},
|
|
18
|
-
borderLeft: {
|
|
19
|
-
borderLeftWidth: 5,
|
|
20
|
-
borderLeftColor: colors.alto
|
|
21
|
-
},
|
|
22
|
-
leadingIconContainer: {
|
|
23
|
-
width: 50,
|
|
24
|
-
justifyContent: 'center',
|
|
25
|
-
alignItems: 'center'
|
|
26
|
-
},
|
|
27
|
-
contentContainer: {
|
|
28
|
-
flex: 1,
|
|
29
|
-
justifyContent: 'center',
|
|
30
|
-
alignItems: 'flex-start' // in case of rtl the text will start from the right
|
|
31
|
-
},
|
|
32
|
-
trailingIconContainer: {
|
|
33
|
-
width: 40,
|
|
34
|
-
justifyContent: 'center',
|
|
35
|
-
alignItems: 'center'
|
|
36
|
-
},
|
|
37
|
-
leadingIcon: {
|
|
38
|
-
width: 20,
|
|
39
|
-
height: 20
|
|
40
|
-
},
|
|
41
|
-
trailingIcon: {
|
|
42
|
-
width: 9,
|
|
43
|
-
height: 9
|
|
44
|
-
},
|
|
45
|
-
text1: {
|
|
46
|
-
fontSize: 12,
|
|
47
|
-
fontWeight: 'bold',
|
|
48
|
-
marginBottom: 3
|
|
49
|
-
},
|
|
50
|
-
text2: {
|
|
51
|
-
fontSize: 10,
|
|
52
|
-
color: colors.dustyGray
|
|
53
|
-
}
|
|
54
|
-
});
|
package/src/components/error.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import BaseToast from './base';
|
|
4
|
-
import { icons } from '../assets';
|
|
5
|
-
import colors from '../colors';
|
|
6
|
-
|
|
7
|
-
function ErrorToast(props) {
|
|
8
|
-
return (
|
|
9
|
-
<BaseToast
|
|
10
|
-
{...props}
|
|
11
|
-
style={{ borderLeftColor: colors.blazeOrange }}
|
|
12
|
-
leadingIcon={icons.error}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
ErrorToast.propTypes = BaseToast.propTypes;
|
|
18
|
-
|
|
19
|
-
export default ErrorToast;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Image } from 'react-native';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import { stylePropType } from '../../utils/prop-types';
|
|
6
|
-
import styles from './styles';
|
|
7
|
-
|
|
8
|
-
function Icon({ source, style }) {
|
|
9
|
-
if (!source) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Image
|
|
15
|
-
testID='icon'
|
|
16
|
-
source={source}
|
|
17
|
-
style={[styles.base, style]}
|
|
18
|
-
resizeMode='contain'
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const imageSourcePropType = PropTypes.oneOfType([
|
|
24
|
-
PropTypes.number,
|
|
25
|
-
PropTypes.shape({
|
|
26
|
-
uri: PropTypes.string
|
|
27
|
-
})
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
Icon.propTypes = {
|
|
31
|
-
source: imageSourcePropType,
|
|
32
|
-
style: stylePropType
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
Icon.defaultProps = {
|
|
36
|
-
source: undefined,
|
|
37
|
-
style: undefined
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default Icon;
|