@accessibility-rn-js/react-native-accessibility-toolkit 1.0.0
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/CHECKLIST.md +228 -0
- package/INSTALLATION_GUIDE.md +270 -0
- package/PLUGIN_STATUS.md +206 -0
- package/README.md +251 -0
- package/package.json +49 -0
- package/setup.sh +40 -0
- package/src/components/AccessibilityButton.js +56 -0
- package/src/components/AccessibleText.js +50 -0
- package/src/context/AccessibilityContext.js +125 -0
- package/src/hooks/useDynamicColors.js +32 -0
- package/src/hooks/usePageRead.js +75 -0
- package/src/hooks/useThemeColors.js +169 -0
- package/src/index.js +49 -0
- package/src/services/AccessibilityStorage.js +40 -0
- package/src/services/NativeAccessibilityBridge.js +171 -0
- package/src/services/TTSService.js +117 -0
- package/src/utils/AccessibilityUtils.js +223 -0
- package/src/utils/Colors.js +203 -0
- package/src/utils/Fonts.js +24 -0
package/CHECKLIST.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Pre-Publication Checklist
|
|
2
|
+
|
|
3
|
+
## 🔍 Before Publishing to NPM
|
|
4
|
+
|
|
5
|
+
### 1. Package Configuration
|
|
6
|
+
- [ ] Update package name in `package.json` from `@yourorg/react-native-accessibility-toolkit` to your actual package name
|
|
7
|
+
- Example: `@mycompany/react-native-accessibility` or `react-native-my-accessibility`
|
|
8
|
+
- [ ] Update author information
|
|
9
|
+
```json
|
|
10
|
+
"author": "Your Name <your.email@example.com>"
|
|
11
|
+
```
|
|
12
|
+
- [ ] Update repository URLs
|
|
13
|
+
```json
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/yourusername/your-repo-name.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/yourusername/your-repo-name/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/yourusername/your-repo-name#readme"
|
|
22
|
+
```
|
|
23
|
+
- [ ] Set appropriate version (recommend starting with `0.1.0` or `1.0.0`)
|
|
24
|
+
|
|
25
|
+
### 2. Test Locally
|
|
26
|
+
```bash
|
|
27
|
+
cd PLUGIN_SETUP
|
|
28
|
+
npm install --legacy-peer-deps
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- [ ] Check for any installation errors
|
|
32
|
+
- [ ] Verify all peer dependencies are correct
|
|
33
|
+
|
|
34
|
+
### 3. Test in Your Project
|
|
35
|
+
```bash
|
|
36
|
+
# From your main project directory
|
|
37
|
+
npm install ../PLUGIN_SETUP
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- [ ] Import and test basic functionality:
|
|
41
|
+
```javascript
|
|
42
|
+
import { AccessibilityProvider, useAccessibility } from 'your-package-name';
|
|
43
|
+
```
|
|
44
|
+
- [ ] Verify AccessibleText component works
|
|
45
|
+
- [ ] Verify AccessibilityButton appears
|
|
46
|
+
- [ ] Test color hooks
|
|
47
|
+
- [ ] Test TTS functionality
|
|
48
|
+
|
|
49
|
+
### 4. Create .npmignore
|
|
50
|
+
Create `.npmignore` file in PLUGIN_SETUP:
|
|
51
|
+
```
|
|
52
|
+
node_modules/
|
|
53
|
+
.git/
|
|
54
|
+
.DS_Store
|
|
55
|
+
*.log
|
|
56
|
+
__tests__/
|
|
57
|
+
coverage/
|
|
58
|
+
.vscode/
|
|
59
|
+
.idea/
|
|
60
|
+
PLUGIN_STATUS.md
|
|
61
|
+
CHECKLIST.md
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 5. Add LICENSE File
|
|
65
|
+
Create `LICENSE` file in PLUGIN_SETUP:
|
|
66
|
+
```
|
|
67
|
+
MIT License
|
|
68
|
+
|
|
69
|
+
Copyright (c) 2026 Your Name
|
|
70
|
+
|
|
71
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
72
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
73
|
+
in the Software without restriction...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 6. Version Control
|
|
77
|
+
```bash
|
|
78
|
+
cd PLUGIN_SETUP
|
|
79
|
+
git init
|
|
80
|
+
git add .
|
|
81
|
+
git commit -m "Initial commit - Accessibility plugin v1.0.0"
|
|
82
|
+
git remote add origin your-repo-url
|
|
83
|
+
git push -u origin main
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 7. NPM Publishing
|
|
87
|
+
|
|
88
|
+
#### First Time Setup
|
|
89
|
+
```bash
|
|
90
|
+
npm login
|
|
91
|
+
# Enter your npm username, password, and email
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Publish
|
|
95
|
+
```bash
|
|
96
|
+
cd PLUGIN_SETUP
|
|
97
|
+
|
|
98
|
+
# Dry run first (see what will be published)
|
|
99
|
+
npm publish --dry-run
|
|
100
|
+
|
|
101
|
+
# If scoped package (recommended for organization)
|
|
102
|
+
npm publish --access public
|
|
103
|
+
|
|
104
|
+
# Or if unscoped
|
|
105
|
+
npm publish
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## ✅ Post-Publication
|
|
109
|
+
|
|
110
|
+
### 1. Verify Package
|
|
111
|
+
- [ ] Check package on npmjs.com: `https://www.npmjs.com/package/your-package-name`
|
|
112
|
+
- [ ] Verify README displays correctly
|
|
113
|
+
- [ ] Check version number
|
|
114
|
+
|
|
115
|
+
### 2. Install from NPM
|
|
116
|
+
```bash
|
|
117
|
+
# In a test project
|
|
118
|
+
npm install your-package-name
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- [ ] Verify installation works
|
|
122
|
+
- [ ] Test basic imports
|
|
123
|
+
|
|
124
|
+
### 3. Update Main Project
|
|
125
|
+
```bash
|
|
126
|
+
# In your main project
|
|
127
|
+
npm uninstall ../PLUGIN_SETUP
|
|
128
|
+
npm install your-package-name
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 🔄 Updating the Package
|
|
132
|
+
|
|
133
|
+
### For bug fixes (patch version)
|
|
134
|
+
```bash
|
|
135
|
+
npm version patch # 1.0.0 -> 1.0.1
|
|
136
|
+
npm publish
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### For new features (minor version)
|
|
140
|
+
```bash
|
|
141
|
+
npm version minor # 1.0.0 -> 1.1.0
|
|
142
|
+
npm publish
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### For breaking changes (major version)
|
|
146
|
+
```bash
|
|
147
|
+
npm version major # 1.0.0 -> 2.0.0
|
|
148
|
+
npm publish
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 📝 Recommended Package Names
|
|
152
|
+
|
|
153
|
+
Good names follow this pattern:
|
|
154
|
+
- `react-native-accessibility-toolkit`
|
|
155
|
+
- `@mycompany/react-native-accessibility`
|
|
156
|
+
- `react-native-my-accessibility-plugin`
|
|
157
|
+
|
|
158
|
+
## ⚠️ Important Notes
|
|
159
|
+
|
|
160
|
+
1. **Package names must be unique** on npm - check availability first:
|
|
161
|
+
```bash
|
|
162
|
+
npm search your-proposed-package-name
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
2. **Peer dependencies** are correct - users will need to install:
|
|
166
|
+
- `react-native-tts`
|
|
167
|
+
- `@react-native-async-storage/async-storage`
|
|
168
|
+
- `react-native-vector-icons`
|
|
169
|
+
|
|
170
|
+
3. **Version 0.1.0 suggestion**: Since not all components are migrated yet, consider publishing as beta:
|
|
171
|
+
```json
|
|
172
|
+
"version": "0.1.0-beta.1"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
4. **Scope packages** (@yourorg/package-name) require:
|
|
176
|
+
- npm organization account OR
|
|
177
|
+
- `--access public` flag when publishing
|
|
178
|
+
|
|
179
|
+
## 🎯 Quick Publish Commands
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Navigate to plugin
|
|
183
|
+
cd PLUGIN_SETUP
|
|
184
|
+
|
|
185
|
+
# Update package.json with your details
|
|
186
|
+
# (name, author, repository)
|
|
187
|
+
|
|
188
|
+
# Install dependencies
|
|
189
|
+
npm install --legacy-peer-deps
|
|
190
|
+
|
|
191
|
+
# Login to npm (if not already)
|
|
192
|
+
npm login
|
|
193
|
+
|
|
194
|
+
# Publish
|
|
195
|
+
npm publish --access public
|
|
196
|
+
|
|
197
|
+
# Done! 🎉
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## 📞 Troubleshooting
|
|
201
|
+
|
|
202
|
+
### "Package name already exists"
|
|
203
|
+
- Choose a different name
|
|
204
|
+
- Add your org scope: `@yourorg/package-name`
|
|
205
|
+
- Add a unique suffix
|
|
206
|
+
|
|
207
|
+
### "You need to authorize this machine"
|
|
208
|
+
```bash
|
|
209
|
+
npm login
|
|
210
|
+
npm publish --otp=123456 # Use 2FA code if enabled
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### "Module not found" after installation
|
|
214
|
+
- Ensure `"main": "src/index.js"` in package.json
|
|
215
|
+
- Verify exports in src/index.js
|
|
216
|
+
|
|
217
|
+
## ✨ Success Indicators
|
|
218
|
+
|
|
219
|
+
You'll know it worked when:
|
|
220
|
+
- ✅ Package appears on npmjs.com
|
|
221
|
+
- ✅ `npm install your-package-name` works in any project
|
|
222
|
+
- ✅ Can import: `import { AccessibilityProvider } from 'your-package-name'`
|
|
223
|
+
- ✅ Components render without errors
|
|
224
|
+
- ✅ Context provides accessibility state
|
|
225
|
+
|
|
226
|
+
## 🚀 You're Ready!
|
|
227
|
+
|
|
228
|
+
Once checklist is complete, your plugin will be published and usable in any React Native project!
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Installation & Setup Guide
|
|
2
|
+
|
|
3
|
+
## 📦 Converting Your Project to an NPM Package
|
|
4
|
+
|
|
5
|
+
### Step 1: Prepare Your Code Structure
|
|
6
|
+
|
|
7
|
+
1. **Copy accessibility files** from your current project:
|
|
8
|
+
```
|
|
9
|
+
src/accessibility/ → PLUGIN_SETUP/src/
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
2. **Remove project-specific dependencies**:
|
|
13
|
+
- Remove references to `Global.js` (replace with Context API)
|
|
14
|
+
- Remove references to `GlobalStyles` (make them configurable)
|
|
15
|
+
- Remove references to `Colors` utility (use theme system)
|
|
16
|
+
|
|
17
|
+
### Step 2: Make Code Generic
|
|
18
|
+
|
|
19
|
+
Replace hardcoded paths and imports:
|
|
20
|
+
|
|
21
|
+
**Before:**
|
|
22
|
+
```javascript
|
|
23
|
+
import Colors from '../utils/Colors';
|
|
24
|
+
import GlobalStyles from '../utils/GlobalStyles';
|
|
25
|
+
import Global from '../screens/Global';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**After:**
|
|
29
|
+
```javascript
|
|
30
|
+
import { useAccessibility } from './context/AccessibilityContext';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Step 3: Setup Git Repository
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd PLUGIN_SETUP
|
|
37
|
+
git init
|
|
38
|
+
git add .
|
|
39
|
+
git commit -m "Initial commit: React Native Accessibility Toolkit"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 4: Create GitHub Repository
|
|
43
|
+
|
|
44
|
+
1. Go to https://github.com/new
|
|
45
|
+
2. Name it: `react-native-accessibility-toolkit`
|
|
46
|
+
3. Push your code:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git remote add origin https://github.com/yourorg/react-native-accessibility-toolkit.git
|
|
50
|
+
git branch -M main
|
|
51
|
+
git push -u origin main
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Step 5: Publish to NPM
|
|
55
|
+
|
|
56
|
+
1. **Create NPM Account**: https://www.npmjs.com/signup
|
|
57
|
+
|
|
58
|
+
2. **Login to NPM**:
|
|
59
|
+
```bash
|
|
60
|
+
npm login
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
3. **Publish Package**:
|
|
64
|
+
```bash
|
|
65
|
+
cd PLUGIN_SETUP
|
|
66
|
+
npm publish --access public
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
4. **Update Version** (for future updates):
|
|
70
|
+
```bash
|
|
71
|
+
npm version patch # 1.0.0 → 1.0.1
|
|
72
|
+
npm version minor # 1.0.0 → 1.1.0
|
|
73
|
+
npm version major # 1.0.0 → 2.0.0
|
|
74
|
+
npm publish
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 🔧 Using the Plugin in Other Projects
|
|
78
|
+
|
|
79
|
+
### Installation in New Project
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Create new React Native project
|
|
83
|
+
npx react-native init MyAccessibleApp
|
|
84
|
+
|
|
85
|
+
# Navigate to project
|
|
86
|
+
cd MyAccessibleApp
|
|
87
|
+
|
|
88
|
+
# Install your plugin
|
|
89
|
+
npm install @yourorg/react-native-accessibility-toolkit
|
|
90
|
+
|
|
91
|
+
# Install peer dependencies
|
|
92
|
+
npm install react-native-tts @react-native-async-storage/async-storage react-native-draggable @miblanchard/react-native-slider react-native-element-dropdown
|
|
93
|
+
|
|
94
|
+
# iOS setup
|
|
95
|
+
cd ios && pod install && cd ..
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Setup in App.js
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
import React from 'react';
|
|
102
|
+
import { SafeAreaView, StyleSheet, Text, View } from 'react-native';
|
|
103
|
+
import {
|
|
104
|
+
AccessibilityProvider,
|
|
105
|
+
AccessibilityButton,
|
|
106
|
+
AccessibilityModal,
|
|
107
|
+
useAccessibility,
|
|
108
|
+
useDynamicColors
|
|
109
|
+
} from '@yourorg/react-native-accessibility-toolkit';
|
|
110
|
+
|
|
111
|
+
function HomeScreen() {
|
|
112
|
+
const { fontScale, letterSpacing } = useAccessibility();
|
|
113
|
+
const colors = useDynamicColors();
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<View style={[styles.container, { backgroundColor: colors.defaultBackground }]}>
|
|
117
|
+
<Text
|
|
118
|
+
style={{
|
|
119
|
+
fontSize: 20 * fontScale,
|
|
120
|
+
letterSpacing: letterSpacing,
|
|
121
|
+
color: colors.primaryTextColor,
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
Welcome to My Accessible App!
|
|
125
|
+
</Text>
|
|
126
|
+
|
|
127
|
+
{/* Floating accessibility button */}
|
|
128
|
+
<AccessibilityButton />
|
|
129
|
+
|
|
130
|
+
{/* Settings modal */}
|
|
131
|
+
<AccessibilityModal />
|
|
132
|
+
</View>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export default function App() {
|
|
137
|
+
return (
|
|
138
|
+
<AccessibilityProvider>
|
|
139
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
140
|
+
<HomeScreen />
|
|
141
|
+
</SafeAreaView>
|
|
142
|
+
</AccessibilityProvider>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const styles = StyleSheet.create({
|
|
147
|
+
container: {
|
|
148
|
+
flex: 1,
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
padding: 20,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 📱 Testing the Plugin
|
|
157
|
+
|
|
158
|
+
### Test Locally Before Publishing
|
|
159
|
+
|
|
160
|
+
Use `npm link` to test locally:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# In plugin directory
|
|
164
|
+
cd PLUGIN_SETUP
|
|
165
|
+
npm link
|
|
166
|
+
|
|
167
|
+
# In your test app
|
|
168
|
+
cd ../MyTestApp
|
|
169
|
+
npm link @yourorg/react-native-accessibility-toolkit
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Unlink After Testing
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm unlink @yourorg/react-native-accessibility-toolkit
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## 🚀 Distribution Options
|
|
179
|
+
|
|
180
|
+
### Option 1: Public NPM Package
|
|
181
|
+
- **Pros**: Easy to install, version control, wide reach
|
|
182
|
+
- **Cons**: Public, requires NPM account
|
|
183
|
+
- **Command**: `npm publish --access public`
|
|
184
|
+
|
|
185
|
+
### Option 2: Private NPM Package
|
|
186
|
+
- **Pros**: Private, controlled access
|
|
187
|
+
- **Cons**: Requires paid NPM account ($7/month)
|
|
188
|
+
- **Command**: `npm publish --access restricted`
|
|
189
|
+
|
|
190
|
+
### Option 3: GitHub Package Registry
|
|
191
|
+
- **Pros**: Free for public repos, integrated with GitHub
|
|
192
|
+
- **Setup**:
|
|
193
|
+
```json
|
|
194
|
+
// Add to package.json
|
|
195
|
+
"publishConfig": {
|
|
196
|
+
"registry": "https://npm.pkg.github.com"
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
- **Publish**: `npm publish`
|
|
200
|
+
|
|
201
|
+
### Option 4: Private Git Repository
|
|
202
|
+
- **Pros**: Full control, no NPM needed
|
|
203
|
+
- **Cons**: Manual version management
|
|
204
|
+
- **Install**:
|
|
205
|
+
```bash
|
|
206
|
+
npm install git+https://github.com/yourorg/react-native-accessibility-toolkit.git
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Option 5: Compressed File (tar.gz)
|
|
210
|
+
- **Create**: `npm pack`
|
|
211
|
+
- **Install**: `npm install /path/to/package.tgz`
|
|
212
|
+
|
|
213
|
+
## 📝 Checklist Before Publishing
|
|
214
|
+
|
|
215
|
+
- [ ] All files are in correct structure
|
|
216
|
+
- [ ] package.json is complete with all metadata
|
|
217
|
+
- [ ] README.md has clear documentation
|
|
218
|
+
- [ ] LICENSE file is included
|
|
219
|
+
- [ ] .npmignore excludes unnecessary files
|
|
220
|
+
- [ ] Code is tested in a separate project
|
|
221
|
+
- [ ] Version number follows semver (1.0.0)
|
|
222
|
+
- [ ] Git repository is created and pushed
|
|
223
|
+
- [ ] NPM account is created and verified
|
|
224
|
+
- [ ] Dependencies are listed correctly (peer vs regular)
|
|
225
|
+
|
|
226
|
+
## 🔄 Updating the Plugin
|
|
227
|
+
|
|
228
|
+
1. Make changes to code
|
|
229
|
+
2. Update version: `npm version patch/minor/major`
|
|
230
|
+
3. Commit changes: `git commit -am "Description"`
|
|
231
|
+
4. Push to GitHub: `git push`
|
|
232
|
+
5. Publish to NPM: `npm publish`
|
|
233
|
+
|
|
234
|
+
## 💡 Pro Tips
|
|
235
|
+
|
|
236
|
+
1. **Use Semantic Versioning**:
|
|
237
|
+
- MAJOR: Breaking changes (1.0.0 → 2.0.0)
|
|
238
|
+
- MINOR: New features (1.0.0 → 1.1.0)
|
|
239
|
+
- PATCH: Bug fixes (1.0.0 → 1.0.1)
|
|
240
|
+
|
|
241
|
+
2. **Add TypeScript Definitions**:
|
|
242
|
+
- Create `index.d.ts` for better IDE support
|
|
243
|
+
|
|
244
|
+
3. **Create Examples**:
|
|
245
|
+
- Add example projects in `examples/` folder
|
|
246
|
+
|
|
247
|
+
4. **Setup CI/CD**:
|
|
248
|
+
- Use GitHub Actions for automated testing/publishing
|
|
249
|
+
|
|
250
|
+
5. **Documentation**:
|
|
251
|
+
- Use JSDoc comments for better IntelliSense
|
|
252
|
+
- Create interactive docs with Docusaurus
|
|
253
|
+
|
|
254
|
+
## 🆘 Troubleshooting
|
|
255
|
+
|
|
256
|
+
**Issue**: Package not found after publishing
|
|
257
|
+
- **Solution**: Wait 5-10 minutes for NPM to index
|
|
258
|
+
|
|
259
|
+
**Issue**: Peer dependency warnings
|
|
260
|
+
- **Solution**: Ensure peerDependencies are correctly specified
|
|
261
|
+
|
|
262
|
+
**Issue**: Import errors in other projects
|
|
263
|
+
- **Solution**: Check main entry point in package.json
|
|
264
|
+
|
|
265
|
+
**Issue**: Native module linking issues
|
|
266
|
+
- **Solution**: Run `cd ios && pod install` for iOS
|
|
267
|
+
|
|
268
|
+
## 📞 Need Help?
|
|
269
|
+
|
|
270
|
+
Open an issue on GitHub or contact support@example.com
|
package/PLUGIN_STATUS.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Plugin Preparation Status
|
|
2
|
+
|
|
3
|
+
## ✅ COMPLETED
|
|
4
|
+
|
|
5
|
+
### Core Infrastructure
|
|
6
|
+
- ✅ Created proper folder structure (components/, services/, utils/, context/, hooks/)
|
|
7
|
+
- ✅ Removed ALL Global object dependencies
|
|
8
|
+
- ✅ Created standalone utilities (Colors.js, Fonts.js, AccessibilityUtils.js)
|
|
9
|
+
- ✅ Updated package.json with correct peer dependencies
|
|
10
|
+
- ✅ Updated index.js exports
|
|
11
|
+
|
|
12
|
+
### Services (Fully Migrated)
|
|
13
|
+
- ✅ AccessibilityStorage.js - AsyncStorage for preferences
|
|
14
|
+
- ✅ TTSService.js - Text-to-speech functionality
|
|
15
|
+
- ✅ NativeAccessibilityBridge.js - Platform accessibility integration
|
|
16
|
+
|
|
17
|
+
### Context (Fully Migrated)
|
|
18
|
+
- ✅ AccessibilityContext.js - Core state management (NO Global dependency)
|
|
19
|
+
|
|
20
|
+
### Hooks (Fully Migrated)
|
|
21
|
+
- ✅ useDynamicColors.js - Color transformations
|
|
22
|
+
- ✅ useThemeColors.js - Theme-aware colors
|
|
23
|
+
- ✅ usePageRead.js - Text-to-speech reading
|
|
24
|
+
|
|
25
|
+
### Components (Partially Migrated)
|
|
26
|
+
- ✅ AccessibleText.js - Text with auto-scaling
|
|
27
|
+
- ✅ AccessibilityButton.js - Floating menu button (uses react-native-vector-icons/Ionicons)
|
|
28
|
+
|
|
29
|
+
### Documentation
|
|
30
|
+
- ✅ Comprehensive README.md with full API documentation
|
|
31
|
+
- ✅ Installation instructions
|
|
32
|
+
- ✅ Quick start guide
|
|
33
|
+
- ✅ Examples
|
|
34
|
+
|
|
35
|
+
## ⚠️ REMAINING WORK
|
|
36
|
+
|
|
37
|
+
### Complex Components to Migrate
|
|
38
|
+
|
|
39
|
+
The following components still need to be copied from src/accessibility/ and refactored:
|
|
40
|
+
|
|
41
|
+
1. **AccessibilityModal.js** (1364 lines) - PRIORITY HIGH
|
|
42
|
+
- Remove Global dependency
|
|
43
|
+
- Remove Fonts import (use inline styles or props)
|
|
44
|
+
- Remove TextControlsWithSlider dependency
|
|
45
|
+
- Simplify or inline complex sub-components
|
|
46
|
+
|
|
47
|
+
2. **ReadModal.js** (~200 lines)
|
|
48
|
+
- Remove Global dependency
|
|
49
|
+
- Remove Colors/Fonts imports
|
|
50
|
+
- Update to use hooks
|
|
51
|
+
|
|
52
|
+
3. **TextMagnifier.js**
|
|
53
|
+
- Standalone magnification component
|
|
54
|
+
|
|
55
|
+
4. **DictionaryLookup.js**
|
|
56
|
+
- Remove Global dependency
|
|
57
|
+
- Remove Fonts import
|
|
58
|
+
|
|
59
|
+
5. **ReadingGuide.js**
|
|
60
|
+
- Reading mask and line guide
|
|
61
|
+
|
|
62
|
+
6. **ScreenReaderControls.js**
|
|
63
|
+
- Remove Fonts/Responsive imports
|
|
64
|
+
|
|
65
|
+
7. **AccessibleImage.js**
|
|
66
|
+
- Remove Global dependency
|
|
67
|
+
|
|
68
|
+
8. **AccessibleFilteredImage.js**
|
|
69
|
+
- Remove Global dependency
|
|
70
|
+
- Apply color filters to images
|
|
71
|
+
|
|
72
|
+
9. **TextControlsWithSlider.js**
|
|
73
|
+
- Font controls component
|
|
74
|
+
|
|
75
|
+
10. **ProfileTester.js**
|
|
76
|
+
- Testing component
|
|
77
|
+
|
|
78
|
+
## 🚀 READY FOR BASIC PUBLICATION
|
|
79
|
+
|
|
80
|
+
The plugin is **currently functional** for basic use cases:
|
|
81
|
+
|
|
82
|
+
### What Works Now:
|
|
83
|
+
```javascript
|
|
84
|
+
import {
|
|
85
|
+
AccessibilityProvider,
|
|
86
|
+
useAccessibility,
|
|
87
|
+
AccessibleText,
|
|
88
|
+
AccessibilityButton,
|
|
89
|
+
useDynamicColors,
|
|
90
|
+
useThemeColors,
|
|
91
|
+
usePageRead,
|
|
92
|
+
TTSService,
|
|
93
|
+
ACCESSIBILITY_PROFILES,
|
|
94
|
+
} from '@yourorg/react-native-accessibility-toolkit';
|
|
95
|
+
|
|
96
|
+
// Full context API
|
|
97
|
+
const { fontScale, textColor, updateSetting, setProfile } = useAccessibility();
|
|
98
|
+
|
|
99
|
+
// Hooks work
|
|
100
|
+
const colors = useDynamicColors();
|
|
101
|
+
const pageRead = usePageRead("text content");
|
|
102
|
+
|
|
103
|
+
// Basic components
|
|
104
|
+
<AccessibleText baseFontSize={16}>Hello</AccessibleText>
|
|
105
|
+
<AccessibilityButton />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### What's Missing:
|
|
109
|
+
- AccessibilityModal (main settings UI)
|
|
110
|
+
- Advanced components (magnifier, dictionary, reading guides)
|
|
111
|
+
- Image accessibility components
|
|
112
|
+
|
|
113
|
+
## 📝 TO PUBLISH NOW:
|
|
114
|
+
|
|
115
|
+
### 1. Update Package Info
|
|
116
|
+
```bash
|
|
117
|
+
cd PLUGIN_SETUP
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Edit `package.json`:
|
|
121
|
+
- Change `@yourorg/react-native-accessibility-toolkit` to your actual package name
|
|
122
|
+
- Update author email
|
|
123
|
+
- Update repository URL
|
|
124
|
+
|
|
125
|
+
### 2. Test Installation
|
|
126
|
+
```bash
|
|
127
|
+
npm install
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 3. Publish to NPM
|
|
131
|
+
```bash
|
|
132
|
+
npm login
|
|
133
|
+
npm publish --access public
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 4. Install in Your Project
|
|
137
|
+
```bash
|
|
138
|
+
cd ../
|
|
139
|
+
npm install ./PLUGIN_SETUP
|
|
140
|
+
# or after publishing:
|
|
141
|
+
# npm install @yourpackagename/react-native-accessibility-toolkit
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 🔧 TO COMPLETE FULL VERSION:
|
|
145
|
+
|
|
146
|
+
### Option 1: Copy Remaining Components As-Is
|
|
147
|
+
Copy all remaining components from `src/accessibility/` to `PLUGIN_SETUP/src/components/` and:
|
|
148
|
+
1. Change imports from `./` to use the new structure
|
|
149
|
+
2. Remove ALL instances of `Global.accessibility`
|
|
150
|
+
3. Replace with `const { ... } = useAccessibility()` hook calls
|
|
151
|
+
4. Remove `../utils/Fonts` imports (use props or inline styles)
|
|
152
|
+
5. Remove `../utils/Colors` imports (use `useDynamicColors()` hook)
|
|
153
|
+
6. Remove `../utils/Responsive` imports (calculate inline or use Dimensions)
|
|
154
|
+
|
|
155
|
+
### Option 2: Simplify for MVP
|
|
156
|
+
Create simplified versions of complex components:
|
|
157
|
+
- Basic modal without all features
|
|
158
|
+
- Simple reading tools
|
|
159
|
+
- Core functionality only
|
|
160
|
+
|
|
161
|
+
## 📦 Current Package Structure
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
PLUGIN_SETUP/
|
|
165
|
+
├── package.json ✅
|
|
166
|
+
├── README.md ✅
|
|
167
|
+
└── src/
|
|
168
|
+
├── index.js ✅ (exports)
|
|
169
|
+
├── components/
|
|
170
|
+
│ ├── AccessibleText.js ✅
|
|
171
|
+
│ └── AccessibilityButton.js ✅
|
|
172
|
+
├── context/
|
|
173
|
+
│ └── AccessibilityContext.js ✅
|
|
174
|
+
├── hooks/
|
|
175
|
+
│ ├── useDynamicColors.js ✅
|
|
176
|
+
│ ├── useThemeColors.js ✅
|
|
177
|
+
│ └── usePageRead.js ✅
|
|
178
|
+
├── services/
|
|
179
|
+
│ ├── AccessibilityStorage.js ✅
|
|
180
|
+
│ ├── TTSService.js ✅
|
|
181
|
+
│ └── NativeAccessibilityBridge.js ✅
|
|
182
|
+
└── utils/
|
|
183
|
+
├── AccessibilityUtils.js ✅
|
|
184
|
+
├── Colors.js ✅
|
|
185
|
+
└── Fonts.js ✅
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## ✅ RECOMMENDATION
|
|
189
|
+
|
|
190
|
+
**You can publish the current version as v0.1.0** (beta) since it provides:
|
|
191
|
+
- Complete context and state management
|
|
192
|
+
- All hooks working
|
|
193
|
+
- Basic components
|
|
194
|
+
- Full TTS support
|
|
195
|
+
- Storage persistence
|
|
196
|
+
- Native platform integration
|
|
197
|
+
|
|
198
|
+
Then add the modal and advanced components in v0.2.0+.
|
|
199
|
+
|
|
200
|
+
## 🎯 Next Steps
|
|
201
|
+
|
|
202
|
+
1. **Test the plugin** - Install it in your main project
|
|
203
|
+
2. **Update package name** in package.json
|
|
204
|
+
3. **Publish v0.1.0-beta** to npm
|
|
205
|
+
4. **Gradually migrate** remaining components
|
|
206
|
+
5. **Release v1.0.0** when all features are complete
|