react-native-theme-transition 1.0.2 → 1.0.3

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.
package/LICENSE CHANGED
@@ -1,9 +1,9 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Mario Prieta
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mario Prieta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,113 +1,111 @@
1
- <h1 align="center">React Native Theme Transition</h1>
2
-
3
- <p align="center">
4
- Smooth, animated theme transitions for React Native. Expo Go compatible, powered by Reanimated.
5
- </p>
6
-
7
- <p align="center">
8
- <a href="https://www.npmjs.com/package/react-native-theme-transition"><img src="https://img.shields.io/npm/v/react-native-theme-transition.svg?t=1" alt="npm version" /></a>
9
- <a href="https://bundlephobia.com/package/react-native-theme-transition"><img src="https://img.shields.io/badge/gzip%20size-2.5%20kB-brightgreen" alt="bundle size" /></a>
10
- <img src="https://img.shields.io/badge/Expo_Go-compatible-000.svg?logo=expo&logoColor=white" alt="expo compatible" />
11
- <img src="https://img.shields.io/badge/React_Compiler-compatible-blueviolet.svg" alt="react compiler" />
12
- <a href="https://github.com/marioprieta/react-native-theme-transition/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/react-native-theme-transition?t=1" alt="license" /></a>
13
- </p>
14
-
15
- <table align="center">
16
- <tr>
17
- <td align="center"><b>iOS</b></td>
18
- <td align="center"><b>Android</b></td>
19
- </tr>
20
- <tr>
21
- <td>
22
- <video src="https://github.com/user-attachments/assets/449220b3-50b1-417e-b2c3-13d815d575d7" width="260" autoplay loop muted playsinline></video>
23
- <img src="https://github.com/user-attachments/assets/056ce86b-11f0-410b-8fd0-598dbf6ca518" width="260" alt="iOS demo" />
24
- </td>
25
- <td>
26
- <video src="https://github.com/user-attachments/assets/9c55de09-41d2-4581-9463-eb315156dca3" width="260" autoplay loop muted playsinline></video>
27
- <img src="https://github.com/user-attachments/assets/8b6218d5-87d5-449b-a61d-b9adc78389d9" width="260" alt="Android demo" />
28
- </td>
29
- </tr>
30
- </table>
31
-
32
- ## Features
33
-
34
- - **Smooth cross-fade transitions** — powered by Reanimated on the native UI thread (60-120 FPS)
35
- - **Expo Go compatible** — no native code, no prebuilds required
36
- - **Multi-theme support** — define as many themes as you need with full TypeScript inference
37
- - **System theme sync** — follows OS appearance automatically with zero-flash startup
38
- - **Native UI sync** — alerts, keyboards, and date pickers automatically match your active theme
39
- - **Transition safe** — blocks concurrent transitions and exposes `isTransitioning`
40
- - **React Compiler ready** — all hooks follow the [Rules of React](https://react.dev/reference/rules)
41
- - **Lightweight** — ~2.5 kB gzipped, zero runtime dependencies
42
-
43
- ## Documentation
44
-
45
- For full docs, API reference, examples, and recipes, visit **[react-native-theme-transition.vercel.app](https://react-native-theme-transition.vercel.app)**.
46
-
47
- ## Installation
48
-
49
- ```bash
50
- # Expo (SDK 54+ already has reanimated and view-shot)
51
- npx expo install react-native-theme-transition react-native-worklets
52
-
53
- # React Native CLI
54
- npm install react-native-theme-transition react-native-reanimated react-native-view-shot react-native-worklets
55
- ```
56
-
57
- Add `react-native-worklets/plugin` as the **last plugin** in your `babel.config.js`.
58
-
59
- ## Quick start
60
-
61
- ```ts
62
- // theme.ts
63
- import { createThemeTransition } from 'react-native-theme-transition';
64
-
65
- export const { ThemeTransitionProvider, useTheme } = createThemeTransition({
66
- themes: {
67
- light: { background: '#ffffff', text: '#000000', primary: '#007AFF' },
68
- dark: { background: '#000000', text: '#ffffff', primary: '#0A84FF' },
69
- },
70
- });
71
- ```
72
-
73
- ```tsx
74
- // App.tsx
75
- import { ThemeTransitionProvider } from './theme';
76
-
77
- export default function App() {
78
- return (
79
- <ThemeTransitionProvider initialTheme="system">
80
- <MyApp />
81
- </ThemeTransitionProvider>
82
- );
83
- }
84
- ```
85
-
86
- ```tsx
87
- // MyScreen.tsx
88
- import { useTheme } from './theme';
89
-
90
- function MyScreen() {
91
- const { colors, name, setTheme, isTransitioning } = useTheme();
92
-
93
- return (
94
- <View style={{ flex: 1, backgroundColor: colors.background }}>
95
- <Text style={{ color: colors.text }}>Current: {name}</Text>
96
- <Pressable
97
- onPress={() => setTheme(name === 'light' ? 'dark' : 'light')}
98
- disabled={isTransitioning}
99
- >
100
- <Text style={{ color: colors.primary }}>Toggle theme</Text>
101
- </Pressable>
102
- </View>
103
- );
104
- }
105
- ```
106
-
107
- ## Contributing
108
-
109
- Contributions are welcome! Please read the [contributing guide](./CONTRIBUTING.md) and open an issue first to discuss what you'd like to change.
110
-
111
- ## License
112
-
113
- MIT
1
+ <h1 align="center">React Native Theme Transition</h1>
2
+
3
+ <p align="center">
4
+ Smooth, animated theme transitions for React Native. Expo Go compatible, powered by Reanimated.
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/react-native-theme-transition"><img src="https://img.shields.io/npm/v/react-native-theme-transition.svg?t=1" alt="npm version" /></a>
9
+ <a href="https://bundlephobia.com/package/react-native-theme-transition"><img src="https://img.shields.io/badge/gzip%20size-2.5%20kB-brightgreen" alt="bundle size" /></a>
10
+ <img src="https://img.shields.io/badge/Expo_Go-compatible-000.svg?logo=expo&logoColor=white" alt="expo compatible" />
11
+ <img src="https://img.shields.io/badge/React_Compiler-compatible-blueviolet.svg" alt="react compiler" />
12
+ <a href="https://github.com/marioprieta/react-native-theme-transition/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/react-native-theme-transition?t=1" alt="license" /></a>
13
+ </p>
14
+
15
+ <table align="center">
16
+ <tr>
17
+ <td align="center"><b>iOS</b></td>
18
+ <td align="center"><b>Android</b></td>
19
+ </tr>
20
+ <tr>
21
+ <td>
22
+ <img src="https://raw.githubusercontent.com/marioprieta/react-native-theme-transition/main/assets/videos/iOS_demo.gif" width="260" alt="iOS demo" />
23
+ </td>
24
+ <td>
25
+ <img src="https://raw.githubusercontent.com/marioprieta/react-native-theme-transition/main/assets/videos/Android_demo.gif" width="260" alt="Android demo" />
26
+ </td>
27
+ </tr>
28
+ </table>
29
+
30
+ ## Features
31
+
32
+ - **Smooth cross-fade transitions** — powered by Reanimated on the native UI thread (60-120 FPS)
33
+ - **Expo Go compatible** — no native code, no prebuilds required
34
+ - **Multi-theme support** — define as many themes as you need with full TypeScript inference
35
+ - **System theme sync** — follows OS appearance automatically with zero-flash startup
36
+ - **Native UI sync** — alerts, keyboards, and date pickers automatically match your active theme
37
+ - **Transition safe** — blocks concurrent transitions and exposes `isTransitioning`
38
+ - **React Compiler ready** — all hooks follow the [Rules of React](https://react.dev/reference/rules)
39
+ - **Lightweight** — ~2.5 kB gzipped, zero runtime dependencies
40
+
41
+ ## Documentation
42
+
43
+ For full docs, API reference, examples, and recipes, visit **[react-native-theme-transition.vercel.app](https://react-native-theme-transition.vercel.app)**.
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ # Expo (SDK 54+ already has reanimated and view-shot)
49
+ npx expo install react-native-theme-transition react-native-worklets
50
+
51
+ # React Native CLI
52
+ npm install react-native-theme-transition react-native-reanimated react-native-view-shot react-native-worklets
53
+ ```
54
+
55
+ Add `react-native-worklets/plugin` as the **last plugin** in your `babel.config.js`.
56
+
57
+ ## Quick start
58
+
59
+ ```ts
60
+ // theme.ts
61
+ import { createThemeTransition } from 'react-native-theme-transition';
62
+
63
+ export const { ThemeTransitionProvider, useTheme } = createThemeTransition({
64
+ themes: {
65
+ light: { background: '#ffffff', text: '#000000', primary: '#007AFF' },
66
+ dark: { background: '#000000', text: '#ffffff', primary: '#0A84FF' },
67
+ },
68
+ });
69
+ ```
70
+
71
+ ```tsx
72
+ // App.tsx
73
+ import { ThemeTransitionProvider } from './theme';
74
+
75
+ export default function App() {
76
+ return (
77
+ <ThemeTransitionProvider initialTheme="system">
78
+ <MyApp />
79
+ </ThemeTransitionProvider>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ```tsx
85
+ // MyScreen.tsx
86
+ import { useTheme } from './theme';
87
+
88
+ function MyScreen() {
89
+ const { colors, name, setTheme, isTransitioning } = useTheme();
90
+
91
+ return (
92
+ <View style={{ flex: 1, backgroundColor: colors.background }}>
93
+ <Text style={{ color: colors.text }}>Current: {name}</Text>
94
+ <Pressable
95
+ onPress={() => setTheme(name === 'light' ? 'dark' : 'light')}
96
+ disabled={isTransitioning}
97
+ >
98
+ <Text style={{ color: colors.primary }}>Toggle theme</Text>
99
+ </Pressable>
100
+ </View>
101
+ );
102
+ }
103
+ ```
104
+
105
+ ## Contributing
106
+
107
+ Contributions are welcome! Please read the [contributing guide](./CONTRIBUTING.md) and open an issue first to discuss what you'd like to change.
108
+
109
+ ## License
110
+
111
+ MIT
package/README.npm.md ADDED
@@ -0,0 +1,111 @@
1
+ <h1 align="center">React Native Theme Transition</h1>
2
+
3
+ <p align="center">
4
+ Smooth, animated theme transitions for React Native. Expo Go compatible, powered by Reanimated.
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/react-native-theme-transition"><img src="https://img.shields.io/npm/v/react-native-theme-transition.svg?t=1" alt="npm version" /></a>
9
+ <a href="https://bundlephobia.com/package/react-native-theme-transition"><img src="https://img.shields.io/badge/gzip%20size-2.5%20kB-brightgreen" alt="bundle size" /></a>
10
+ <img src="https://img.shields.io/badge/Expo_Go-compatible-000.svg?logo=expo&logoColor=white" alt="expo compatible" />
11
+ <img src="https://img.shields.io/badge/React_Compiler-compatible-blueviolet.svg" alt="react compiler" />
12
+ <a href="https://github.com/marioprieta/react-native-theme-transition/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/react-native-theme-transition?t=1" alt="license" /></a>
13
+ </p>
14
+
15
+ <table align="center">
16
+ <tr>
17
+ <td align="center"><b>iOS</b></td>
18
+ <td align="center"><b>Android</b></td>
19
+ </tr>
20
+ <tr>
21
+ <td>
22
+ <img src="https://raw.githubusercontent.com/marioprieta/react-native-theme-transition/main/assets/videos/iOS_demo.gif" width="260" alt="iOS demo" />
23
+ </td>
24
+ <td>
25
+ <img src="https://raw.githubusercontent.com/marioprieta/react-native-theme-transition/main/assets/videos/Android_demo.gif" width="260" alt="Android demo" />
26
+ </td>
27
+ </tr>
28
+ </table>
29
+
30
+ ## Features
31
+
32
+ - **Smooth cross-fade transitions** — powered by Reanimated on the native UI thread (60-120 FPS)
33
+ - **Expo Go compatible** — no native code, no prebuilds required
34
+ - **Multi-theme support** — define as many themes as you need with full TypeScript inference
35
+ - **System theme sync** — follows OS appearance automatically with zero-flash startup
36
+ - **Native UI sync** — alerts, keyboards, and date pickers automatically match your active theme
37
+ - **Transition safe** — blocks concurrent transitions and exposes `isTransitioning`
38
+ - **React Compiler ready** — all hooks follow the [Rules of React](https://react.dev/reference/rules)
39
+ - **Lightweight** — ~2.5 kB gzipped, zero runtime dependencies
40
+
41
+ ## Documentation
42
+
43
+ For full docs, API reference, examples, and recipes, visit **[react-native-theme-transition.vercel.app](https://react-native-theme-transition.vercel.app)**.
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ # Expo (SDK 54+ already has reanimated and view-shot)
49
+ npx expo install react-native-theme-transition react-native-worklets
50
+
51
+ # React Native CLI
52
+ npm install react-native-theme-transition react-native-reanimated react-native-view-shot react-native-worklets
53
+ ```
54
+
55
+ Add `react-native-worklets/plugin` as the **last plugin** in your `babel.config.js`.
56
+
57
+ ## Quick start
58
+
59
+ ```ts
60
+ // theme.ts
61
+ import { createThemeTransition } from 'react-native-theme-transition';
62
+
63
+ export const { ThemeTransitionProvider, useTheme } = createThemeTransition({
64
+ themes: {
65
+ light: { background: '#ffffff', text: '#000000', primary: '#007AFF' },
66
+ dark: { background: '#000000', text: '#ffffff', primary: '#0A84FF' },
67
+ },
68
+ });
69
+ ```
70
+
71
+ ```tsx
72
+ // App.tsx
73
+ import { ThemeTransitionProvider } from './theme';
74
+
75
+ export default function App() {
76
+ return (
77
+ <ThemeTransitionProvider initialTheme="system">
78
+ <MyApp />
79
+ </ThemeTransitionProvider>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ```tsx
85
+ // MyScreen.tsx
86
+ import { useTheme } from './theme';
87
+
88
+ function MyScreen() {
89
+ const { colors, name, setTheme, isTransitioning } = useTheme();
90
+
91
+ return (
92
+ <View style={{ flex: 1, backgroundColor: colors.background }}>
93
+ <Text style={{ color: colors.text }}>Current: {name}</Text>
94
+ <Pressable
95
+ onPress={() => setTheme(name === 'light' ? 'dark' : 'light')}
96
+ disabled={isTransitioning}
97
+ >
98
+ <Text style={{ color: colors.primary }}>Toggle theme</Text>
99
+ </Pressable>
100
+ </View>
101
+ );
102
+ }
103
+ ```
104
+
105
+ ## Contributing
106
+
107
+ Contributions are welcome! Please read the [contributing guide](./CONTRIBUTING.md) and open an issue first to discuss what you'd like to change.
108
+
109
+ ## License
110
+
111
+ MIT
package/package.json CHANGED
@@ -1,87 +1,90 @@
1
- {
2
- "name": "react-native-theme-transition",
3
- "version": "1.0.2",
4
- "description": "Smooth, animated theme and dark mode transitions for React Native. Expo Go compatible, powered by Reanimated.",
5
- "source": "./src/index.ts",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "react-native": "./src/index.ts",
10
- "exports": {
11
- ".": {
12
- "react-native": "./src/index.ts",
13
- "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js",
15
- "default": "./dist/index.js"
16
- },
17
- "./package.json": "./package.json"
18
- },
19
- "sideEffects": false,
20
- "files": [
21
- "src",
22
- "dist",
23
- "README.md",
24
- "LICENSE",
25
- "!**/__tests__",
26
- "!**/.*"
27
- ],
28
- "scripts": {
29
- "prebuild": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
30
- "build": "tsc",
31
- "prepublishOnly": "npm run build",
32
- "release": "npm publish --provenance --access public --dry-run"
33
- },
34
- "keywords": [
35
- "react-native",
36
- "react",
37
- "ios",
38
- "android",
39
- "theme",
40
- "theming",
41
- "dark-mode",
42
- "light-mode",
43
- "switch",
44
- "toggle",
45
- "appearance",
46
- "design-system",
47
- "animation",
48
- "transition",
49
- "view-transition",
50
- "react-native-reanimated",
51
- "reanimated",
52
- "screenshot",
53
- "overlay",
54
- "expo",
55
- "expo-go",
56
- "fabric",
57
- "new-architecture",
58
- "ui"
59
- ],
60
- "license": "MIT",
61
- "repository": {
62
- "type": "git",
63
- "url": "git+https://github.com/marioprieta/react-native-theme-transition.git"
64
- },
65
- "bugs": {
66
- "url": "https://github.com/marioprieta/react-native-theme-transition/issues"
67
- },
68
- "homepage": "https://react-native-theme-transition.vercel.app",
69
- "author": "Mario Prieta",
70
- "peerDependencies": {
71
- "react": ">=18.0.0",
72
- "react-native": ">=0.76.0",
73
- "react-native-reanimated": ">=4.0.0",
74
- "react-native-view-shot": ">=3.0.0",
75
- "react-native-worklets": ">=0.5.0"
76
- },
77
- "devDependencies": {
78
- "@changesets/cli": "^2.30.0",
79
- "@types/react": "~19.2.2",
80
- "react": "19.2.0",
81
- "react-native": "0.83.2",
82
- "react-native-reanimated": "4.2.1",
83
- "react-native-view-shot": "4.0.3",
84
- "react-native-worklets": "0.7.2",
85
- "typescript": "~5.9.2"
86
- }
87
- }
1
+ {
2
+ "name": "react-native-theme-transition",
3
+ "version": "1.0.3",
4
+ "description": "Smooth, animated theme and dark mode transitions for React Native. Expo Go compatible, powered by Reanimated.",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "react-native": "./src/index.ts",
10
+ "exports": {
11
+ ".": {
12
+ "react-native": "./src/index.ts",
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "sideEffects": false,
20
+ "files": [
21
+ "src",
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE",
25
+ "!**/__tests__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "prebuild": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
30
+ "build": "tsc",
31
+ "prepack": "cp README.npm.md README.md",
32
+ "postpack": "git checkout README.md",
33
+ "prepublishOnly": "npm run build",
34
+ "release": "npm publish --provenance --access public",
35
+ "release:dry": "npm publish --provenance --access public --dry-run"
36
+ },
37
+ "keywords": [
38
+ "react-native",
39
+ "react",
40
+ "ios",
41
+ "android",
42
+ "theme",
43
+ "theming",
44
+ "dark-mode",
45
+ "light-mode",
46
+ "switch",
47
+ "toggle",
48
+ "appearance",
49
+ "design-system",
50
+ "animation",
51
+ "transition",
52
+ "view-transition",
53
+ "react-native-reanimated",
54
+ "reanimated",
55
+ "screenshot",
56
+ "overlay",
57
+ "expo",
58
+ "expo-go",
59
+ "fabric",
60
+ "new-architecture",
61
+ "ui"
62
+ ],
63
+ "license": "MIT",
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "git+https://github.com/marioprieta/react-native-theme-transition.git"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/marioprieta/react-native-theme-transition/issues"
70
+ },
71
+ "homepage": "https://react-native-theme-transition.vercel.app",
72
+ "author": "Mario Prieta",
73
+ "peerDependencies": {
74
+ "react": ">=18.0.0",
75
+ "react-native": ">=0.76.0",
76
+ "react-native-reanimated": ">=4.0.0",
77
+ "react-native-view-shot": ">=3.0.0",
78
+ "react-native-worklets": ">=0.5.0"
79
+ },
80
+ "devDependencies": {
81
+ "@changesets/cli": "^2.30.0",
82
+ "@types/react": "~19.2.2",
83
+ "react": "19.2.0",
84
+ "react-native": "0.83.2",
85
+ "react-native-reanimated": "4.2.1",
86
+ "react-native-view-shot": "4.0.3",
87
+ "react-native-worklets": "0.7.2",
88
+ "typescript": "~5.9.2"
89
+ }
90
+ }