diff --git a/README.md b/README.md index 90b54fc..8d89a11 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,54 @@ React Native Tipsi custom UI elements ## Components +### `` + +Customizable colored tabs. + +#### ColoredTabs Props + +| 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 + +| 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' + +class Example extends PureComponent { + handlePress = id => console.log(`Tab with id ${id} is clicked!`) + + const Example = () => ( + + + + + + + ) +} +``` + +#### 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) + ### `` Component to draw customisable dashed lines diff --git a/__tests__/e2e/09_FileTabs.test.js b/__tests__/e2e/09_FileTabs.test.js new file mode 100644 index 0000000..f332662 --- /dev/null +++ b/__tests__/e2e/09_FileTabs.test.js @@ -0,0 +1,46 @@ +import test from 'tape-async' +import helper from 'tipsi-appium-helper' + +const { driver, select, idFromXPath } = helper + +test('', 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('') + + 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(' example should be visible') + } catch (error) { + await helper.screenshot() + await helper.source() + + throw error + } +}) diff --git a/__tests__/unit/__snapshots__/Storyshots.test.js.snap b/__tests__/unit/__snapshots__/Storyshots.test.js.snap index 10cb5bd..8005e41 100644 --- a/__tests__/unit/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/unit/__snapshots__/Storyshots.test.js.snap @@ -3112,6 +3112,911 @@ exports[`UIExplorer components Thickness of each dash - Prop: dashThick style={undefined} /> `; +exports[`UIExplorer components Simple example - Props: color 1`] = ` + + + + Red + + + + + Orange + + + + + Green + + + + + Blue + + + +`; + +exports[`UIExplorer components Simple example 2 - Props: default 1`] = ` + + + + Left + + + + + Center + + + + + Right + + + +`; + +exports[`UIExplorer components Simple example 3 - Props: theme 1`] = ` + + + + One + + + + + Two + + + + + Three + + + + + Four + + + +`; + +exports[`UIExplorer components Simple example 4 - Props: onPress 1`] = ` + + + + One + + + + + Two + + + + + Three + + + + + Four + + + +`; + exports[`UIExplorer components