Skip to content

Commit 641c32a

Browse files
committed
feat: frameRate and direction support
1 parent d704e50 commit 641c32a

File tree

12 files changed

+13006
-8654
lines changed

12 files changed

+13006
-8654
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ android/keystores/debug.keystore
6868

6969
# generated by bob
7070
lib/
71+
example/web-build/

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
https://github.com/animate-react-native/marquee/assets/2805320/4fb199b2-491c-4621-bf84-85890a8d6f5e
55

6-
7-
86
[![NPM Version](https://img.shields.io/npm/v/@animatereactnative/marquee.svg?style=flat&color=black)](https://www.npmjs.org/package/@animatereactnative/marquee) [![runs with expo](https://img.shields.io/badge/Runs%20with%20Expo-4630EB.svg?style=flat-square&logo=EXPO&labelColor=f3f3f3&logoColor=000)](https://expo.io/) [![npm](https://img.shields.io/npm/l/@animatereactnative/marquee?style=flat-square)](https://www.npmjs.com/package/@animatereactnative/marquee) [![npm](https://img.shields.io/badge/types-included-blue?style=flat-square)](https://www.npmjs.com/package/@animatereactnative/marquee) <a href="https://twitter.com/mironcatalin"><img src="https://img.shields.io/twitter/follow/mironcatalin?label=Follow @mironcatalin&color=black" alt="Follow Miron Catalin"></a>
97

108
</div>
@@ -44,12 +42,14 @@ export function Example() {
4442

4543
## Props
4644

47-
| name | description | required | type | default |
48-
| ---------- | -------------------------------------------------------------------------- | -------- | ---------------------- | ------- |
49-
| `children` | Any component that you'd like to apply infinite scrolling / marquee effect | YES | `React.ReactNode` | 1 |
50-
| `speed` | Animation speed | NO | `number` | 1 |
51-
| `spacing` | Spacing between repeting elements | NO | `number` | 0 |
52-
| `style` | View style to be applied to Marquee container. | NO | `StyleProp<ViewStyle>` | |
45+
| name | description | required | type | default |
46+
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------------------- | ---------------------------- |
47+
| `children` | Any component that you'd like to apply infinite scrolling / marquee effect | YES | `React.ReactNode` | 1 |
48+
| `speed` | Animation speed | NO | `number` | 1 |
49+
| `spacing` | Spacing between repeting elements | NO | `number` | 0 |
50+
| `reverse` | Determine if the animation should be reversed or not. Based on `direction`, `reverse` means left-to-right, right-to-left, top-to-bottom, bottom-to-top | NO | `boolean` | false |
51+
| `direction` | Direction of the animation | NO | `"horizontal"` | `"vertical" or "horizontal"` |
52+
| `style` | View style to be applied to Marquee container. | NO | `StyleProp<ViewStyle>` | |
5353

5454
## Contributing
5555

example/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PUBLIC_URL="/marquee"

example/.yarn/install-state.gz

1.25 MB
Binary file not shown.

example/app.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"expo": {
3-
"name": "example",
4-
"slug": "example",
3+
"name": "marquee",
4+
"slug": "marquee",
55
"version": "1.0.0",
66
"orientation": "portrait",
77
"icon": "./assets/icon.png",
@@ -11,9 +11,7 @@
1111
"resizeMode": "contain",
1212
"backgroundColor": "#ffffff"
1313
},
14-
"assetBundlePatterns": [
15-
"**/*"
16-
],
14+
"assetBundlePatterns": ["**/*"],
1715
"ios": {
1816
"supportsTablet": true
1917
},
@@ -25,6 +23,9 @@
2523
},
2624
"web": {
2725
"favicon": "./assets/favicon.png"
26+
},
27+
"experiments": {
28+
"baseUrl": "/marquee"
2829
}
2930
}
3031
}

example/dist/.nojekyll

Whitespace-only changes.

example/package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@
22
"name": "example",
33
"version": "1.0.0",
44
"main": "node_modules/expo/AppEntry.js",
5+
"homepage": "/marquee",
56
"scripts": {
67
"start": "expo start",
78
"android": "expo start --android",
89
"ios": "expo start --ios",
9-
"web": "expo start --web"
10+
"web": "expo start --web",
11+
"deploy": "expo export:web -c && gh-pages -t -d web-build --nojekyll"
1012
},
1113
"dependencies": {
12-
"expo": "~49.0.7",
13-
"expo-status-bar": "~1.6.0",
14+
"expo": "^51.0.38",
15+
"expo-status-bar": "~1.12.1",
1416
"react": "18.2.0",
1517
"react-dom": "18.2.0",
16-
"react-native": "0.72.3",
17-
"react-native-reanimated": "~3.3.0",
18-
"react-native-web": "~0.19.6"
18+
"react-native": "0.74.5",
19+
"react-native-reanimated": "~3.10.1",
20+
"react-native-web": "~0.19.10"
1921
},
2022
"devDependencies": {
21-
"@babel/core": "^7.20.0",
22-
"@expo/webpack-config": "^18.0.1",
23+
"@babel/core": "^7.24.0",
24+
"@expo/metro-runtime": "~3.2.3",
25+
"@expo/webpack-config": "~19.0.1",
26+
"@types/gh-pages": "^6",
2327
"babel-loader": "^8.1.0",
24-
"babel-plugin-module-resolver": "^5.0.0"
28+
"babel-plugin-module-resolver": "^5.0.0",
29+
"gh-pages": "^6.2.0"
2530
},
2631
"private": true
2732
}

example/public/.nojekyll

Whitespace-only changes.

example/src/App.tsx

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ export default function App() {
1212
return (
1313
<View style={styles.container}>
1414
<StatusBar hidden />
15-
<Marquee spacing={20} speed={1}>
16-
<Heading primary={primary}>
17-
@animatereactnative/marquee component
18-
</Heading>
15+
<Marquee speed={1}>
16+
<Heading primary={primary}>@animatereactnative/marquee</Heading>
1917
</Marquee>
2018
<Marquee spacing={20} speed={1}>
2119
<Heading primary={primary}>Powered by AnimateReactNative.com</Heading>
@@ -26,7 +24,13 @@ export default function App() {
2624
<Marquee spacing={10} speed={0.75} style={{ marginTop: 12 }}>
2725
<Box size={50} primary={primary} />
2826
</Marquee>
29-
<Marquee spacing={10} speed={4} style={{ marginTop: 12 }}>
27+
<Marquee
28+
spacing={10}
29+
speed={4}
30+
style={{ marginTop: 12 }}
31+
reverse
32+
frameRate={30}
33+
>
3034
<View style={{ flexDirection: 'row' }}>
3135
{[...Array(5).keys()].map((i) => {
3236
return (
@@ -42,6 +46,36 @@ export default function App() {
4246
})}
4347
</View>
4448
</Marquee>
49+
<View style={{ flexDirection: 'row', height: 300, padding: 10 }}>
50+
{[...Array(3).keys()].map((i) => {
51+
return (
52+
<Marquee
53+
spacing={10}
54+
speed={1}
55+
style={{ marginTop: 12 }}
56+
reverse={i === 1}
57+
frameRate={60}
58+
key={`marquee-${i}`}
59+
direction="vertical"
60+
>
61+
<View>
62+
{[...Array(5).keys()].map((i) => {
63+
return (
64+
<Box
65+
key={`box-${i}`}
66+
spacing={i === 4 ? 0 : 10}
67+
size={120}
68+
primary={primary}
69+
>
70+
<Heading primary={!primary}>{i}</Heading>
71+
</Box>
72+
);
73+
})}
74+
</View>
75+
</Marquee>
76+
);
77+
})}
78+
</View>
4579
</View>
4680
);
4781
}

example/src/components/Box.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function Box({
1818
height: size,
1919
borderRadius: 16,
2020
marginRight: spacing,
21+
marginBottom: spacing,
2122
justifyContent: 'center',
2223
alignItems: 'center',
2324
backgroundColor: primary ? '#F0F464' : '#1f1f1f',

0 commit comments

Comments
 (0)