-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first commit of carousel component
- Loading branch information
Showing
20 changed files
with
23,943 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
presets: ['module:metro-react-native-babel-preset'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,55 @@ | ||
/* eslint-disable react-native/no-inline-styles */ | ||
import * as React from 'react'; | ||
import { Button, Dimensions, View } from 'react-native'; | ||
import { ICarouselInstance } from '../../src/Carousel'; | ||
|
||
import { StyleSheet, View, Text } from 'react-native'; | ||
import ReanimatedCarousel from 'react-native-reanimated-carousel'; | ||
import Carousel from '../../src/index'; | ||
|
||
export default function App() { | ||
const [result, setResult] = React.useState<number | undefined>(); | ||
|
||
React.useEffect(() => { | ||
ReanimatedCarousel.multiply(3, 7).then(setResult); | ||
}, []); | ||
const { width } = Dimensions.get('window'); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text>Result: {result}</Text> | ||
</View> | ||
); | ||
export default function App() { | ||
const r = React.useRef<ICarouselInstance | null>(null); | ||
return ( | ||
<View | ||
style={{ | ||
flex: 1, | ||
alignItems: 'center', | ||
backgroundColor: 'black', | ||
}} | ||
> | ||
<View style={{ height: 300 }}> | ||
<Carousel<{ color: string }> | ||
width={width} | ||
data={[ | ||
{ color: 'red' }, | ||
{ color: 'purple' }, | ||
{ color: 'yellow' }, | ||
]} | ||
renderItem={({ color }) => { | ||
return ( | ||
<View | ||
style={{ | ||
backgroundColor: color, | ||
justifyContent: 'center', | ||
flex: 1, | ||
}} | ||
/> | ||
); | ||
}} | ||
/> | ||
</View> | ||
<Button | ||
title="pre" | ||
onPress={() => { | ||
r.current.prev(); | ||
}} | ||
/> | ||
<Button | ||
title="next" | ||
onPress={() => { | ||
r.current.next(); | ||
}} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
box: { | ||
width: 60, | ||
height: 60, | ||
marginVertical: 20, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react-native", | ||
"target": "esnext", | ||
"lib": [ | ||
"esnext" | ||
], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"noEmit": true, | ||
"allowSyntheticDefaultImports": true, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"moduleResolution": "node" | ||
} | ||
} |
Oops, something went wrong.