This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite internals to simplify animated index logic
- Loading branch information
Andrew Smith
authored and
Andrew Smith
committed
Oct 18, 2019
1 parent
7ee2856
commit ae6dd06
Showing
12 changed files
with
532 additions
and
427 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
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
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,47 @@ | ||
import React, {useState} from 'react'; | ||
import {Pager, iPageInterpolation} from '@crowdlinker/react-native-pager'; | ||
import {Slide, NavigationButtons} from './shared-components'; | ||
import {View} from 'react-native'; | ||
import Animated from 'react-native-reanimated'; | ||
|
||
const {multiply, floor} = Animated; | ||
|
||
const verticalConfig: iPageInterpolation = { | ||
transform: [ | ||
{ | ||
scale: { | ||
inputRange: [-1, 0, 1], | ||
outputRange: [0.8, 1, 0.9], | ||
}, | ||
}, | ||
], | ||
|
||
opacity: { | ||
inputRange: [-1, 0, 1, 2, 3], | ||
outputRange: [1, 1, 1, 1, 0], | ||
}, | ||
|
||
zIndex: offset => multiply(floor(offset), -1), | ||
}; | ||
|
||
function VerticalPager() { | ||
const [activeIndex, onChange] = useState(2); | ||
|
||
return ( | ||
<View> | ||
<Pager | ||
type="vertical" | ||
activeIndex={activeIndex} | ||
onChange={onChange} | ||
style={{height: 200, width: 200, alignSelf: 'center', padding: 10}} | ||
pageInterpolation={verticalConfig}> | ||
{Array.from({length: activeIndex + 3}, (_, i) => ( | ||
<Slide key={i} /> | ||
))} | ||
</Pager> | ||
<NavigationButtons activeIndex={activeIndex} onChange={onChange} /> | ||
</View> | ||
); | ||
} | ||
|
||
export {VerticalPager}; |
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 @@ | ||
export * from './pager-2'; | ||
export * from './pager'; | ||
export * from './pagination'; | ||
export { interpolateWithConfig } from './util'; |
Oops, something went wrong.