@tactics/toddle-styleguide 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -1,7 +1,7 @@
1
1
  export function Stylesheet(context: any): {
2
- container: {
3
- alignItems: 'center';
4
- justifyContent: 'center';
5
- height: number;
6
- };
2
+ container: {
3
+ alignItems: "center";
4
+ justifyContent: "center";
5
+ height: number;
6
+ };
7
7
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  declare type SwipeProps = {
3
3
  children: React.ReactNode;
4
+ onIndexChanged?: (index: number) => void;
4
5
  };
5
- declare const Swipe: ({ children }: SwipeProps) => JSX.Element;
6
+ declare const Swipe: ({ children, onIndexChanged }: SwipeProps) => JSX.Element;
6
7
  export { Swipe as Swipe };
@@ -2,28 +2,28 @@ import React, {Children, useContext} from 'react';
2
2
  import {ThemeCtx} from '../../../context/theme.context';
3
3
  import Swiper from 'react-native-swiper';
4
4
  import {View} from 'react-native';
5
- import {Button} from '../button/button.component';
6
5
  import {Stylesheet} from './Swipe.styles';
7
6
  import {ChevronLeftIcon} from '../../../icons/outline/chevron-left/chevron-left.icon';
8
7
  import {ChevronRightIcon} from '../../../icons/outline/chevron-right/chevron-right.icon';
9
- import {Pill} from '../pill/pill.component';
10
8
 
11
9
  type SwipeProps = {
12
10
  children: React.ReactNode;
11
+ onIndexChanged?: (index: number) => void;
13
12
  };
14
13
 
15
- const Swipe = ({children}: SwipeProps) => {
14
+ const Swipe = ({children, onIndexChanged}: SwipeProps) => {
16
15
  const context = useContext(ThemeCtx);
17
16
  const styles = Stylesheet(context);
18
17
  const count = Children.count(children);
19
18
 
20
19
  if (count > 5) {
21
- console.warn(' for more then 5 children, use another way to show');
20
+ console.warn(' for more then 5 child-components, use another way to show');
22
21
  }
23
22
 
24
23
  return (
25
24
  <View style={styles.container}>
26
25
  <Swiper
26
+ onIndexChanged={onIndexChanged}
27
27
  paginationStyle={{bottom: 0}}
28
28
  showsButtons={true}
29
29
  dotColor={context.colors.ui.lightgrey}
@@ -8,7 +8,7 @@ import {VisualState} from '../../../types/visual-state.enum';
8
8
  export const SwipePreview = ({}: {}) => {
9
9
  return (
10
10
  <View>
11
- <Swipe>
11
+ <Swipe onIndexChanged={(index) => console.log(index)}>
12
12
  <View
13
13
  style={{
14
14
  marginRight: 15,