Skip to content

Commit 82ca8b4

Browse files
committed
Timeline: Props are transferring without a problem. README is updated
1 parent 31834ef commit 82ca8b4

30 files changed

+233
-33
lines changed

README.md

Lines changed: 76 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)
1212

1313
<p align="center">
14+
<img alt="React Native Beautiful Timeline"
15+
src="assets/Screenshots/example.gif" />
1416
<img alt="React Native Beautiful Timeline"
1517
src="assets/Screenshots/example.png" />
1618
</p>
@@ -43,29 +45,89 @@ npm i react-native-beautiful-timeline
4345
import Timeline from "react-native-beautiful-timeline";
4446
```
4547

46-
## Component1 Usage
48+
## Basic Usage
49+
50+
### Data Format
51+
52+
The data format MUST like this example.
53+
54+
```json
55+
[
56+
{
57+
"date": 1574342522000,
58+
"data": [
59+
{
60+
"title": "React Native Beautiful Timeline",
61+
"subtitle": "Sed at justo eros. Phasellus.",
62+
"date": 1574342522000
63+
},
64+
{
65+
"title": "React Native",
66+
"subtitle": "Sed viverra. Nam sagittis.",
67+
"date": 1574342501000
68+
}
69+
]
70+
},
71+
{
72+
"date": 1574248261000,
73+
"data": [
74+
{
75+
"title": "Timeline",
76+
"subtitle": "Morbi magna orci, consequat in.",
77+
"date": 1574248261000
78+
}
79+
]
80+
},
81+
{
82+
"date": 1574125621000,
83+
"data": [
84+
{
85+
"title": "Beauty Timeline",
86+
"subtitle": "Nulla a eleifend urna. Morbi. Praesent.",
87+
"date": 1574125621000
88+
}
89+
]
90+
}
91+
]
92+
```
4793

48-
```jsx
49-
<Timeline />
94+
#### Let's take a look a bit closer:
95+
96+
For each day & there would be limitless objects(Cards) for each day something like this example:
97+
Each card comes from `data` array and each **day** comes from each `object` from main array.
98+
99+
```json
100+
{
101+
"date": 1574342522000,
102+
"data": [
103+
{
104+
"title": "React Native Beautiful Timeline",
105+
"subtitle": "Sed at justo eros. Phasellus.",
106+
"date": 1574342522000
107+
},
108+
{
109+
"title": "React Native",
110+
"subtitle": "Sed viverra. Nam sagittis.",
111+
"date": 1574342501000
112+
}
113+
]
114+
}
50115
```
51116

52-
# Configuration - Props
117+
## Basic Usage
53118

54-
WORK IN PROGRESS
119+
Please take a look at above data formatting. Library itself solves everything for you if the data format is correct.
55120

56-
<!-- | Property | Type | Default | Description |
57-
| -------- | :-----: | :-----: | ------------------------------------------------------- |
58-
| outline | boolean | true | make the button outline |
59-
| solid | boolean | false | make the button with a solid background and a shadow |
60-
| gradient | boolean | false | make the button with a gradient background and a shadow |
61-
| width | number | 150 | change the button's width | -->
121+
```jsx
122+
<Timeline data={data} />
123+
```
62124

63125
## Future Plans
64126

65127
- [x] ~~LICENSE~~
66-
- [ ] README: Better Example Image
67-
- [ ] README: GIF Asset
68-
- [ ] README: Configuration
128+
- [x] ~~README: Better Example Image~~
129+
- [x] ~~README: GIF Asset~~
130+
- [x] ~~README: Data Formatting~~
69131
- [ ] Write an article about the lib on Medium
70132

71133
## Author

assets/Screenshots/example.gif

1.77 MB
Loading

assets/Screenshots/example.png

189 KB
Loading

example/App.js

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
StatusBar
99
} from "react-native";
1010
import Timeline from "./lib/src/Timeline";
11+
import { ModernHeader } from "@freakycoder/react-native-header-view";
1112
import { ScreenHeight } from "@freakycoder/react-native-helpers";
1213

1314
const dummyData = [
@@ -45,6 +46,27 @@ const dummyData = [
4546
date: 1574125621000
4647
}
4748
]
49+
},
50+
{
51+
date: 1574125621000,
52+
data: [
53+
{
54+
title: "Timeline Title",
55+
subtitle: "Ut viverra. Nunc interdum.",
56+
date: 1574125621000
57+
}
58+
]
59+
},
60+
{
61+
date: 1574125621000,
62+
data: [
63+
{
64+
title: "In imperdiet.",
65+
subtitle:
66+
"Etiam at libero eu lacus.Proin pellentesque tempus neque, quis.",
67+
date: 1574125621000
68+
}
69+
]
4870
}
4971
];
5072

@@ -53,7 +75,32 @@ const App = () => {
5375
<>
5476
<StatusBar barStyle="dark-content" />
5577
<SafeAreaView style={{ flex: 1, backgroundColor: "#fdfdfd" }}>
56-
<Timeline data={dummyData} />
78+
<ModernHeader
79+
backgroundColor="#fdfdfd"
80+
text="November 2019"
81+
rightIconName="dots-vertical"
82+
textStyle={{
83+
color: "#566184",
84+
fontFamily: "Alata-Regular"
85+
}}
86+
rightIconType="MaterialCommunityIcons"
87+
rightIconColor="#984cf8"
88+
leftIconName="arrowleft"
89+
leftIconType="AntDesign"
90+
leftIconColor="#984cf8"
91+
/>
92+
<Timeline
93+
data={dummyData}
94+
dayFontFamily="Alata-Regular"
95+
dateFontFamily="Alata-Regular"
96+
titleFontFamily="Alata-Regular"
97+
monthFontFamily="Alata-Regular"
98+
subtitleFontFamily="Alata-Regular"
99+
/>
100+
101+
<View style={{ height: 100, width: 300 }}>
102+
<View style={{ height: "10%", width: "10%" }} />
103+
</View>
57104
</SafeAreaView>
58105
</>
59106
);
68.7 KB
Binary file not shown.
64 KB
Binary file not shown.
13.1 KB
Binary file not shown.
56.9 KB
Binary file not shown.
162 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)