-
Notifications
You must be signed in to change notification settings - Fork 7
<FileTabs /> #8
base: master
Are you sure you want to change the base?
<FileTabs /> #8
Changes from all commits
12cc28f
7395dc6
aadc6f9
dc55d6e
de41acf
a03438a
72fe6a5
a3c8461
bb5f175
862c7a7
2fc4eb3
59535c6
1545afa
8e02f8b
15a4280
e30ef36
43d17b6
a7d8959
b45bf95
47fbda7
70ae34c
e77882d
a3805fc
33e2cb1
f2ecbe5
39a8739
b21df44
2932729
65c89a5
4b06aea
b128c4b
dfe1c47
9565047
539700d
c9e24e7
a63c737
00a6a34
50d3316
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,54 @@ React Native Tipsi custom UI elements | |
|
||
## Components | ||
|
||
### `<ColoredTabs />` | ||
|
||
Customizable colored tabs. | ||
|
||
#### ColoredTabs Props | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileTabs |
||
|
||
| Name | Desc | Type | Default | ||
| --- | --- | --- | --- | | ||
| `selected` | id of selected tab. | String | `first tab` | ||
| `onPress` | Handle press on tab action. Receive id of selected tab as argument. | Function | `() => {}` | ||
|
||
|
||
#### ColoredTabs.Item Props | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileTabs |
||
|
||
| Name | Desc | Type | Default | ||
| --- | --- | --- | --- | | ||
| `title` | Text of tab. | String | `undefined` | ||
| `color` | Color of tab | String | `#82909d` | ||
| `id` | Tab id. This id will passed to `onPress` for identify action. | String | `undefined` | ||
| `active` | Show item as active | Boolean | `false` | ||
| `onPress` | Handle press action | Function | `() => {}` | ||
|
||
#### Example | ||
|
||
|
||
```js | ||
import React, { PureComponent } from 'react' | ||
import { ColoredTabs } from 'tipsi-ui-kit' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileTabs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileTabs |
||
|
||
class Example extends PureComponent { | ||
handlePress = id => console.log(`Tab with id ${id} is clicked!`) | ||
|
||
const Example = () => ( | ||
<ColoredTabs onPress={this.handlePress}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileTabs |
||
<ColoredTabs.Item id="0" title="One" color="crimson" /> | ||
<ColoredTabs.Item id="1" title="Two" color="orange" /> | ||
<ColoredTabs.Item id="2" title="Three" color="chartreuse" /> | ||
<ColoredTabs.Item id="3" title="Four" color="dodgerblue" /> | ||
</ColoredTabs> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileTabs |
||
) | ||
} | ||
``` | ||
|
||
#### Preview | ||
|
||
![tabs_ios](https://cloud.githubusercontent.com/assets/4946753/22029399/1f3905c2-dce3-11e6-8c83-5142fdeb4351.png) | ||
![tabs_android](https://cloud.githubusercontent.com/assets/4946753/22029396/1af713e6-dce3-11e6-8f1a-64e4706bf581.png) | ||
|
||
### `<Dash />` | ||
|
||
Component to draw customisable dashed lines | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import test from 'tape-async' | ||
import helper from 'tipsi-appium-helper' | ||
|
||
const { driver, select, idFromXPath } = helper | ||
|
||
test('<FileTabs />', async (t) => { | ||
const tabsGroupId = select({ | ||
ios: idFromXPath(`// | ||
XCUIElementTypeScrollView[1]/*/*/ | ||
XCUIElementTypeOther[2]/XCUIElementTypeOther[1] | ||
`), | ||
android: idFromXPath(`// | ||
android.widget.ScrollView[1]/android.view.View[1]/android.view.View[1] | ||
`), | ||
}) | ||
const tagItemId = select({ | ||
ios: idFromXPath(` | ||
${tabsGroupId}/XCUIElementTypeOther[tabId] | ||
`), | ||
android: idFromXPath(` | ||
${tabsGroupId}/android.view.View[tabId] | ||
`), | ||
}) | ||
|
||
try { | ||
await helper.openExampleFor('<FileTabs />') | ||
|
||
for (const tabId of [1, 2, 3, 4]) { | ||
const currentTabId = select({ | ||
ios: tagItemId.replace('tabId', tabId), | ||
android: tagItemId.replace('tabId', tabId + 1), | ||
}) | ||
await driver.waitForVisible(currentTabId, 20000) | ||
await driver.click(currentTabId) | ||
|
||
t.pass(`tab ${tabId} clicked`) | ||
} | ||
|
||
t.pass('<FileTabs /> example should be visible') | ||
} catch (error) { | ||
await helper.screenshot() | ||
await helper.source() | ||
|
||
throw error | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.