diff --git a/example/src/complex/index.tsx b/example/src/complex/index.tsx new file mode 100644 index 00000000..94d8eab0 --- /dev/null +++ b/example/src/complex/index.tsx @@ -0,0 +1,145 @@ +import * as React from 'react'; +import { Button, Dimensions, ScrollView, Text, View } from 'react-native'; +import Carousel from '../../../src/index'; +import type { ICarouselInstance } from '../../../src/types'; + +const window = Dimensions.get('window'); +const PAGE_WIDTH = window.width; + +interface DataItem { + text: string; + backgroundColor: string; +} + +const data: DataItem[] = [ + { text: '0', backgroundColor: '#ffbb96' }, + { text: '1', backgroundColor: '#ff9c6e' }, + { text: '2', backgroundColor: '#ff7a45' }, + { text: '3', backgroundColor: '#fa541c' }, + { text: '4', backgroundColor: '#d4380d' }, + { text: '5', backgroundColor: '#ad2102' }, + { text: '6', backgroundColor: '#871400' }, + { text: '7', backgroundColor: '#ffbb96' }, + { text: '8', backgroundColor: '#ff9c6e' }, + { text: '9', backgroundColor: '#ff7a45' }, + { text: '10', backgroundColor: '#fa541c' }, + { text: '11', backgroundColor: '#d4380d' }, + { text: '12', backgroundColor: '#ad2102' }, + { text: '13', backgroundColor: '#871400' }, + { text: '14', backgroundColor: '#ffbb96' }, + { text: '15', backgroundColor: '#ff9c6e' }, + { text: '16', backgroundColor: '#ff7a45' }, + { text: '17', backgroundColor: '#fa541c' }, + { text: '18', backgroundColor: '#d4380d' }, + { text: '19', backgroundColor: '#ad2102' }, + { text: '20', backgroundColor: '#871400' }, + { text: '21', backgroundColor: '#ffbb96' }, + { text: '22', backgroundColor: '#ff9c6e' }, + { text: '23', backgroundColor: '#ffbb96' }, + { text: '24', backgroundColor: '#ff9c6e' }, + { text: '25', backgroundColor: '#ff7a45' }, + { text: '26', backgroundColor: '#fa541c' }, + { text: '27', backgroundColor: '#d4380d' }, + { text: '28', backgroundColor: '#ad2102' }, + { text: '29', backgroundColor: '#871400' }, + { text: '30', backgroundColor: '#ffbb96' }, + { text: '31', backgroundColor: '#ff9c6e' }, + { text: '32', backgroundColor: '#ff7a45' }, + { text: '33', backgroundColor: '#fa541c' }, + { text: '34', backgroundColor: '#d4380d' }, + { text: '35', backgroundColor: '#ad2102' }, + { text: '36', backgroundColor: '#871400' }, + { text: '37', backgroundColor: '#ffbb96' }, + { text: '38', backgroundColor: '#ff9c6e' }, + { text: '39', backgroundColor: '#ff7a45' }, + { text: '40', backgroundColor: '#ff7a45' }, + { text: '41', backgroundColor: '#ff7a45' }, + { text: '42', backgroundColor: '#ff7a45' }, + { text: '43', backgroundColor: '#ff7a45' }, + { text: '44', backgroundColor: '#ff7a45' }, + { text: '45', backgroundColor: '#ff7a45' }, + { text: '46', backgroundColor: '#ff7a45' }, + { text: '47', backgroundColor: '#ff7a45' }, + { text: '48', backgroundColor: '#ff7a45' }, + { text: '49', backgroundColor: '#ff7a45' }, +]; + +function Index() { + const r = React.useRef(null); + + return ( + + + ( + + + {`${index}-${text}`} + + + {new Array(100).fill(0).map((_, i) => { + return ( + + {i} + + ); + })} + + + )} + /> + + +