forked from gajendrakumartwinwal/infiniteslideshow
-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.tsx
69 lines (62 loc) · 1.75 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import * as React from 'react';
import {StyleSheet, Text, View, Dimensions, Button} from 'react-native';
// import SlideShow from "./src/SlideShow";
import SlideShow from "./dist/index";
class App extends React.Component{
constructor(props){
super(props)
this.state = {items: [1,2,3,4,5,6]}
}
rowRenderer = (type: number, data: any) => {
return (
<View style={styles.item}>
<Text>
{data}
</Text>
</View>
);
};
onPress = () => {
this.setState({items: [1]})
}
render(): React.ReactNode {
// alert('yes i am here!')
return (
<View>
<SlideShow
indicatorStyle={{
alignItems: 'center',
// position: 'absolute',
bottom: 10,
left: 0,
right: 0,
}}
autoScroll={true}
duration={3000}
style={{
height: 500,
width: Dimensions.get('screen').width
}}
multiplier={4}
items={this.state.items}
rowRenderer={this.rowRenderer}/>
<Button title={'Clicke me'} onPress={this.onPress}/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
item: {
flex: 1,
justifyContent: 'center',
backgroundColor: '#e2e200',
alignItems: 'center',
},
});
export default App