-
-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
668 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ module.exports = { | |
useTabs: false, | ||
}, | ||
], | ||
'react-native/no-inline-styles': 0, | ||
}, | ||
}; |
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
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,40 @@ | ||
import * as React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import { useNavigation, NavigationProp } from '@react-navigation/native'; | ||
import { RootStackParamList } from '../index'; | ||
import { Colors, ListItem } from 'react-native-ui-lib'; | ||
|
||
const LayoutsPage: Array<Record<'name', keyof RootStackParamList>> = [ | ||
{ | ||
name: 'Normal', | ||
}, | ||
{ | ||
name: 'Parallax', | ||
}, | ||
]; | ||
|
||
const Index = () => { | ||
const navigation = useNavigation<NavigationProp<RootStackParamList>>(); | ||
return ( | ||
<View style={{ flex: 1 }}> | ||
{LayoutsPage.map(({ name }, index) => { | ||
return ( | ||
<ListItem | ||
key={index} | ||
onPress={() => navigation.navigate(name)} | ||
style={{ | ||
// justifyContent: 'center', | ||
alignItems: 'center', | ||
borderColor: Colors.grey60, | ||
borderBottomWidth: 1, | ||
}} | ||
> | ||
<Text>{name}</Text> | ||
</ListItem> | ||
); | ||
})} | ||
</View> | ||
); | ||
}; | ||
|
||
export default Index; |
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,29 @@ | ||
import * as React from 'react'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
|
||
import Home from './home'; | ||
import NormalComponent from './normal'; | ||
import ParallaxComponent from './parallax'; | ||
|
||
const Stack = createNativeStackNavigator<RootStackParamList>(); | ||
|
||
export type RootStackParamList = { | ||
Home: undefined; | ||
Normal: undefined; | ||
Parallax: undefined; | ||
}; | ||
|
||
function App() { | ||
return ( | ||
<NavigationContainer> | ||
<Stack.Navigator initialRouteName="Home"> | ||
<Stack.Screen name="Home" component={Home} /> | ||
<Stack.Screen name="Normal" component={NormalComponent} /> | ||
<Stack.Screen name="Parallax" component={ParallaxComponent} /> | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
); | ||
} | ||
|
||
export default App; |
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,83 @@ | ||
import * as React from 'react'; | ||
import { Button, Dimensions, 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: 'Walter, Wintheiser and Von', backgroundColor: '#ffbb96' }, | ||
{ text: 'Herman, Dicki and Wintheiser', backgroundColor: '#ff9c6e' }, | ||
{ text: 'Wiza, Borer and Muller', backgroundColor: '#ff7a45' }, | ||
{ text: 'Kulas Group', backgroundColor: '#fa541c' }, | ||
{ text: 'Rowe, Gerhold and Corkery', backgroundColor: '#d4380d' }, | ||
{ text: 'Lang - Doyle', backgroundColor: '#ad2102' }, | ||
{ text: "Anderson, Leuschke and O'Keefe", backgroundColor: '#871400' }, | ||
]; | ||
|
||
function Index() { | ||
const r = React.useRef<ICarouselInstance | null>(null); | ||
|
||
return ( | ||
<View | ||
style={{ | ||
flex: 1, | ||
alignItems: 'center', | ||
backgroundColor: '#f1f1f1', | ||
paddingTop: 100, | ||
}} | ||
> | ||
<View style={{ width: PAGE_WIDTH, height: 240 }}> | ||
<Carousel | ||
defaultIndex={0} | ||
ref={r} | ||
width={PAGE_WIDTH} | ||
parallaxScrollingScale={0.8} | ||
data={data} | ||
renderItem={({ backgroundColor, text }) => ( | ||
<View | ||
style={{ | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor, | ||
}} | ||
> | ||
<Text style={{ color: 'white', fontSize: 30 }}> | ||
{text} | ||
</Text> | ||
</View> | ||
)} | ||
/> | ||
</View> | ||
<View | ||
style={{ | ||
marginTop: 24, | ||
flexDirection: 'row', | ||
justifyContent: 'space-evenly', | ||
}} | ||
> | ||
<Button | ||
title="Prev" | ||
onPress={() => { | ||
r.current?.prev(); | ||
}} | ||
/> | ||
<Button | ||
title="Next" | ||
onPress={() => { | ||
r.current?.next(); | ||
}} | ||
/> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
export default Index; |
Oops, something went wrong.