55 Image ,
66 SectionList ,
77 ActivityIndicator ,
8+ LayoutAnimation ,
89 } from 'react-native' ;
910import Swiper from 'react-native-swiper' ;
1011import Search from 'react-native-search-box' ;
@@ -16,6 +17,7 @@ import ContactCell from './contactCell';
1617import screens from 'App/constants/screens' ;
1718import { getWidth , getHeight } from 'App/utils/dimension' ;
1819import style , { AVATAR_SIZE , STICKY_HEADER_HEIGHT , DOT_MARGIN , PARALLAX_HEADER_HEIGHT } from './styles' ;
20+ import { setInterval } from 'core-js/library/web/timers' ;
1921
2022const DEPARTMENT_LIST = [ {
2123 name : 'iOS' ,
@@ -64,7 +66,24 @@ const DEPARTMENT_LIST = [{
6466 }
6567 }
6668
69+ // _animateOnMount = () => {
70+ // LayoutAnimation.configureNext({
71+ // duration: 700,
72+ // create: {
73+ // type: LayoutAnimation.Types.linear,
74+ // property: LayoutAnimation.Properties.opacity,
75+ // },
76+ // update: {
77+ // type: LayoutAnimation.Types.spring,
78+ // springDamping: 0.75,
79+ // },
80+ // });
81+ // }
82+
6783 componentDidMount ( ) {
84+ // this._animateOnMount();
85+ LayoutAnimation . configureNext ( LayoutAnimation . Presets . spring ) ;
86+
6887 this . props . employees ? null : this . props . fetchEmployees ( )
6988 }
7089
@@ -85,30 +104,31 @@ const DEPARTMENT_LIST = [{
85104 }
86105
87106 _onCellSelection = ( ) => {
88- this . props . navigator . push ( {
89- screen : screens . PROFILE_SCREEN . id ,
90- animated : true ,
91- overrideBackPress : true ,
92- navigatorStyle : {
93- drawUnderNavBar : true ,
94- navBarTranslucent : true ,
95- navBarTransparent : true ,
96- navBarTextColor : 'white' ,
97- navBarTransparency : 1 ,
98- navBarButtonColor : 'white' ,
99- navBarLeftButtonColor : 'white' ,
100- navBarRightButtonColor : 'white' ,
101- } ,
102- title : '' ,
103- passProps : {
104- data : {
105- department : DEPARTMENT_LIST [ this . state . currentSwipeIndex ]
106- }
107- }
108- } ) ;
107+ // this.props.navigator.push({
108+ // screen: screens.PROFILE_SCREEN.id,
109+ // animated: true,
110+ // overrideBackPress: true,
111+ // navigatorStyle: {
112+ // drawUnderNavBar: true,
113+ // navBarTranslucent: true,
114+ // navBarTransparent: true,
115+ // navBarTextColor: 'white',
116+ // navBarTransparency: 1,
117+ // navBarButtonColor: 'white',
118+ // navBarLeftButtonColor: 'white',
119+ // navBarRightButtonColor: 'white',
120+ // },
121+ // title: '',
122+ // passProps: {
123+ // data: {
124+ // department: DEPARTMENT_LIST[this.state.currentSwipeIndex]
125+ // }
126+ // }
127+ // });
109128 }
110129
111130 _renderParallaxTableHeaderView = ( data , index ) => {
131+ // return (<View style={{width: 200, height: 200}}>asd</View>)
112132 return (
113133 < ParallaxScrollView
114134 onScroll = { this . props . onScroll }
@@ -129,7 +149,7 @@ const DEPARTMENT_LIST = [{
129149 < Image style = { style . avatar } source = { { uri : 'https://pbs.twimg.com/profile_images/2694242404/5b0619220a92d391534b0cd89bf5adc1_400x400.jpeg' } } />
130150 < Text style = { style . sectionSpeakerText } >
131151 {
132- DEPARTMENT_LIST [ index ] . name
152+ // DEPARTMENT_LIST[index].name
133153 }
134154 </ Text >
135155 < Text style = { style . sectionTitleText } >
@@ -140,34 +160,31 @@ const DEPARTMENT_LIST = [{
140160
141161 renderStickyHeader = { ( ) => (
142162 < View key = "sticky-header" style = { style . stickySection } >
143- < Text style = { style . stickySectionText } > { DEPARTMENT_LIST [ index ] . name } </ Text >
163+ < Text style = { style . stickySectionText } > aaa </ Text >
144164 </ View >
145165 ) }
146166 />
147167 ) ;
148168 }
149169
150- _renderTableView = ( data , index ) => {
170+ _renderTableView = ( employees , index ) => {
171+ const { onScroll = ( ) => { } } = this . props ;
151172 return (
152173 < SectionList
153174 ref = "ListView"
154- key = { data }
155- sections = { [
156- { title : 'D' , data : [ 'Devin' ] } ,
157- { title : 'J' , data : [ 'Jackson' , 'James' , 'Jillian' , 'Jimmy' , 'Joel' , 'John' , 'Julie' ] } ,
158- ] }
175+ key = { index }
176+ sections = { util . groupByAlphabets ( employees . data ) }
159177 keyExtractor = { ( item , index ) => index }
160- renderItem = { ( { item, section , index } ) =>
178+ renderItem = { ( { item} ) =>
161179 < ContactCell
162- index = { index }
163- section = { section }
180+ { ...this . props }
164181 data = { item }
165182 onPress = { this . _onCellSelection } />
166183 }
167184 renderSectionHeader = { ( { section} ) => < Text style = { style . sectionHeader } > { section . title } </ Text > }
168- renderScrollComponent = { props => (
169- this . _renderParallaxTableHeaderView ( props , index )
170- ) }
185+ // renderScrollComponent={props => (
186+ // this._renderParallaxTableHeaderView(props, index)
187+ // )}
171188 renderSeparator = { ( ) => < View style = { { backgroundColor : colors . GRAY , height : 1 } } > </ View > }
172189 />
173190 ) ;
@@ -211,7 +228,7 @@ const DEPARTMENT_LIST = [{
211228 activeDotColor = { colors . LF_DARK_GRREEN }
212229 dotStyle = { { marginBottom : DOT_MARGIN } } >
213230 {
214- DEPARTMENT_LIST . map ( ( data , index ) => this . _renderTableView ( data , index ) )
231+ this . props . groupedEmp . map ( ( data , index ) => this . _renderTableView ( data , index ) )
215232 }
216233 </ Swiper >
217234 )
@@ -226,6 +243,10 @@ const DEPARTMENT_LIST = [{
226243 }
227244
228245 render ( ) {
246+ // setInterval(() => {
247+ // console.log('----_CONTACT', this.props.groupedEmp);
248+ // }, 1000);
249+ // console.log('----_CONTACT', this.props.groupedEmp);
229250 return (
230251 < View style = { style . mainContainer } >
231252 { this . _renderStatusBar ( ) }
0 commit comments