Skip to content

Commit 8a89c50

Browse files
committed
center axe arrow in rectangle
1 parent ad2d710 commit 8a89c50

File tree

4 files changed

+156
-99
lines changed

4 files changed

+156
-99
lines changed

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ expo install react-native-svg
2727
## Usage
2828

2929
```tsx
30-
import { ArrowFollow } from "react-native-arrow-follow";
30+
import { ArrowFollow, CORNER, POSITION } from "react-native-arrow-follow";
3131

3232
// ...
3333

@@ -37,12 +37,12 @@ import { ArrowFollow } from "react-native-arrow-follow";
3737
color={"#000000"}
3838
size={14}
3939
start={{
40-
corner: 'TOP_RIGHT',
41-
direction: 'HORIZONTAL'
40+
corner: CORNER.TOP_RIGHT,
41+
direction: POSITION.HORIZONTAL
4242
}}
4343
end={{
44-
corner: 'BOTTOM_LEFT',
45-
direction: 'HORIZONTAL'
44+
corner: CORNER.BOTTOM_LEFT,
45+
direction: POSITION.HORIZONTAL
4646
}}
4747
/>
4848

@@ -60,8 +60,8 @@ A React node that will be most likely wrapping your whole app.
6060
| width | width rectangle | * | | number |
6161
| size | size line | | 12 | number |
6262
| color | color code | | #000000 | string |
63-
| start | start arrow | * | | {corner:ICorner, direction: POSITION} |
64-
| end | end arrow | * | | {corner:ICorner, direction: POSITION} |
63+
| start | start arrow | * | | {corner:CORNER, direction: POSITION} |
64+
| end | end arrow | * | | {corner:CORNER, direction: POSITION} |
6565

6666

6767
```ts
@@ -70,23 +70,25 @@ type IProps = {
7070
width: number;
7171
size?: number;
7272
color?: string;
73-
start: { corner: ICorner; direction: POSITION | keyof typeof POSITION };
74-
end: { corner: ICorner; direction: POSITION | keyof typeof POSITION };
73+
start: {
74+
corner: CORNER | keyof typeof CORNER;
75+
direction: POSITION | keyof typeof POSITION
76+
};
77+
end: {
78+
corner: CORNER | keyof typeof CORNER;
79+
direction: POSITION | keyof typeof POSITION
80+
};
7581
};
7682
enum POSITION {
7783
HORIZONTAL = 'HORIZONTAL',
7884
VERTICAL = 'VERTICAL',
7985
}
80-
enum HORIZONTAL {
81-
LEFT = 'LEFT',
82-
RIGHT = 'RIGHT',
86+
enum CORNER {
87+
TOP_LEFT = 'TOP_LEFT',
88+
TOP_RIGHT = 'TOP_RIGHT',
89+
BOTTOM_TOP = 'BOTTOM_TOP',
90+
BOTTOM_BOTTOM = 'BOTTOM_BOTTOM',
8391
}
84-
enum VERTICAL {
85-
TOP = 'TOP',
86-
BOTTOM = 'BOTTOM',
87-
}
88-
89-
export type ICorner = `${VERTICAL}_${HORIZONTAL}`;
9092
```
9193

9294
## Contributing

example/src/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import * as React from 'react';
22
import { Dimensions, FlatList, SafeAreaView, StyleSheet, Text, View } from 'react-native';
3-
import { ArrowFollow, ICorner, POSITION } from 'react-native-arrow-follow';
3+
import { ArrowFollow, ICorner, IDirection } from 'react-native-arrow-follow';
44

55
type IData = {
6-
start: { corner: ICorner; direction: POSITION | keyof typeof POSITION };
7-
end: { corner: ICorner; direction: POSITION | keyof typeof POSITION };
6+
start: { corner: ICorner; direction: IDirection };
7+
end: { corner: ICorner; direction: IDirection };
88
}[];
99

1010
const widthCard = Dimensions.get('window').width / 2;
1111

1212
const DATA: IData = [
1313
//Type A
14-
1514
{
1615
start: { corner: 'BOTTOM_LEFT', direction: 'HORIZONTAL' },
1716
end: { corner: 'BOTTOM_RIGHT', direction: 'HORIZONTAL' },
@@ -231,8 +230,8 @@ const styles = StyleSheet.create({
231230
},
232231
arrowContainer: {
233232
alignSelf: 'center',
234-
//borderColor: '#000',
235-
//borderWidth: 1,
233+
// borderColor: '#000',
234+
// borderWidth: 1,
236235
},
237236
title: {
238237
marginTop: 12,

0 commit comments

Comments
 (0)