react-native-tauri 0.0.1

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/.eslintrc.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "eslint:recommended",
9
+ "plugin:react/recommended",
10
+ "plugin:react-hooks/recommended"
11
+ ],
12
+ "parserOptions": {
13
+ "ecmaVersion": "latest",
14
+ "sourceType": "module",
15
+ "ecmaFeatures": {
16
+ "jsx": true
17
+ }
18
+ },
19
+ "settings": {
20
+ "react": {
21
+ "version": "detect"
22
+ }
23
+ },
24
+ "rules": {
25
+ "react/react-in-jsx-scope": "off",
26
+ "react/prop-types": "off",
27
+ "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }]
28
+ }
29
+ }
package/.gitignore ADDED
@@ -0,0 +1,49 @@
1
+ # Dependencies
2
+ node_modules/
3
+ package-lock.json
4
+ yarn.lock
5
+ pnpm-lock.yaml
6
+
7
+ # Build outputs
8
+ dist/
9
+ build/
10
+ *.tsbuildinfo
11
+
12
+ # Vite
13
+ .vite/
14
+
15
+ # Environment variables
16
+ .env
17
+ .env.local
18
+ .env.*.local
19
+
20
+ # IDE
21
+ .vscode/
22
+ .idea/
23
+ *.swp
24
+ *.swo
25
+ *~
26
+ .DS_Store
27
+ *.sublime-project
28
+ *.sublime-workspace
29
+
30
+ # OS
31
+ Thumbs.db
32
+ .DS_Store
33
+
34
+ # Logs
35
+ npm-debug.log*
36
+ yarn-debug.log*
37
+ yarn-error.log*
38
+ lerna-debug.log*
39
+ .pnpm-debug.log*
40
+
41
+ # Coverage
42
+ coverage/
43
+ .nyc_output/
44
+
45
+ # Testing
46
+ .mocha-result.json
47
+
48
+ # Tauri
49
+ src-tauri/target/
@@ -0,0 +1,2 @@
1
+ node_modules/
2
+ package-lock.json
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "trailingComma": "es5",
6
+ "bracketSpacing": true,
7
+ "arrowParens": "always",
8
+ "printWidth": 100,
9
+ "endOfLine": "lf"
10
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2025-03-16
9
+
10
+ ### Added
11
+ - Initial release of React Native Tauri integration
12
+ - Vite build configuration with React support
13
+ - React Native Web compatibility layer
14
+ - Tauri development and build commands
15
+ - TypeScript support
16
+ - React and React Native Web dependencies
17
+
18
+ ### Features
19
+ - Fast development server with Vite
20
+ - Cross-platform desktop application support
21
+ - React 18 integration
22
+ - React Native Web polyfills
23
+ - Tauri API integration
24
+
25
+ ## Unreleased
26
+
27
+ ### Planned
28
+ - Better documentation
29
+ - Example applications
30
+ - Unit testing setup
31
+ - CI/CD pipeline
@@ -0,0 +1,78 @@
1
+ # Contributing to React Native Tauri
2
+
3
+ Thank you for your interest in contributing! We welcome contributions from the community.
4
+
5
+ ## How to Contribute
6
+
7
+ 1. **Fork the repository** on GitHub
8
+ 2. **Clone your fork** locally:
9
+ ```bash
10
+ git clone https://github.com/your-username/react-native-tauri.git
11
+ cd react-native-tauri
12
+ ```
13
+
14
+ 3. **Create a new branch** for your changes:
15
+ ```bash
16
+ git checkout -b feature/your-feature-name
17
+ # or for bug fixes:
18
+ git checkout -b fix/bug-description
19
+ ```
20
+
21
+ 4. **Install dependencies**:
22
+ ```bash
23
+ npm install
24
+ ```
25
+
26
+ 5. **Make your changes** and test them:
27
+ ```bash
28
+ npm run dev
29
+ npm run build
30
+ ```
31
+
32
+ 6. **Commit your changes** with clear messages:
33
+ ```bash
34
+ git commit -m "feat: add new feature"
35
+ # or
36
+ git commit -m "fix: resolve issue description"
37
+ ```
38
+
39
+ 7. **Push to your fork**:
40
+ ```bash
41
+ git push origin feature/your-feature-name
42
+ ```
43
+
44
+ 8. **Create a Pull Request** on GitHub with a clear description
45
+
46
+ ## Code Style
47
+
48
+ - Follow the existing code style
49
+ - Use ESLint and Prettier for code formatting
50
+ - Run `npm run format` before committing
51
+ - Write clear commit messages
52
+ - Add comments for complex logic
53
+
54
+ ## Testing
55
+
56
+ - Ensure your changes don't break existing functionality
57
+ - Test on multiple platforms if possible
58
+ - Add tests for new features when applicable
59
+
60
+ ## Reporting Issues
61
+
62
+ - Use GitHub Issues for bug reports
63
+ - Provide clear descriptions and reproduction steps
64
+ - Include your environment details (OS, Node version, etc.)
65
+ - Attach screenshots or logs if relevant
66
+
67
+ ## Development Standards
68
+
69
+ - Follow semantic versioning when tagging releases
70
+ - Update CHANGELOG.md with your changes
71
+ - Ensure all tests pass before submitting PR
72
+ - Include documentation updates if needed
73
+
74
+ ## Questions?
75
+
76
+ Feel free to open an issue or contact the maintainers.
77
+
78
+ Thank you for contributing! 🎉
@@ -0,0 +1,156 @@
1
+ # Getting Started with React Native Tauri
2
+
3
+ ## Prerequisites
4
+
5
+ - **Node.js**: 18.0.0 or higher ([Download](https://nodejs.org/))
6
+ - **npm**: 9.0.0 or higher (usually comes with Node.js)
7
+ - **Tauri CLI**: Install it with your project dependencies
8
+
9
+ ## Quick Start
10
+
11
+ ### 1. Installation
12
+
13
+ ```bash
14
+ npm install
15
+ ```
16
+
17
+ ### 2. Development
18
+
19
+ Start the development server:
20
+
21
+ ```bash
22
+ npm run dev
23
+ ```
24
+
25
+ This will start a Vite development server on `http://localhost:3000`.
26
+
27
+ For Tauri development with hot reload:
28
+
29
+ ```bash
30
+ npm run tauri:dev
31
+ ```
32
+
33
+ ### 3. Build for Production
34
+
35
+ Create an optimized build:
36
+
37
+ ```bash
38
+ npm run build
39
+ ```
40
+
41
+ Build a desktop application with Tauri:
42
+
43
+ ```bash
44
+ npm run tauri:build
45
+ ```
46
+
47
+ ### 4. Preview Production Build
48
+
49
+ Preview the production build locally:
50
+
51
+ ```bash
52
+ npm run preview
53
+ ```
54
+
55
+ ## Project Structure
56
+
57
+ ```
58
+ react-native-tauri/
59
+ ├── index.html # HTML entry point
60
+ ├── index.js # React app entry point
61
+ ├── empty.js # Polyfill for React Native modules
62
+ ├── vite.config.ts # Vite configuration
63
+ ├── tsconfig.json # TypeScript configuration
64
+ ├── package.json # Dependencies and scripts
65
+ └── README.md # This file
66
+ ```
67
+
68
+ ## Available Scripts
69
+
70
+ | Command | Description |
71
+ |---------|-------------|
72
+ | `npm run dev` | Start Vite development server |
73
+ | `npm run build` | Build for production (web) |
74
+ | `npm run preview` | Preview production build |
75
+ | `npm run tauri:dev` | Start Tauri development mode |
76
+ | `npm run tauri:build` | Build desktop application |
77
+
78
+ ## Technology Stack
79
+
80
+ - **React 18.3.1** - UI library
81
+ - **Vite 6.4.1** - Build tool
82
+ - **React Native Web 0.19.0** - React Native compatibility
83
+ - **Tauri 2.10.1** - Desktop app framework
84
+ - **TypeScript** - Programming language
85
+
86
+ ## Key Features
87
+
88
+ ✨ **Fast Development** - Powered by Vite
89
+ 📱 **Cross-Platform** - Build for web and desktop
90
+ ⚛️ **React Native** - Use React Native components
91
+ 🔗 **Native Integration** - Access system APIs via Tauri
92
+ 📦 **Modern Stack** - Latest versions of all tools
93
+
94
+ ## Configuration
95
+
96
+ ### Vite Config (`vite.config.ts`)
97
+
98
+ The project includes special aliases for React Native modules:
99
+ - `react-native` → `react-native-web`
100
+ - `react-native-fs` → polyfill (empty.js)
101
+ - `react-native-blob-util` → polyfill (empty.js)
102
+
103
+ ### TypeScript Config (`tsconfig.json`)
104
+
105
+ Configured to support JSX and modern JavaScript features.
106
+
107
+ ## Environment Support
108
+
109
+ - **macOS** - 10.13+
110
+ - **Windows** - 10+
111
+ - **Linux** - distributions supporting GTK 3.6+
112
+
113
+ ## Troubleshooting
114
+
115
+ ### Port 3000 already in use
116
+
117
+ Change the port in `vite.config.ts`:
118
+ ```typescript
119
+ server: {
120
+ port: 3001, // Change this
121
+ host: 'localhost',
122
+ }
123
+ ```
124
+
125
+ ### Module not found errors
126
+
127
+ Ensure all dependencies are installed:
128
+ ```bash
129
+ npm install
130
+ ```
131
+
132
+ ### Build failures
133
+
134
+ Clear Vite cache and reinstall:
135
+ ```bash
136
+ rm -rf node_modules
137
+ npm install
138
+ npm run build
139
+ ```
140
+
141
+ ## Additional Resources
142
+
143
+ - [Tauri Documentation](https://tauri.app/)
144
+ - [React Documentation](https://react.dev/)
145
+ - [Vite Guide](https://vitejs.dev/guide/)
146
+ - [React Native Web](https://necolas.github.io/react-native-web/)
147
+
148
+ ## Getting Help
149
+
150
+ - 📖 Check the [documentation](README.md)
151
+ - 🐛 Report bugs on [GitHub Issues](https://github.com/yourusername/react-native-tauri/issues)
152
+ - 💬 Discuss on [GitHub Discussions](https://github.com/yourusername/react-native-tauri/discussions)
153
+
154
+ ## License
155
+
156
+ MIT License - See [LICENSE](LICENSE) file for details
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # React Native Tauri
2
+
3
+ A modern JavaScript/TypeScript module that integrates React Native with Tauri for building cross-platform desktop applications with web technologies.
4
+
5
+ ## Features
6
+
7
+ - 🚀 Built with Vite for fast development
8
+ - ⚛️ React and React Native Web integration
9
+ - 🔗 Seamless Tauri integration
10
+ - 🎯 TypeScript support
11
+ - 📦 Optimized for production builds
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install tauri
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Basic Setup
22
+
23
+ ```javascript
24
+ import React from 'react'
25
+ import { createRoot } from 'react-dom/client'
26
+ import App from './App'
27
+
28
+ const rootElement = document.getElementById('root')
29
+
30
+ if (rootElement) {
31
+ createRoot(rootElement).render(<App />)
32
+ }
33
+ ```
34
+
35
+ ### Tauri Integration
36
+
37
+ ```javascript
38
+ import { invoke } from '@tauri-apps/api/tauri'
39
+
40
+ // Call your Tauri commands
41
+ invoke('your_command', { /* args */ })
42
+ ```
43
+
44
+ ## Development
45
+
46
+ ```bash
47
+ # Start development server
48
+ npm run dev
49
+
50
+ # Start Tauri development environment
51
+ npm run tauri:dev
52
+
53
+ # Build for production
54
+ npm run build
55
+
56
+ # Build with Tauri
57
+ npm run tauri:build
58
+
59
+ # Preview production build
60
+ npm run preview
61
+ ```
62
+
63
+ ## Requirements
64
+
65
+ - Node.js 18.0.0 or higher
66
+ - npm 9.0.0 or higher
67
+ - Tauri 2.10.1 or higher
68
+
69
+ ## Dependencies
70
+
71
+ - React 18.3.1
72
+ - React DOM 18.3.1
73
+ - React Native Web 0.19.0
74
+ - Vite 6.4.1
75
+ - Tauri Apps CLI & API 2.10.1
76
+
77
+ ## License
78
+
79
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
80
+
81
+ ## Contributing
82
+
83
+ Contributions are welcome! Please feel free to submit a Pull Request.
84
+
85
+ ## Bug Reports
86
+
87
+ If you find a bug, please [open an issue](https://github.com/yourusername/react-native-tauri/issues) with a clear description.
88
+
89
+ ## Support
90
+
91
+ For more information and documentation, visit:
92
+ - [Tauri Documentation](https://tauri.app)
93
+ - [React Documentation](https://react.dev)
94
+ - [Vite Documentation](https://vitejs.dev)
package/empty.js ADDED
@@ -0,0 +1,4 @@
1
+ // Minimal shim for native-only modules when running web/dev
2
+ const empty = {};
3
+ export default empty;
4
+ module.exports = exports.default = empty;
package/index.html ADDED
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>MyApp</title>
8
+ <style id="react-native-stylesheet"></style>
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ <script type="module" src="index.js"></script>
13
+ </body>
14
+
15
+ </html>
package/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import App from '../App'
4
+
5
+ const rootElement = document.getElementById('root')
6
+
7
+ console.log('Document ready, root element:', rootElement)
8
+
9
+ if (rootElement) {
10
+ try {
11
+ createRoot(rootElement).render(<App />)
12
+ console.log('App rendered successfully')
13
+ } catch (error) {
14
+ console.error('Error rendering app:', error)
15
+ rootElement.innerHTML = `<div style="color: red; padding: 20px; font-family: monospace; white-space: pre-wrap;">Error: ${error.message}\n${error.stack}</div>`
16
+ }
17
+ } else {
18
+ console.error('Root element not found')
19
+ document.body.innerHTML = '<div style="color: red; padding: 20px; font-family: monospace;">Root element not found</div>'
20
+ }
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "react-native-tauri",
3
+ "version": "0.0.1",
4
+ "description": "A modern JavaScript/TypeScript module that integrates React Native with Tauri for building cross-platform desktop applications",
5
+ "main": "index.js",
6
+ "author": {
7
+ "name": "Your Name",
8
+ "email": "your.email@example.com",
9
+ "url": "https://github.com/yourusername"
10
+ },
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/yourusername/react-native-tauri.git"
15
+ },
16
+ "homepage": "https://github.com/yourusername/react-native-tauri#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/yourusername/react-native-tauri/issues",
19
+ "email": "your.email@example.com"
20
+ },
21
+ "keywords": [
22
+ "react",
23
+ "react-native",
24
+ "tauri",
25
+ "desktop",
26
+ "cross-platform",
27
+ "vite",
28
+ "typescript",
29
+ "javascript",
30
+ "gui",
31
+ "app"
32
+ ],
33
+ "scripts": {
34
+ "dev": "vite",
35
+ "build": "vite build",
36
+ "preview": "vite preview",
37
+ "tauri:dev": "tauri dev",
38
+ "tauri:build": "tauri build"
39
+ },
40
+ "files": [
41
+ "index.js",
42
+ "index.html",
43
+ "empty.js",
44
+ "vite.config.ts",
45
+ "tsconfig.json",
46
+ "package.json",
47
+ "README.md",
48
+ "LICENSE",
49
+ "CHANGELOG.md",
50
+ "CONTRIBUTING.md",
51
+ "GETTING_STARTED.md",
52
+ ".eslintrc.json",
53
+ ".prettierrc",
54
+ ".prettierignore",
55
+ ".gitignore"
56
+ ],
57
+ "engines": {
58
+ "node": ">=18.0.0",
59
+ "npm": ">=9.0.0"
60
+ },
61
+ "devDependencies": {
62
+ "@tauri-apps/api": "^2.10.1",
63
+ "@tauri-apps/cli": "^2.10.1",
64
+ "@vitejs/plugin-react": "^4.7.0",
65
+ "vite": "^6.4.1"
66
+ },
67
+ "dependencies": {
68
+ "postcss-value-parser": "^4.2.0",
69
+ "react": "18.3.1",
70
+ "react-dom": "18.3.1",
71
+ "react-native-web": "0.19.0"
72
+ }
73
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "esModuleInterop": true,
9
+ "allowSyntheticDefaultImports": true,
10
+ "strict": true,
11
+ "noImplicitAny": true,
12
+ "strictNullChecks": true,
13
+ "strictFunctionTypes": true,
14
+ "resolveJsonModule": true,
15
+ "declaration": true,
16
+ "declarationMap": true,
17
+ "sourceMap": true,
18
+ "moduleResolution": "bundler",
19
+ "allowImportingTsExtensions": true,
20
+ "noEmit": false,
21
+ "outDir": "./dist",
22
+ "baseUrl": ".",
23
+ "paths": {
24
+ "@/*": ["./src/*"]
25
+ },
26
+ "jsx": "react-jsx"
27
+ },
28
+ "include": ["index.js", "index.html", "vite.config.ts", "src/**/*"],
29
+ "exclude": ["node_modules", "dist", "build"]
30
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import path from 'path'
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ react({
8
+ include: /\.(jsx|js|tsx|ts)$/, // Use regex to include .js files
9
+ }),
10
+ ],
11
+ root: '.',
12
+ server: {
13
+ port: 3000,
14
+ host: 'localhost',
15
+ },
16
+ resolve: {
17
+ alias: [
18
+ { find: /^react-native$/, replacement: 'react-native-web' },
19
+ { find: /^react-native\/(.*)/, replacement: 'react-native-web/dist/index.js' },
20
+ { find: 'react-native-web', replacement: path.resolve(__dirname, 'node_modules/react-native-web/dist/index.js') },
21
+ { find: 'react-native-fs', replacement: path.resolve(__dirname, './empty.js') },
22
+ { find: 'react-native-blob-util', replacement: path.resolve(__dirname, './empty.js') },
23
+ { find: 'react-native-vector-icons', replacement: path.resolve(__dirname, 'node_modules/react-native-vector-icons/dist/index.es.js') },
24
+ ],
25
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
26
+ },
27
+ build: {
28
+ outDir: '../build',
29
+ target: 'es2020',
30
+ },
31
+ esbuild: {
32
+ loader: 'tsx',
33
+ include: /\.(jsx|js|tsx|ts)$/,
34
+ exclude: [],
35
+ },
36
+ optimizeDeps: {
37
+ include: ['react-native', 'react-native-web'],
38
+ exclude: [],
39
+ esbuildOptions: {
40
+ loader: {
41
+ '.js': 'tsx',
42
+ '.mjs': 'tsx',
43
+ },
44
+ },
45
+ },
46
+ })