react-native-kookit 0.3.5 → 0.3.6

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.
@@ -1,132 +0,0 @@
1
- # react-native-kookit 配置示例
2
-
3
- ## 正确的 app.json 配置
4
-
5
- ```json
6
- {
7
- "expo": {
8
- "name": "Your App Name",
9
- "slug": "your-app-slug",
10
- "version": "1.0.0",
11
- "orientation": "portrait",
12
- "icon": "./assets/icon.png",
13
- "userInterfaceStyle": "light",
14
- "splash": {
15
- "image": "./assets/splash.png",
16
- "resizeMode": "contain",
17
- "backgroundColor": "#ffffff"
18
- },
19
- "plugins": ["react-native-kookit"],
20
- "android": {
21
- "adaptiveIcon": {
22
- "foregroundImage": "./assets/adaptive-icon.png",
23
- "backgroundColor": "#ffffff"
24
- }
25
- },
26
- "web": {
27
- "favicon": "./assets/favicon.png"
28
- }
29
- }
30
- }
31
- ```
32
-
33
- ## 故障排除
34
-
35
- ### 错误:Plugin is an unexpected type: undefined
36
-
37
- **原因:** 插件未正确安装或构建
38
-
39
- **解决方案:**
40
-
41
- 1. 确保 react-native-kookit 已正确安装:
42
-
43
- ```bash
44
- npm install react-native-kookit
45
- # 或
46
- yarn add react-native-kookit
47
- ```
48
-
49
- 2. 清理并重新安装依赖:
50
-
51
- ```bash
52
- rm -rf node_modules package-lock.json
53
- npm install
54
- ```
55
-
56
- 3. 重新预构建:
57
-
58
- ```bash
59
- npx expo prebuild --clean
60
- ```
61
-
62
- ### 其他常见错误
63
-
64
- #### 错误:Cannot find module '@expo/config-plugins'
65
-
66
- **解决方案:**
67
-
68
- ```bash
69
- npm install @expo/config-plugins
70
- ```
71
-
72
- #### 错误:Plugin configuration is invalid
73
-
74
- 检查 app.json 格式是否正确,确保 plugins 数组正确配置。
75
-
76
- ## 验证插件是否工作
77
-
78
- 运行以下命令检查插件是否正确加载:
79
-
80
- ```bash
81
- node -e "
82
- const plugin = require('react-native-kookit/app.plugin.js');
83
- console.log('Plugin loaded successfully:', typeof plugin === 'function');
84
- "
85
- ```
86
-
87
- 如果输出 `Plugin loaded successfully: true`,说明插件正确安装。
88
-
89
- ## 完整的使用流程
90
-
91
- 1. **安装模块**
92
-
93
- ```bash
94
- npm install react-native-kookit
95
- ```
96
-
97
- 2. **配置 app.json**
98
-
99
- ```json
100
- {
101
- "expo": {
102
- "plugins": ["react-native-kookit"]
103
- }
104
- }
105
- ```
106
-
107
- 3. **预构建项目**
108
-
109
- ```bash
110
- npx expo prebuild --clean
111
- ```
112
-
113
- 4. **运行项目**
114
-
115
- ```bash
116
- npx expo run:android
117
- ```
118
-
119
- 5. **在代码中使用**
120
-
121
- ```javascript
122
- import ReactNativeKookit from "react-native-kookit";
123
-
124
- const subscription = ReactNativeKookit.addListener(
125
- "onVolumeButtonPressed",
126
- (event) => {
127
- console.log("Volume button:", event.key);
128
- }
129
- );
130
-
131
- ReactNativeKookit.enableVolumeKeyInterception();
132
- ```