rn-marquee-text 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +126 -110
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,51 +1,55 @@
1
1
  # React Native Marquee Text
2
2
 
3
- A highly customizable package for implementing smooth auto-scrolling and marquee text components in React Native applications. This package works seamlessly in both React Native and Expo environments.
4
3
 
5
- ## Features
6
- - 🚀 Smooth scrolling animations powered by React Native Reanimated
7
- - 💯 Works perfectly in both React Native and Expo environments
8
- - 🔄 Multiple animation modes (continuous loop and bounce)
9
- - ⚙️ Customizable speed, delay, and styling options
10
- - 📱 No external dependencies other than React Native Reanimated
11
- - ⚡ Optimized performance with native animations
12
- - 📏 Auto-detects when scrolling is needed (text larger than container)
13
- - ↔️ Supports both horizontal and vertical scrolling
14
- - 📰 Includes a dedicated MarqueeText component for text tickers
4
+ A highly customizable package for smooth, auto-scrolling marquee text components in React Native apps. Works seamlessly in both React Native CLI and Expo environments.
15
5
 
16
- ## Installation
6
+ ![npm version](https://img.shields.io/npm/v/rn-marquee-text.svg)
7
+ ![license](https://img.shields.io/npm/l/rn-marquee-text.svg)
8
+ ![downloads](https://img.shields.io/npm/dm/rn-marquee-text.svg)
9
+
10
+ ## 🚀 Features
11
+
12
+ - ⚡ Smooth scrolling powered by React Native Reanimated
13
+ - 🧩 Fully compatible with React Native & Expo
14
+ - 🔁 Supports loop and bounce animation modes
15
+ - 🎛️ Customizable speed, delay, and styles
16
+ - 📱 No dependencies except Reanimated
17
+ - 📏 Auto-detects overflow for auto-scrolling
18
+ - ↔️ Supports horizontal and vertical scrolling
19
+ - 📰 Built-in MarqueeText for ticker-style effects
20
+
21
+ ## 📦 Installation
17
22
 
18
23
  ```bash
19
- # Using npm
24
+ # React Native CLI
20
25
  npm install rn-marquee-text react-native-reanimated
21
26
 
22
- # Using yarn
27
+ # OR using yarn
23
28
  yarn add rn-marquee-text react-native-reanimated
24
29
  ```
25
30
 
26
- ### Expo Projects
27
- For Expo projects, make sure you have Reanimated installed:
31
+ ### Expo Users
28
32
 
29
33
  ```bash
30
34
  expo install react-native-reanimated
31
35
  ```
32
36
 
33
- Then, add the Babel plugin to your babel.config.js:
37
+ Then update your `babel.config.js`:
34
38
 
35
- ```javascript
39
+ ```js
36
40
  module.exports = {
37
41
  presets: ['babel-preset-expo'],
38
42
  plugins: ['react-native-reanimated/plugin'],
39
43
  };
40
44
  ```
41
45
 
42
- ## Components
46
+ ## 🧱 Components
43
47
 
44
- ### 1. AutoScroll
45
- A versatile component for scrolling any content (text or components) that overflows its container.
48
+ ### 1️⃣ AutoScroll — Scroll any overflowed content
46
49
 
47
50
  #### Basic Usage
48
- ```jsx
51
+
52
+ ```tsx
49
53
  import AutoScroll, { AnimationMode } from 'rn-marquee-text';
50
54
 
51
55
  const Example = () => (
@@ -54,80 +58,85 @@ const Example = () => (
54
58
  mode={AnimationMode.LOOP}
55
59
  speed={40}
56
60
  >
57
- This is a long text that will automatically scroll when it's larger than
58
- the container. The component automatically detects if scrolling is needed.
61
+ This is a long text that will scroll if it overflows its container.
59
62
  </AutoScroll>
60
63
  );
61
64
  ```
62
65
 
63
66
  #### Props
67
+
64
68
  | Prop | Type | Default | Description |
65
69
  |------|------|---------|-------------|
66
- | children | ReactNode | (required) | Content to be scrolled |
67
- | mode | AnimationMode or string | 'loop' | Animation mode: 'loop' or 'bounce' |
68
- | speed | number | 30 | Speed of scrolling in pixels per second |
69
- | delay | number | 1500 | Delay in milliseconds before starting the animation |
70
- | endPauseDuration | number | 1000 | Duration to pause at the ends (only for bounce mode) |
71
- | style | ViewStyle | {} | Style for the container |
72
- | textStyle | TextStyle | {} | Style for the text (when children is a string) |
73
- | enabled | boolean | true | Whether to enable the animation |
74
- | direction | string | 'vertical' | Direction of scroll: 'horizontal' or 'vertical' |
75
-
76
- ### 2. MarqueeText
77
- A specialized component for creating ticker/marquee text effects, perfect for news tickers, announcements, or notifications.
70
+ | children | ReactNode | (required) | Content to scroll |
71
+ | mode | 'loop' \| 'bounce' | 'loop' | Animation type |
72
+ | speed | number | 30 | Speed in px/sec |
73
+ | delay | number | 1500 | Delay before animation starts |
74
+ | endPauseDuration | number | 1000 | Pause time at edges (for bounce mode) |
75
+ | style | ViewStyle | {} | Container styling |
76
+ | textStyle | TextStyle | {} | Text styling (when children is string) |
77
+ | enabled | boolean | true | Enable or disable animation |
78
+ | direction | 'horizontal' \| 'vertical' | 'vertical' | Scroll direction |
79
+
80
+ ### 2️⃣ MarqueeText — For ticker-style text
78
81
 
79
82
  #### Basic Usage
80
- ```jsx
83
+
84
+ ```tsx
81
85
  import { MarqueeText } from 'rn-marquee-text';
86
+ import { View, Text } from 'react-native';
82
87
 
83
88
  const Example = () => (
84
89
  <View style={{ width: '100%', borderRadius: 8, overflow: 'hidden' }}>
85
90
  <MarqueeText
86
- text="Breaking News: This is a full-width marquee text component that scrolls horizontally"
87
91
  speed={100}
88
- backgroundColor="#7b341e"
89
- textColor="#fffaf0"
90
- fontSize={18}
91
- />
92
+ backgroundColor="#1a365d"
93
+ textColor="#f0f4f8"
94
+ fontSize={14}
95
+ direction="horizontal"
96
+ >
97
+ <Text>
98
+ Breaking News: This is a marquee text scrolling horizontally!
99
+ </Text>
100
+ </MarqueeText>
92
101
  </View>
93
102
  );
94
103
  ```
95
104
 
96
105
  #### Props
106
+
97
107
  | Prop | Type | Default | Description |
98
108
  |------|------|---------|-------------|
99
- | text | string | (required) | Text content to scroll |
100
- | speed | number | 80 | Speed of scrolling in pixels per second |
101
- | backgroundColor | string | '#000' | Background color of the marquee container |
102
- | textColor | string | '#fff' | Text color |
103
- | fontSize | number | 16 | Font size of the text |
104
- | paddingVertical | number | 8 | Vertical padding inside the marquee |
105
- | paddingHorizontal | number | 12 | Horizontal padding inside the marquee |
106
- | delay | number | 1000 | Delay in milliseconds before starting animation |
107
- | bounceMode | boolean | false | Whether to use bounce animation |
108
- | endPauseDuration | number | 2000 | Pause duration at each end (only when bounceMode is true) |
109
-
110
- ## Advanced Examples
111
-
112
- ### AutoScroll with Custom Content
113
- ```jsx
109
+ | text | string | (required) | Text to display (alternative to children) |
110
+ | speed | number | 80 | Speed in px/sec |
111
+ | backgroundColor | string | #000 | Marquee background color |
112
+ | textColor | string | #fff | Text color |
113
+ | fontSize | number | 16 | Font size |
114
+ | paddingVertical | number | 8 | Vertical padding |
115
+ | paddingHorizontal | number | 12 | Horizontal padding |
116
+ | delay | number | 1000 | Delay before animation starts |
117
+ | bounceMode | boolean | false | Whether to bounce at edges |
118
+ | endPauseDuration | number | 2000 | Pause at each end (only in bounce mode) |
119
+
120
+ ## 💡 Advanced Examples
121
+
122
+ ### 🔁 AutoScroll with Custom Content
123
+
124
+ ```tsx
114
125
  import React from 'react';
115
126
  import { View, Text, StyleSheet } from 'react-native';
116
127
  import AutoScroll from 'rn-marquee-text';
117
128
 
118
- const CardScroller = () => {
119
- return (
120
- <AutoScroll style={styles.scrollContainer} direction="horizontal">
121
- <View style={styles.contentContainer}>
122
- {[1, 2, 3, 4, 5].map((item) => (
123
- <View key={item} style={styles.card}>
124
- <Text style={styles.cardText}>Card {item}</Text>
125
- </View>
126
- ))}
127
- </View>
128
- </AutoScroll>
129
- );
130
- };
129
+ const CardScroller = () => (
130
+ <AutoScroll style={styles.scrollContainer} direction="horizontal">
131
+ <View style={styles.contentContainer}>
132
+ {[1, 2, 3, 4, 5].map((item) => (
133
+ <View key={item} style={styles.card}>
134
+ <Text style={styles.cardText}>Card {item}</Text>
135
+ </View>
136
+ ))}
137
+ </View>
138
+ </AutoScroll>
139
+ );
131
140
 
132
141
  const styles = StyleSheet.create({
133
142
  scrollContainer: {
@@ -154,26 +163,22 @@ const styles = StyleSheet.create({
154
163
  });
155
164
  ```
156
165
 
157
- ### News Ticker with MarqueeText
158
- ```jsx
166
+ ### 📰 News Ticker with MarqueeText
167
+
168
+ ```tsx
159
169
  import React from 'react';
160
- import { View, StyleSheet } from 'react-native';
170
+ import { View, Text, StyleSheet } from 'react-native';
161
171
  import { MarqueeText } from 'rn-marquee-text';
162
172
 
163
- const NewsTicker = () => {
164
- return (
165
- <View style={styles.tickerContainer}>
166
- <MarqueeText
167
- text="BREAKING NEWS: Latest updates on global events. Markets reach all-time high. New technological breakthroughs announced."
168
- speed={70}
169
- backgroundColor="#1a365d"
170
- textColor="#ffffff"
171
- fontSize={16}
172
- bounceMode={false}
173
- />
174
- </View>
175
- );
176
- };
173
+ const NewsTicker = () => (
174
+ <View style={styles.tickerContainer}>
175
+ <MarqueeText speed={70} bounceMode={false}>
176
+ <Text style={styles.cardText}>
177
+ BREAKING NEWS: Latest updates on global events. Markets reach all-time high.
178
+ </Text>
179
+ </MarqueeText>
180
+ </View>
181
+ );
177
182
 
178
183
  const styles = StyleSheet.create({
179
184
  tickerContainer: {
@@ -182,36 +187,47 @@ const styles = StyleSheet.create({
182
187
  overflow: 'hidden',
183
188
  marginVertical: 10,
184
189
  },
190
+ cardText: {
191
+ fontSize: 14,
192
+ paddingHorizontal: 10,
193
+ },
185
194
  });
186
195
  ```
187
196
 
188
- ## Tips for Optimal Performance
189
- - Adjust speed based on content length: Longer content might benefit from faster speeds.
190
- - Use appropriate delays: Give your users time to notice the content before it starts scrolling.
191
- - Consider bounce mode for important information: The back-and-forth animation can draw more attention.
192
- - Limit the number of simultaneous scrolling components: Too many can impact performance.
193
- - Test on lower-end devices: Ensure smooth animations across various device capabilities.
197
+ ## 🛠️ Tips for Optimal Performance
194
198
 
195
- ## Troubleshooting
199
+ - Match speed with content length for readability
200
+ - Use delays to give users time to read before scrolling
201
+ - Bounce mode is more attention-grabbing (e.g., for alerts)
202
+ - Limit concurrent scroll components to avoid frame drops
203
+ - Test on low-end devices for smooth performance
196
204
 
197
- ### Text Not Scrolling
198
- - Make sure the text is actually larger than its container
199
- - Check that enabled prop is not set to false
200
- - Try increasing the container's overflow: 'hidden' style
205
+ ## 🧩 Troubleshooting
201
206
 
202
- ### Animation Feels Choppy
203
- - Use the useNativeDriver: true option if available
204
- - Reduce the number of simultaneously animating components
205
- - Simplify your component tree structure
207
+ ### Text Not Scrolling?
208
+
209
+ - Ensure content overflows the container
210
+ - Confirm `enabled` is set to `true`
211
+ - Use `overflow: 'hidden'` on container
212
+
213
+ ### 🐢 Choppy Animations?
214
+
215
+ - Leverage `useNativeDriver` if supported
216
+ - Minimize simultaneous animations
217
+ - Simplify nested component structure
218
+
219
+ ## 📄 License
206
220
 
207
- ## License
208
221
  MIT
209
222
 
210
- ## Contributing
211
- Contributions are welcome! Please feel free to submit a Pull Request.
223
+ ## 🤝 Contributing
224
+
225
+ Pull requests welcome!
226
+
227
+ Steps:
212
228
 
213
- 1. Fork the project
214
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
215
- 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
216
- 4. Push to the branch (`git push origin feature/amazing-feature`)
217
- 5. Open a Pull Request
229
+ 1. Fork the repo
230
+ 2. Create a branch: `git checkout -b feature/amazing-feature`
231
+ 3. Commit your changes: `git commit -m 'Add some amazing feature'`
232
+ 4. Push the branch: `git push origin feature/amazing-feature`
233
+ 5. Open a Pull Request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-marquee-text",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A customizable marquee (scrolling) text component for React Native",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",