react-native-rich-text-fabric 0.1.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/LICENSE +20 -0
- package/README.md +247 -0
- package/RichText.podspec +20 -0
- package/android/build.gradle +77 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/richtext/RichTextInputView.kt +759 -0
- package/android/src/main/java/com/richtext/RichTextInputViewManager.kt +288 -0
- package/android/src/main/java/com/richtext/RichTextPackage.kt +20 -0
- package/android/src/main/java/com/richtext/RichTextView.kt +15 -0
- package/android/src/main/java/com/richtext/RichTextViewManager.kt +41 -0
- package/ios/RichTextColorUtils.h +34 -0
- package/ios/RichTextInputView.h +21 -0
- package/ios/RichTextInputView.mm +999 -0
- package/ios/RichTextView.h +14 -0
- package/ios/RichTextView.mm +71 -0
- package/lib/module/AtTextInput/AtTextInput.js +185 -0
- package/lib/module/AtTextInput/AtTextInput.js.map +1 -0
- package/lib/module/AtTextInput/index.js +6 -0
- package/lib/module/AtTextInput/index.js.map +1 -0
- package/lib/module/AtTextInput/types.js +4 -0
- package/lib/module/AtTextInput/types.js.map +1 -0
- package/lib/module/AtTextInput/utils.js +51 -0
- package/lib/module/AtTextInput/utils.js.map +1 -0
- package/lib/module/Others/Float.js +27 -0
- package/lib/module/Others/Float.js.map +1 -0
- package/lib/module/Others/UserList.js +209 -0
- package/lib/module/Others/UserList.js.map +1 -0
- package/lib/module/Others/index.js +6 -0
- package/lib/module/Others/index.js.map +1 -0
- package/lib/module/Others/types.js +4 -0
- package/lib/module/Others/types.js.map +1 -0
- package/lib/module/RichText/RichText.js +73 -0
- package/lib/module/RichText/RichText.js.map +1 -0
- package/lib/module/RichText/index.js +4 -0
- package/lib/module/RichText/index.js.map +1 -0
- package/lib/module/RichTextInput/RichTextInput.js +280 -0
- package/lib/module/RichTextInput/RichTextInput.js.map +1 -0
- package/lib/module/RichTextInput/RichTextInputNativeComponent.ts +117 -0
- package/lib/module/RichTextInput/index.js +6 -0
- package/lib/module/RichTextInput/index.js.map +1 -0
- package/lib/module/RichTextInput/types.js +33 -0
- package/lib/module/RichTextInput/types.js.map +1 -0
- package/lib/module/RichTextInput/utils.js +9 -0
- package/lib/module/RichTextInput/utils.js.map +1 -0
- package/lib/module/RichTextViewNativeComponent.ts +7 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/react-native-codegen.d.js +2 -0
- package/lib/module/types/react-native-codegen.d.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AtTextInput/AtTextInput.d.ts +5 -0
- package/lib/typescript/src/AtTextInput/AtTextInput.d.ts.map +1 -0
- package/lib/typescript/src/AtTextInput/index.d.ts +4 -0
- package/lib/typescript/src/AtTextInput/index.d.ts.map +1 -0
- package/lib/typescript/src/AtTextInput/types.d.ts +27 -0
- package/lib/typescript/src/AtTextInput/types.d.ts.map +1 -0
- package/lib/typescript/src/AtTextInput/utils.d.ts +7 -0
- package/lib/typescript/src/AtTextInput/utils.d.ts.map +1 -0
- package/lib/typescript/src/Others/Float.d.ts +4 -0
- package/lib/typescript/src/Others/Float.d.ts.map +1 -0
- package/lib/typescript/src/Others/UserList.d.ts +4 -0
- package/lib/typescript/src/Others/UserList.d.ts.map +1 -0
- package/lib/typescript/src/Others/index.d.ts +4 -0
- package/lib/typescript/src/Others/index.d.ts.map +1 -0
- package/lib/typescript/src/Others/types.d.ts +28 -0
- package/lib/typescript/src/Others/types.d.ts.map +1 -0
- package/lib/typescript/src/RichText/RichText.d.ts +24 -0
- package/lib/typescript/src/RichText/RichText.d.ts.map +1 -0
- package/lib/typescript/src/RichText/index.d.ts +2 -0
- package/lib/typescript/src/RichText/index.d.ts.map +1 -0
- package/lib/typescript/src/RichTextInput/RichTextInput.d.ts +18 -0
- package/lib/typescript/src/RichTextInput/RichTextInput.d.ts.map +1 -0
- package/lib/typescript/src/RichTextInput/RichTextInputNativeComponent.d.ts +47 -0
- package/lib/typescript/src/RichTextInput/RichTextInputNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/RichTextInput/index.d.ts +4 -0
- package/lib/typescript/src/RichTextInput/index.d.ts.map +1 -0
- package/lib/typescript/src/RichTextInput/types.d.ts +93 -0
- package/lib/typescript/src/RichTextInput/types.d.ts.map +1 -0
- package/lib/typescript/src/RichTextInput/utils.d.ts +5 -0
- package/lib/typescript/src/RichTextInput/utils.d.ts.map +1 -0
- package/lib/typescript/src/RichTextViewNativeComponent.d.ts +7 -0
- package/lib/typescript/src/RichTextViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +191 -0
- package/src/AtTextInput/AtTextInput.tsx +218 -0
- package/src/AtTextInput/index.tsx +3 -0
- package/src/AtTextInput/types.tsx +34 -0
- package/src/AtTextInput/utils.ts +62 -0
- package/src/Others/Float.tsx +20 -0
- package/src/Others/UserList.tsx +205 -0
- package/src/Others/index.tsx +3 -0
- package/src/Others/types.ts +30 -0
- package/src/RichText/RichText.tsx +115 -0
- package/src/RichText/index.tsx +1 -0
- package/src/RichTextInput/RichTextInput.tsx +339 -0
- package/src/RichTextInput/RichTextInputNativeComponent.ts +117 -0
- package/src/RichTextInput/index.tsx +3 -0
- package/src/RichTextInput/types.ts +154 -0
- package/src/RichTextInput/utils.ts +6 -0
- package/src/RichTextViewNativeComponent.ts +7 -0
- package/src/index.tsx +6 -0
- package/src/types/react-native-codegen.d.ts +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 asteriskzuo
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# react-native-rich-text-fabric
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
5
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/react-native-rich-text-fabric">
|
|
8
|
+
<img src="https://img.shields.io/npm/v/react-native-rich-text-fabric?color=brightgreen" alt="npm version" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/AsteriskZuo/react-native-rich-text">
|
|
11
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome" />
|
|
12
|
+
</a>
|
|
13
|
+
<img src="https://img.shields.io/badge/React%20Native-0.83+-61dafb?logo=react" alt="React Native 0.83+" />
|
|
14
|
+
<img src="https://img.shields.io/badge/Fabric-required-purple" alt="Fabric Required" />
|
|
15
|
+
<img src="https://img.shields.io/badge/platform-iOS%20%7C%20Android-lightgrey" alt="Platform iOS | Android" />
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
A high-performance rich text display and input component library for React Native, built with the new Fabric architecture.
|
|
19
|
+
|
|
20
|
+
## β¨ Features
|
|
21
|
+
|
|
22
|
+
- π **Pure Native Implementation** - No WebView, no third-party dependencies
|
|
23
|
+
- π **RichText** - Display component with mixed text and images
|
|
24
|
+
- βοΈ **RichTextInput** - Native input with image insertion and text styling
|
|
25
|
+
- π·οΈ **@ Mention Support** - Atomic text deletion for @mention scenarios
|
|
26
|
+
- π¨ **Customizable Styles** - Font, color, bold, italic, underline, background
|
|
27
|
+
- π± **Cross Platform** - iOS and Android support
|
|
28
|
+
|
|
29
|
+
## πΈ Preview
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
<img src="./res/WX20260106-151110@2x.png" alt="RichText Example" height="800" /> <img src="./res/WX20260106-151122@2x.png" alt="RichText Example" height="800" />
|
|
34
|
+
|
|
35
|
+
## π¦ Installation
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install react-native-rich-text-fabric
|
|
39
|
+
# or
|
|
40
|
+
yarn add react-native-rich-text-fabric
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## π Quick Start
|
|
44
|
+
|
|
45
|
+
### RichText - Display Component
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { RichText } from 'react-native-rich-text-fabric';
|
|
49
|
+
|
|
50
|
+
const content = [
|
|
51
|
+
{ type: 'text', text: 'Hello, ' },
|
|
52
|
+
{
|
|
53
|
+
type: 'text',
|
|
54
|
+
text: 'World!',
|
|
55
|
+
textStyle: { fontWeight: 'bold', color: 'red' },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'image',
|
|
59
|
+
image: 'https://example.com/emoji.png',
|
|
60
|
+
imageStyle: { width: 20, height: 20 },
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
<RichText content={content} />;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### RichTextInput - Input Component
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { useRef } from 'react';
|
|
71
|
+
import {
|
|
72
|
+
RichTextInput,
|
|
73
|
+
type RichTextInputRef,
|
|
74
|
+
} from 'react-native-rich-text-fabric';
|
|
75
|
+
|
|
76
|
+
const ref = useRef<RichTextInputRef>(null);
|
|
77
|
+
|
|
78
|
+
<RichTextInput
|
|
79
|
+
ref={ref}
|
|
80
|
+
placeholder="Enter rich text..."
|
|
81
|
+
onContentChange={(content) => console.log(content)}
|
|
82
|
+
/>;
|
|
83
|
+
|
|
84
|
+
// Insert styled text
|
|
85
|
+
ref.current?.insertText({
|
|
86
|
+
text: 'styled',
|
|
87
|
+
textStyle: { fontWeight: 'bold', color: 'blue' },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Insert image
|
|
91
|
+
ref.current?.insertImage({
|
|
92
|
+
image: 'https://example.com/image.png',
|
|
93
|
+
imageStyle: { width: 24, height: 24 },
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### RichTextInput - @ Mention Feature
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { useRef } from 'react';
|
|
101
|
+
import {
|
|
102
|
+
RichTextInput,
|
|
103
|
+
generateAtomicId,
|
|
104
|
+
type RichTextInputRef,
|
|
105
|
+
} from 'react-native-rich-text-fabric';
|
|
106
|
+
|
|
107
|
+
const ref = useRef<RichTextInputRef>(null);
|
|
108
|
+
|
|
109
|
+
// Insert @mention with atomic deletion support
|
|
110
|
+
const insertMention = (userId: string, userName: string) => {
|
|
111
|
+
ref.current?.insertText({
|
|
112
|
+
text: `@${userName} `,
|
|
113
|
+
textStyle: { color: '#1890ff' },
|
|
114
|
+
atomicId: userId, // Enables atomic deletion - the entire @mention deletes as one unit
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
<RichTextInput
|
|
119
|
+
ref={ref}
|
|
120
|
+
placeholder="Type @ to mention someone..."
|
|
121
|
+
onContentChange={(content) => {
|
|
122
|
+
// content includes atomicId for @mentions
|
|
123
|
+
console.log(content);
|
|
124
|
+
}}
|
|
125
|
+
/>;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## π API Reference
|
|
129
|
+
|
|
130
|
+
### RichText Props
|
|
131
|
+
|
|
132
|
+
| Prop | Type | Description |
|
|
133
|
+
| ------------------- | ---------------------------------------------------------- | ------------------- |
|
|
134
|
+
| `content` | `Array<string \| RichTextStringItem \| RichTextImageItem>` | Content array |
|
|
135
|
+
| `defaultTextStyle` | `TextStyle` | Default text style |
|
|
136
|
+
| `defaultImageStyle` | `ImageStyle` | Default image style |
|
|
137
|
+
|
|
138
|
+
### RichTextInput Props
|
|
139
|
+
|
|
140
|
+
| Prop | Type | Default | Description |
|
|
141
|
+
| ------------------------ | ------------------------------------------ | ------- | ------------------------------ |
|
|
142
|
+
| `placeholder` | `string` | - | Placeholder text |
|
|
143
|
+
| `placeholderTextColor` | `ColorValue` | - | Placeholder color |
|
|
144
|
+
| `multiline` | `boolean` | `true` | Enable multiline |
|
|
145
|
+
| `maxLength` | `number` | - | Maximum character length |
|
|
146
|
+
| `editable` | `boolean` | `true` | Enable editing |
|
|
147
|
+
| `autoFocus` | `boolean` | `false` | Auto focus on mount |
|
|
148
|
+
| `defaultTextStyle` | `TextStyle` | - | Default text style |
|
|
149
|
+
| `defaultImageStyle` | `ImageStyle` | - | Default image style |
|
|
150
|
+
| `inheritInsertedStyle` | `boolean` | `true` | Inherit style after insertText |
|
|
151
|
+
| `cursorColor` | `ColorValue` | - | Cursor color |
|
|
152
|
+
| `imagePlaceholderColor` | `ColorValue` | - | Image placeholder background |
|
|
153
|
+
| `imagePlaceholderSource` | `ImageSourcePropType` | - | Image placeholder image |
|
|
154
|
+
| `onContentChange` | `(content: RichTextContentItem[]) => void` | - | Content change callback |
|
|
155
|
+
| `onFocus` | `() => void` | - | Focus callback |
|
|
156
|
+
| `onBlur` | `() => void` | - | Blur callback |
|
|
157
|
+
|
|
158
|
+
### RichTextInput Ref Methods
|
|
159
|
+
|
|
160
|
+
| Method | Description |
|
|
161
|
+
| ------------------------ | -------------------------------------------- |
|
|
162
|
+
| `focus()` | Focus the input |
|
|
163
|
+
| `blur()` | Blur the input |
|
|
164
|
+
| `isFocused()` | Returns focus state |
|
|
165
|
+
| `insertText(text)` | Insert text with optional style and atomicId |
|
|
166
|
+
| `insertImage(image)` | Insert image |
|
|
167
|
+
| `clearContent()` | Clear all content |
|
|
168
|
+
| `getContent()` | Get current content |
|
|
169
|
+
| `setCursorPosition(pos)` | Set cursor position |
|
|
170
|
+
|
|
171
|
+
## π§ Requirements
|
|
172
|
+
|
|
173
|
+
- React Native >= 0.83
|
|
174
|
+
- New Architecture (Fabric) enabled
|
|
175
|
+
- iOS 13.0+
|
|
176
|
+
- Android SDK 24+
|
|
177
|
+
|
|
178
|
+
## π± Platform Support
|
|
179
|
+
|
|
180
|
+
| Feature | iOS | Android |
|
|
181
|
+
| ----------------------- | --- | ------- |
|
|
182
|
+
| RichText Display | β
| β
|
|
|
183
|
+
| RichTextInput | β
| β
|
|
|
184
|
+
| Image Insertion | β
| β
|
|
|
185
|
+
| Text Styling | β
| β
|
|
|
186
|
+
| Atomic Text (@ Mention) | β
| β
|
|
|
187
|
+
| Custom Cursor Color | β
| β
|
|
|
188
|
+
| Image Placeholder | β
| β
|
|
|
189
|
+
|
|
190
|
+
## π Alternatives
|
|
191
|
+
|
|
192
|
+
**Rich Text Editors (WebView-based):**
|
|
193
|
+
|
|
194
|
+
- [@10play/tentap-editor](https://www.npmjs.com/package/@10play/tentap-editor) - TipTap/ProseMirror based
|
|
195
|
+
- [react-native-pell-rich-editor](https://www.npmjs.com/package/react-native-pell-rich-editor) - Popular WebView editor
|
|
196
|
+
- [react-native-cn-quill](https://www.npmjs.com/package/react-native-cn-quill) - Quill.js based
|
|
197
|
+
- [react-native-webview-quill](https://www.npmjs.com/package/react-native-webview-quill) - WebView + Quill
|
|
198
|
+
|
|
199
|
+
**Rich Text Editors (Native):**
|
|
200
|
+
|
|
201
|
+
- [react-native-rich-text](https://www.npmjs.com/package/react-native-rich-text) - Original name (taken)
|
|
202
|
+
- [react-native-ete-rich-editor](https://www.npmjs.com/package/react-native-ete-rich-editor) - Native editor
|
|
203
|
+
- [react-native-texted](https://github.com/AltamarKM/react-native-texted) - Native rich text
|
|
204
|
+
|
|
205
|
+
**@ Mention Components:**
|
|
206
|
+
|
|
207
|
+
- [react-native-mentions](https://www.npmjs.com/package/react-native-mentions) - Pure TS mention
|
|
208
|
+
- [react-native-controlled-mentions](https://www.npmjs.com/package/react-native-controlled-mentions) - Controlled mention input
|
|
209
|
+
|
|
210
|
+
## πΊοΈ Roadmap
|
|
211
|
+
|
|
212
|
+
- [x] AtTextInput - @ mention input component
|
|
213
|
+
- [x] UserList - User selection popup component
|
|
214
|
+
- [x] RichText - Rich text display with mixed text/images
|
|
215
|
+
- [x] RichTextInput - Native rich text input
|
|
216
|
+
- [x] Text styling support (color, bold, italic, underline, background)
|
|
217
|
+
- [x] Atomic text (@ mention with atomic deletion)
|
|
218
|
+
- [x] Style inheritance control (`inheritInsertedStyle`)
|
|
219
|
+
- [x] Custom cursor color
|
|
220
|
+
- [x] Image placeholder support
|
|
221
|
+
- [x] Hyperlink support for RichText
|
|
222
|
+
- [ ] Playground / Online demo
|
|
223
|
+
- [ ] Cloud build for example project
|
|
224
|
+
|
|
225
|
+
## π€ Contributing
|
|
226
|
+
|
|
227
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
228
|
+
|
|
229
|
+
We have templates to help you get started:
|
|
230
|
+
|
|
231
|
+
- [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md) - For submitting changes
|
|
232
|
+
- [Bug Report](.github/ISSUE_TEMPLATE/bug_report.yml) - For reporting bugs
|
|
233
|
+
- [Feature Request](.github/ISSUE_TEMPLATE/feature_request.yml) - For suggesting new features
|
|
234
|
+
|
|
235
|
+
## π Security
|
|
236
|
+
|
|
237
|
+
For information about reporting security vulnerabilities, please see our [Security Policy](SECURITY.md).
|
|
238
|
+
|
|
239
|
+
## π License
|
|
240
|
+
|
|
241
|
+
MIT
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
Made with β€οΈ by [AsteriskZuo](https://github.com/AsteriskZuo)
|
|
246
|
+
|
|
247
|
+
<img src="./res/github_star_qr.png" alt="RichText Example" height="400" />
|
package/RichText.podspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RichText"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/AsteriskZuo/react-native-rich-text.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
install_modules_dependencies(s)
|
|
20
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RichText_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
apply plugin: "com.android.library"
|
|
20
|
+
apply plugin: "kotlin-android"
|
|
21
|
+
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
23
|
+
|
|
24
|
+
def getExtOrIntegerDefault(name) {
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RichText_" + name]).toInteger()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
android {
|
|
29
|
+
namespace "com.richtext"
|
|
30
|
+
|
|
31
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
32
|
+
|
|
33
|
+
defaultConfig {
|
|
34
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
35
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
buildFeatures {
|
|
39
|
+
buildConfig true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
buildTypes {
|
|
43
|
+
release {
|
|
44
|
+
minifyEnabled false
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
lintOptions {
|
|
49
|
+
disable "GradleCompatible"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
compileOptions {
|
|
53
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
54
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
sourceSets {
|
|
58
|
+
main {
|
|
59
|
+
java.srcDirs += [
|
|
60
|
+
"generated/java",
|
|
61
|
+
"generated/jni"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
repositories {
|
|
68
|
+
mavenCentral()
|
|
69
|
+
google()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
73
|
+
|
|
74
|
+
dependencies {
|
|
75
|
+
implementation "com.facebook.react:react-android"
|
|
76
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
|
+
}
|