From 66c469683d2388867ec702603c6a119b4309f0c7 Mon Sep 17 00:00:00 2001 From: wenzel Date: Tue, 23 Oct 2018 17:08:01 -0700 Subject: [PATCH 1/2] add indexer --- .DS_Store | Bin 0 -> 10244 bytes src/index.js | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2517e25f7ada5ade1ad394063d1fd8eeabac7e15 GIT binary patch literal 10244 zcmeHMTX57=829QG9T`;iGut#qle>wj- zU%r#LRD=kG2!sfP z2!sfP2;3|P&^MbELECZ3qZ1h)PAA5%qk?+ zK*j<&&Lvr>AP*(ULowK5AP*R) zfyoH4y?X_$gh4RDE7`wS&v~ZUmUgBRT)Tk6j`E)QK z4Ngfuytt^?R-EtJPv_c7Z8!2ww3Xz;Yb>8Y*^Yol88cu}-7U!rUh`Bw6Y`Hw?Nc(2 zDSb-D1FupyP!29+A(b3$DN$5yM8|j zZV&`f6bIzS(b3lSbuH@MZDTF!=-Rc>7IpQiHDhC<(72>^!?wfek)xx>#vVP%hEFfo z;3W)<1;ynBY6P<@#kl)yk;Tn-@_CoNR+#tY!o0;QNvf8%Y~3<a0ldCmq6H-a_pY0k*5jwr5r1lw#ibL(yUaDoQ)34N|;BvcPi^xR*&PFp6S?o z`#s}`$84;l5>x*^*U5UFerNqA_0PTPS&p3<7VPdZvMxzcJYCZmS-fQVJ*)5C5I6%H)*gb6O-q2pnO&PXs+JpNDXxlR%GL5WQhb>~St)-3g^>SV9y!ndK zpG%sL(ZQL zO%Q#}iWW)geVCrO?223yZIzVWmX-Qz}N5tT!Jfb6@G=^;Scx=5vyh(wmmKmulD(y{+N)xsB?Qp? zWJWN-Z!T?)NHWp_5dG$gX0n!%jdd(VBW)tlTrT&Uk#=dVK!lbnxplpCpGcIKE4X!& zM7-TD%Cr2AIu}Zk4D_~}fub`K^h@|2ekOAM4gX*z5wo61sS+Vq;yT<&gp6Y+ZpH_Q zlDja0y?C&QmNq(=!4W))$8e0u`2>;k1U`jNegQO`e4Q35Xh(L%y zh(L%yh(L(IEsa1qAHB-X|2I$n|NkvL$8hi=0wDr3BY+iMiLN;LO!qsVowciU9j1#F z<~PozA3`_(IG&_`98V2)9Pb|hkS^H&`*AVSv-oi?sYc~L|1%)m|A+g3fXPQx|D*l? Ezu(~ZBLDyZ literal 0 HcmV?d00001 diff --git a/src/index.js b/src/index.js index abf9a84..f848b1c 100755 --- a/src/index.js +++ b/src/index.js @@ -47,6 +47,7 @@ class Onboarding extends Component { return; this.setState(state => { + this.props.givePageIndex(viewableItems[0].index); return { previousPage: state.currentPage, currentPage: viewableItems[0].index, @@ -109,6 +110,7 @@ class Onboarding extends Component { DotComponent, flatlistProps, skipToPage, + givePageIndex, } = this.props; const currentPage = pages[this.state.currentPage]; const currentBackgroundColor = currentPage.backgroundColor; @@ -231,6 +233,7 @@ Onboarding.propTypes = { subTitleStyles: Text.propTypes.style, transitionAnimationDuration: PropTypes.number, skipToPage: PropTypes.number, + givePageIndex: PropTypes.func, }; Onboarding.defaultProps = { @@ -255,6 +258,7 @@ Onboarding.defaultProps = { subTitleStyles: null, transitionAnimationDuration: 500, skipToPage: null, + givePageIndex: null, }; const styles = { From b8713c1ce517aafc36a34de556720debdf3d6983 Mon Sep 17 00:00:00 2001 From: wenzel Date: Wed, 24 Oct 2018 16:29:32 -0700 Subject: [PATCH 2/2] update readme with function --- .DS_Store | Bin 10244 -> 10244 bytes README.md | 1 + 2 files changed, 1 insertion(+) diff --git a/.DS_Store b/.DS_Store index 2517e25f7ada5ade1ad394063d1fd8eeabac7e15..c57bab16270f6f10c96a6d093b068e73b36de046 100644 GIT binary patch literal 10244 zcmeHMTWl0n826pBT*rR5^+?9SMZ%+4%3vu&Z2 z)Tl8;c~tA=0TYcu^bJ9y4@RRB;6<%L@x>Tk6%z5m_@MupGh24Htq(plB+g0Z{AbR8 zng4v}J2QLE0suCp)Ea;g00?w3DN9t%P?(-w(@Kul6C#P^51@ky4kR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U$=2@cV1ip@M;G6gkzUxx-0$#*Rco{#!kMVQ7hLc(J+?_?w@9)vm z|H;0(BU6+4q0ZF!KhK}B;2znBB1zM*%mM02FAb&*N`OFsK!8Aiz?>nF%byft=l`v< z|NlQ{`2-IN5C{;Mdjv4ACDPJF&z^R=t hr%|7`O>_Oi)X)6Kxuh1AIsY>t*#8In|Nr^^{~u4DqwoL# delta 1301 zcmeH^TS!z<6o%Jt+MLr)-80TO<94#?rln?TStgaFMx~WziqgdxonsstXVf_(8O1~t zU5rRhSQOPm(7hnct}oGzqKGbn*<17)MVE)@rS^=_<)z1-dfBl4f97Fnpd&aD}^UDU4xz)z(%)IEB5wUS=vMWu9#&EOV z5!Q`vK1oqVIx>Vud>01x(cYz0I1R`&4DnRweHh&1RyZOY02j!2qv{s!}YmGtnqv zwrK$)B(>B`tmYw$f$1D0>5@LPo++aaF9adD4)uxlA5TUx~Yfy=mcG% z0lG?e=rO&dVR}pN=>vVD&-4|*7>q?ClHi030_m8F0u*8g`#A>XE7tLsa zADu7|Mi(O3g+17d9vs9m9LEWyoxxe0#|7NNJ>16wJi~Lm##_8ITb-3Z)5`oyS`Jkm zPKtgv#qLOTdZuLO%`Bc@X12QOB*qeS-!hal?m}tvC>_{<|r}?o-pE;uz9LXi^q?+rA!j9Qu*lE zpz?8yaWZSuG9rJa{D@xA8%g*ZeMf?%Ym;O>l4>4`u|QHSLpc^VMBM1h+ZyBg SEuL@jiU0ZkWBz7>X!rqqEjiTy diff --git a/README.md b/README.md index 4d2963e..1818435 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ Also check out the three examples files: the [simple example](examples/Simple.js * `flatlistProps` (optional): additional props for the [FlatList](https://facebook.github.io/react-native/docs/flatlist.html) which holds all the pages. * `transitionAnimationDuration` (optional): The duration in milliseconds for the animation of the background color for the page transition. Defaults to `500`. * `allowFontScaling` (optional): Font scaling can cause troubles with high-resolution screens. You may want to disable it. Defaults to `true`. +* `givePageIndex` (optional): a function that receives the page `index` as a parameter. ## Custom Components Properties