Skip to content

Commit

Permalink
docs: updates styles
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo committed Oct 5, 2024
1 parent ff3b32e commit c2eea6c
Show file tree
Hide file tree
Showing 27 changed files with 39 additions and 46 deletions.
5 changes: 5 additions & 0 deletions example/app/app/+html.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ScrollViewStyleReset } from "expo-router/html";
import { WebProvider } from "@/store/WebProvider";
import Head from "expo-router/head";

// This file is web-only and used to configure the root HTML for every
// web page during static rendering.
Expand All @@ -16,6 +17,10 @@ export default function Root({ children }: { children: React.ReactNode }) {
content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1"
/>

<Head>
<title>Examples - RNRC</title>
</Head>

{/*
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
Expand Down
13 changes: 3 additions & 10 deletions example/app/app/demos/custom-animations/quick-swipe/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import Carousel from "react-native-reanimated-carousel";

import { SBItem } from "@/components/SBItem";
import { window } from "@/constants/sizes";
import {
Image,
ImageSourcePropType,
View,
ViewStyle,
useWindowDimensions,
} from "react-native";
import { Image, ImageSourcePropType, View, ViewStyle } from "react-native";
import Animated, {
Easing,
Extrapolation,
Expand All @@ -26,7 +20,6 @@ import * as Haptics from "expo-haptics";
import { getImages } from "./images";
import { IS_WEB } from "@/constants/platform";

const PAGE_WIDTH = window.width;
const data = getImages().slice(0, 68);

function Index() {
Expand All @@ -35,8 +28,8 @@ function Index() {

const baseOptions = {
vertical: false,
width: 480,
height: PAGE_WIDTH / 2,
width: window.width,
height: window.width / 2,
} as const;

return (
Expand Down
15 changes: 4 additions & 11 deletions example/app/app/demos/custom-animations/quick-swipe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ import { SafeAreaView } from "react-native-safe-area-context";

import { SBItem } from "@/components/SBItem";
import { window } from "@/constants/sizes";
import {
Image,
ImageSourcePropType,
ViewStyle,
useWindowDimensions,
} from "react-native";
import { Image, ImageSourcePropType, ViewStyle } from "react-native";
import Animated, {
Easing,
Extrapolation,
Expand All @@ -27,18 +22,16 @@ import { getImages } from "./images";
import { CaptureWrapper } from "@/store/CaptureProvider";
import { IS_WEB } from "@/constants/platform";

const PAGE_WIDTH = window.width;
const data = getImages().slice(0, 68);

function Index() {
const windowWidth = useWindowDimensions().width;
const scrollOffsetValue = useSharedValue<number>(0);
const ref = React.useRef<ICarouselInstance>(null);

const baseOptions = {
vertical: false,
width: windowWidth,
height: PAGE_WIDTH / 2,
width: window.width,
height: window.width / 2,
} as const;

return (
Expand Down Expand Up @@ -72,7 +65,7 @@ function Index() {
renderItem={({ index, item }) => {
return (
<Animated.View key={index} style={{ flex: 1 }}>
<SBItem showIndex={false} img={item} />
<SBItem showIndex={false} img={item} index={index} />
</Animated.View>
);
}}
Expand Down
2 changes: 1 addition & 1 deletion example/app/components/SBItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const SBItem: React.FC<Props> = (props) => {
}}
>
<Animated.View testID={testID} style={{ flex: 1 }} {...animatedViewProps}>
<SlideItem index={index} rounded={rounded} />
<SlideItem index={index} rounded={rounded} source={img} />
</Animated.View>
</LongPressGestureHandler>
);
Expand Down
6 changes: 4 additions & 2 deletions example/app/components/SlideItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
StyleSheet,
View,
Text,
ImageSourcePropType,
} from "react-native";
import type { AnimatedProps } from "react-native-reanimated";
import Animated from "react-native-reanimated";
Expand All @@ -15,6 +16,7 @@ interface Props extends AnimatedProps<ViewProps> {
style?: StyleProp<ImageStyle>;
index?: number;
rounded?: boolean;
source?: ImageSourcePropType;
}

export const SlideItem: React.FC<Props> = (props) => {
Expand All @@ -27,8 +29,8 @@ export const SlideItem: React.FC<Props> = (props) => {
} = props;

const source = useMemo(
() => PURPLE_IMAGES[index % PURPLE_IMAGES.length],
[index],
() => props.source || PURPLE_IMAGES[index % PURPLE_IMAGES.length],
[index, props.source],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `left-align` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/basic-layouts/left-align/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/basic-layouts/normal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `normal` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/basic-layouts/normal/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/basic-layouts/parallax.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `parallax` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/basic-layouts/parallax/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/basic-layouts/stack.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `stack` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/basic-layouts/stack/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `advanced-parallax` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/advanced-parallax/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `anim-tab-bar` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/anim-tab-bar/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `blur-parallax` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/blur-parallax/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `blur-rotate` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/blur-rotate/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `circular` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/circular/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `cube-3d` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/cube-3d/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/custom-animations/curve.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `curve` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/curve/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/custom-animations/flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `flow` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/flow/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/custom-animations/fold.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `fold` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/fold/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `multiple` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/multiple/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `press-swipe` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/press-swipe/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `quick-swipe` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/quick-swipe/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `rotate-fade-in-out` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/rotate-fade-in-out/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `rotate-in-out` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/rotate-in-out/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `scale-fade-in-out` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/scale-fade-in-out/index.tsx)
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `tinder` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/custom-animations/tinder/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/pages/Examples/utils/pagination.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'

<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the `pagination` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/utils/pagination/index.tsx)
</Callout>

Expand Down
2 changes: 1 addition & 1 deletion example/website/scripts/gen-pages-template.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'
import Demo from '@/components/Demo'
<Callout emoji="👾">
<Callout type="info" emoji="💡">
Check out the \`${page}\` animation demo for the full source code [here](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/app/app/demos/${kind}/${page}/index.tsx)
</Callout>
Expand Down

0 comments on commit c2eea6c

Please sign in to comment.