Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/src/HeadphonesCarouselExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ const Pagination = ({
const AnimatedPagerView = Animated.createAnimatedComponent(PagerView);

export default function HeadphonesCarouselExample() {
const scrollOffsetAnimatedValue = React.useRef(new Animated.Value(0)).current;
const positionAnimatedValue = React.useRef(new Animated.Value(0)).current;
const [scrollOffsetAnimatedValue] = React.useState(() => new Animated.Value(0));
const [positionAnimatedValue] = React.useState(() => new Animated.Value(0));

return (
<View style={styles.container}>
Expand Down
7 changes: 3 additions & 4 deletions example/src/PaginationDotsExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const INTRO_DATA = [
export default function PaginationDotsExample() {
const width = Dimensions.get('window').width;
const ref = React.useRef<PagerView>(null);
const scrollOffsetAnimatedValue = React.useRef(new Animated.Value(0)).current;
const positionAnimatedValue = React.useRef(new Animated.Value(0)).current;
const [scrollOffsetAnimatedValue] = React.useState(() => new Animated.Value(0));
const [positionAnimatedValue] = React.useState(() => new Animated.Value(0));
const inputRange = [0, INTRO_DATA.length];
const scrollX = Animated.add(
scrollOffsetAnimatedValue,
Expand All @@ -76,8 +76,7 @@ export default function PaginationDotsExample() {
useNativeDriver: false,
}
),
// eslint-disable-next-line react-hooks/exhaustive-deps
[]
[scrollOffsetAnimatedValue, positionAnimatedValue]
);

return (
Expand Down
2 changes: 1 addition & 1 deletion example/src/ScrollViewInsideExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PAGES, createPage } from './utils';
const AnimatedPagerView = Animated.createAnimatedComponent(PagerView);

export const ScrollViewInsideExample = (): React.JSX.Element => {
const [pages] = useState(
const [pages] = useState(() =>
Array(PAGES)
.fill(1)
.map((_, index) => createPage(index))
Expand Down
2 changes: 1 addition & 1 deletion example/src/tabView/CoverflowExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const Scene = ({ route, position, layout, index, length }: Props) => {

export default function CoverflowExample() {
const [index, onIndexChange] = React.useState(2);
const [routes] = React.useState(Object.keys(ALBUMS).map((key) => ({ key })));
const [routes] = React.useState(() => Object.keys(ALBUMS).map((key) => ({ key })));

return (
<TabView
Expand Down