@hero-design/rn 7.13.0 → 7.14.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/.eslintrc.json +3 -1
- package/.turbo/turbo-build.log +3 -2
- package/assets/fonts/hero-icons.ttf +0 -0
- package/babel.config.js +16 -0
- package/es/index.js +26957 -7622
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +26963 -7624
- package/package.json +9 -4
- package/rollup.config.js +1 -0
- package/src/components/Accordion/AccordionItem.tsx +50 -0
- package/src/components/Accordion/StyledAccordion.tsx +29 -0
- package/src/components/Accordion/__tests__/AccordionItem.spec.tsx +56 -0
- package/src/components/Accordion/__tests__/StyledAccordion.spec.tsx +17 -0
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +529 -0
- package/src/components/Accordion/__tests__/__snapshots__/StyledAccordion.spec.tsx.snap +33 -0
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +822 -0
- package/src/components/Accordion/__tests__/index.spec.tsx +54 -0
- package/src/components/Accordion/index.tsx +82 -0
- package/src/components/Accordion/utils.tsx +11 -0
- package/src/components/Button/IconButton.tsx +1 -1
- package/src/components/Calendar/CalendarRowItem.tsx +54 -0
- package/src/components/Calendar/StyledCalendar.tsx +76 -0
- package/src/components/Calendar/__tests__/CalendarRowItem.spec.tsx +76 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +411 -0
- package/src/components/Calendar/__tests__/helper.spec.ts +50 -0
- package/src/components/Calendar/__tests__/index.spec.tsx +99 -0
- package/src/components/Calendar/helpers.ts +29 -0
- package/src/components/Calendar/index.tsx +217 -0
- package/src/components/Collapse/index.tsx +13 -15
- package/src/components/ContentNavigator/index.tsx +6 -0
- package/src/components/Empty/StyledEmpty.tsx +47 -0
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +66 -0
- package/src/components/Empty/__tests__/index.spec.tsx +17 -0
- package/src/components/Empty/index.tsx +53 -0
- package/src/components/FAB/ActionGroup/ActionItem.tsx +6 -2
- package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +1 -0
- package/src/components/FAB/ActionGroup/StyledActionItem.tsx +7 -1
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +84 -22
- package/src/components/FAB/ActionGroup/index.tsx +8 -1
- package/src/components/Icon/HeroIcon/selection.json +1 -1
- package/src/components/Icon/IconList.ts +13 -0
- package/src/components/List/BasicListItem.tsx +44 -34
- package/src/components/List/ListItem.tsx +67 -58
- package/src/components/List/StyledBasicListItem.tsx +2 -3
- package/src/components/List/StyledListItem.tsx +2 -2
- package/src/components/List/__tests__/StyledBasicListItem.spec.tsx +5 -2
- package/src/components/List/__tests__/StyledListItem.spec.tsx +4 -1
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +15 -10
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +52 -32
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +128 -48
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +132 -52
- package/src/components/RichTextEditor/EditorEvent.ts +7 -0
- package/src/components/RichTextEditor/EditorToolbar.tsx +220 -0
- package/src/components/RichTextEditor/MentionList.tsx +69 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +396 -0
- package/src/components/RichTextEditor/StyledRichTextEditor.ts +20 -0
- package/src/components/RichTextEditor/StyledToolbar.ts +32 -0
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +130 -0
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +109 -0
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +245 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +324 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +45 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +526 -0
- package/src/components/RichTextEditor/constants.ts +20 -0
- package/src/components/RichTextEditor/hero-editor.d.ts +8 -0
- package/src/components/RichTextEditor/index.tsx +8 -0
- package/src/components/RichTextEditor/utils/events.ts +31 -0
- package/src/components/RichTextEditor/utils/rnWebView.ts +19 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +77 -0
- package/src/components/SectionHeading/__tests__/index.spec.tsx +14 -0
- package/src/components/SectionHeading/index.tsx +16 -9
- package/src/components/Tag/StyledTag.tsx +12 -2
- package/src/components/Tag/__tests__/Tag.spec.tsx +35 -8
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +118 -4
- package/src/components/Tag/index.tsx +9 -2
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +1 -0
- package/src/components/Typography/Text/StyledText.tsx +2 -1
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
- package/src/components/Typography/Text/index.tsx +2 -1
- package/src/index.ts +8 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +101 -4
- package/src/theme/components/accordion.ts +19 -0
- package/src/theme/components/calendar.ts +34 -0
- package/src/theme/components/card.ts +1 -1
- package/src/theme/components/empty.ts +38 -0
- package/src/theme/components/fab.ts +4 -3
- package/src/theme/components/list.ts +1 -0
- package/src/theme/components/pinInput.ts +1 -1
- package/src/theme/components/richTextEditor.ts +34 -0
- package/src/theme/components/tag.ts +8 -2
- package/src/theme/components/typography.ts +1 -0
- package/src/theme/global/borders.ts +6 -6
- package/src/theme/global/colors.ts +4 -1
- package/src/theme/index.ts +12 -0
- package/testUtils/setup.tsx +17 -0
- package/types/components/Accordion/AccordionItem.d.ts +14 -0
- package/types/components/Accordion/StyledAccordion.d.ts +32 -0
- package/types/components/Accordion/__tests__/AccordionItem.spec.d.ts +1 -0
- package/types/components/Accordion/__tests__/StyledAccordion.spec.d.ts +1 -0
- package/types/components/Accordion/__tests__/index.spec.d.ts +1 -0
- package/types/components/Accordion/index.d.ts +38 -0
- package/types/components/Accordion/utils.d.ts +1 -0
- package/types/components/Button/IconButton.d.ts +1 -1
- package/types/components/Calendar/CalendarRowItem.d.ts +10 -0
- package/types/components/Calendar/StyledCalendar.d.ts +54 -0
- package/types/components/Calendar/__tests__/CalendarRowItem.spec.d.ts +1 -0
- package/types/components/Calendar/__tests__/helper.spec.d.ts +1 -0
- package/types/components/Calendar/__tests__/index.spec.d.ts +1 -0
- package/types/components/Calendar/helpers.d.ts +3 -0
- package/types/components/Calendar/index.d.ts +40 -0
- package/types/components/Collapse/index.d.ts +1 -1
- package/types/components/ContentNavigator/index.d.ts +5 -1
- package/types/components/Empty/StyledEmpty.d.ts +31 -0
- package/types/components/Empty/__tests__/index.spec.d.ts +1 -0
- package/types/components/Empty/index.d.ts +26 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +6 -1
- package/types/components/FAB/ActionGroup/index.d.ts +6 -1
- package/types/components/FAB/index.d.ts +1 -1
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/List/StyledBasicListItem.d.ts +3 -3
- package/types/components/List/StyledListItem.d.ts +3 -3
- package/types/components/RichTextEditor/EditorEvent.d.ts +3 -0
- package/types/components/RichTextEditor/EditorToolbar.d.ts +17 -0
- package/types/components/RichTextEditor/MentionList.d.ts +12 -0
- package/types/components/RichTextEditor/RichTextEditor.d.ts +65 -0
- package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +16 -0
- package/types/components/RichTextEditor/StyledToolbar.d.ts +21 -0
- package/types/components/RichTextEditor/__tests__/EditorToolbar.spec.d.ts +1 -0
- package/types/components/RichTextEditor/__tests__/MentionList.spec.d.ts +1 -0
- package/types/components/RichTextEditor/__tests__/RichTextEditor.spec.d.ts +1 -0
- package/types/components/RichTextEditor/constants.d.ts +19 -0
- package/types/components/RichTextEditor/index.d.ts +5 -0
- package/types/components/RichTextEditor/utils/events.d.ts +8 -0
- package/types/components/RichTextEditor/utils/rnWebView.d.ts +7 -0
- package/types/components/SectionHeading/index.d.ts +2 -2
- package/types/components/Select/MultiSelect/OptionList.d.ts +1 -1
- package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
- package/types/components/Tag/StyledTag.d.ts +1 -1
- package/types/components/Tag/index.d.ts +1 -1
- package/types/components/Typography/Text/StyledText.d.ts +1 -1
- package/types/components/Typography/Text/index.d.ts +1 -1
- package/types/index.d.ts +5 -1
- package/types/theme/components/accordion.d.ts +13 -0
- package/types/theme/components/calendar.d.ts +26 -0
- package/types/theme/components/empty.d.ts +28 -0
- package/types/theme/components/fab.d.ts +1 -0
- package/types/theme/components/list.d.ts +1 -0
- package/types/theme/components/richTextEditor.d.ts +26 -0
- package/types/theme/components/tag.d.ts +8 -2
- package/types/theme/components/typography.d.ts +1 -0
- package/types/theme/global/colors.d.ts +4 -1
- package/types/theme/global/index.d.ts +4 -1
- package/types/theme/index.d.ts +8 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`MentionList when search string is not empty should render mention list showing filtered results 1`] = `
|
|
4
|
+
<View>
|
|
5
|
+
<RCTScrollView
|
|
6
|
+
data={
|
|
7
|
+
Array [
|
|
8
|
+
Object {
|
|
9
|
+
"id": "3",
|
|
10
|
+
"name": "Hieu Pham",
|
|
11
|
+
},
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
getItem={[Function]}
|
|
15
|
+
getItemCount={[Function]}
|
|
16
|
+
keyExtractor={[Function]}
|
|
17
|
+
keyboardShouldPersistTaps="handled"
|
|
18
|
+
onContentSizeChange={[Function]}
|
|
19
|
+
onLayout={[Function]}
|
|
20
|
+
onMomentumScrollBegin={[Function]}
|
|
21
|
+
onMomentumScrollEnd={[Function]}
|
|
22
|
+
onScroll={[Function]}
|
|
23
|
+
onScrollBeginDrag={[Function]}
|
|
24
|
+
onScrollEndDrag={[Function]}
|
|
25
|
+
removeClippedSubviews={false}
|
|
26
|
+
renderItem={[Function]}
|
|
27
|
+
scrollEventThrottle={50}
|
|
28
|
+
stickyHeaderIndices={Array []}
|
|
29
|
+
viewabilityConfigCallbackPairs={Array []}
|
|
30
|
+
>
|
|
31
|
+
<View>
|
|
32
|
+
<View
|
|
33
|
+
onLayout={[Function]}
|
|
34
|
+
style={null}
|
|
35
|
+
>
|
|
36
|
+
<Text
|
|
37
|
+
onPress={[Function]}
|
|
38
|
+
>
|
|
39
|
+
Hieu Pham
|
|
40
|
+
</Text>
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
</RCTScrollView>
|
|
44
|
+
</View>
|
|
45
|
+
`;
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`RichTextEditor onMessage recevied event editor-layout should update height 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"marginVertical": 8,
|
|
9
|
+
"width": "100%",
|
|
10
|
+
},
|
|
11
|
+
Object {
|
|
12
|
+
"backgroundColor": "yellow",
|
|
13
|
+
},
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
>
|
|
17
|
+
<View
|
|
18
|
+
style={
|
|
19
|
+
Array [
|
|
20
|
+
Object {
|
|
21
|
+
"alignItems": "center",
|
|
22
|
+
"flexDirection": "row",
|
|
23
|
+
"padding": 16,
|
|
24
|
+
},
|
|
25
|
+
undefined,
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
<View
|
|
30
|
+
style={
|
|
31
|
+
Array [
|
|
32
|
+
Object {
|
|
33
|
+
"borderColor": "#de350b",
|
|
34
|
+
"borderRadius": 8,
|
|
35
|
+
"borderWidth": 1,
|
|
36
|
+
"bottom": 0,
|
|
37
|
+
"left": 0,
|
|
38
|
+
"position": "absolute",
|
|
39
|
+
"right": 0,
|
|
40
|
+
"top": 0,
|
|
41
|
+
},
|
|
42
|
+
undefined,
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
themeVariant="error"
|
|
46
|
+
/>
|
|
47
|
+
<View
|
|
48
|
+
style={
|
|
49
|
+
Array [
|
|
50
|
+
Object {
|
|
51
|
+
"alignItems": "center",
|
|
52
|
+
"alignSelf": "stretch",
|
|
53
|
+
"flexDirection": "row",
|
|
54
|
+
"flexGrow": 2,
|
|
55
|
+
},
|
|
56
|
+
undefined,
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
<View
|
|
61
|
+
pointerEvents="none"
|
|
62
|
+
style={
|
|
63
|
+
Array [
|
|
64
|
+
Object {
|
|
65
|
+
"alignItems": "center",
|
|
66
|
+
"bottom": 0,
|
|
67
|
+
"flexDirection": "row",
|
|
68
|
+
"left": 0,
|
|
69
|
+
"position": "absolute",
|
|
70
|
+
"right": 0,
|
|
71
|
+
"top": 0,
|
|
72
|
+
"zIndex": 9999,
|
|
73
|
+
},
|
|
74
|
+
undefined,
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<Text
|
|
79
|
+
style={
|
|
80
|
+
Array [
|
|
81
|
+
Object {
|
|
82
|
+
"color": "#292a2b",
|
|
83
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
84
|
+
"fontSize": 14,
|
|
85
|
+
"letterSpacing": 0.42,
|
|
86
|
+
"lineHeight": 22,
|
|
87
|
+
},
|
|
88
|
+
Array [
|
|
89
|
+
Object {
|
|
90
|
+
"alignContent": "center",
|
|
91
|
+
"alignItems": "center",
|
|
92
|
+
"color": "#292a2b",
|
|
93
|
+
"fontSize": 14,
|
|
94
|
+
"textAlignVertical": "center",
|
|
95
|
+
},
|
|
96
|
+
undefined,
|
|
97
|
+
],
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
testID="input-label"
|
|
101
|
+
themeFontSize="medium"
|
|
102
|
+
themeFontWeight="regular"
|
|
103
|
+
themeIntent="body"
|
|
104
|
+
themeVariant="error"
|
|
105
|
+
>
|
|
106
|
+
Rich Text Editor
|
|
107
|
+
</Text>
|
|
108
|
+
</View>
|
|
109
|
+
<View
|
|
110
|
+
accessible={true}
|
|
111
|
+
focusable={true}
|
|
112
|
+
height={480}
|
|
113
|
+
hideKeyboardAccessoryView={true}
|
|
114
|
+
keyboardDisplayRequiresUserAction={false}
|
|
115
|
+
onClick={[Function]}
|
|
116
|
+
onResponderGrant={[Function]}
|
|
117
|
+
onResponderMove={[Function]}
|
|
118
|
+
onResponderRelease={[Function]}
|
|
119
|
+
onResponderTerminate={[Function]}
|
|
120
|
+
onResponderTerminationRequest={[Function]}
|
|
121
|
+
onStartShouldSetResponder={[Function]}
|
|
122
|
+
originWhitelist={
|
|
123
|
+
Array [
|
|
124
|
+
"*",
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
scrollEnabled={false}
|
|
128
|
+
source={
|
|
129
|
+
Object {
|
|
130
|
+
"html": "
|
|
131
|
+
<!DOCTYPE html>
|
|
132
|
+
<html>
|
|
133
|
+
<head>
|
|
134
|
+
<meta charset=\\"utf-8\\">
|
|
135
|
+
<meta name=\\"viewport\\" content=\\"width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0\\">
|
|
136
|
+
<style>
|
|
137
|
+
body {
|
|
138
|
+
margin: 0;
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
141
|
+
</head>
|
|
142
|
+
<body>
|
|
143
|
+
<div id=\\"root\\"></div>
|
|
144
|
+
<script>
|
|
145
|
+
window.__editorConfigs = {
|
|
146
|
+
placeholder: \\"\\",
|
|
147
|
+
initialValue: [{\\"type\\":\\"paragraph\\",\\"children\\":[{\\"text\\":\\"\\"}]}],
|
|
148
|
+
isAndroid: false,
|
|
149
|
+
autoFocus: true,
|
|
150
|
+
style: {
|
|
151
|
+
padding: '0 !important',
|
|
152
|
+
fontSize: 14
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
[object Object]
|
|
156
|
+
</script>
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
",
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
style={
|
|
163
|
+
Array [
|
|
164
|
+
Object {
|
|
165
|
+
"alignSelf": "stretch",
|
|
166
|
+
"backgroundColor": "transparent",
|
|
167
|
+
"flexGrow": 2,
|
|
168
|
+
"fontSize": 14,
|
|
169
|
+
"height": 480,
|
|
170
|
+
"marginHorizontal": 8,
|
|
171
|
+
"minHeight": 21,
|
|
172
|
+
"textAlignVertical": "center",
|
|
173
|
+
},
|
|
174
|
+
Object {
|
|
175
|
+
"backgroundColor": "yellow",
|
|
176
|
+
},
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
testID="webview"
|
|
180
|
+
/>
|
|
181
|
+
</View>
|
|
182
|
+
</View>
|
|
183
|
+
<View
|
|
184
|
+
style={
|
|
185
|
+
Array [
|
|
186
|
+
Object {
|
|
187
|
+
"paddingLeft": 16,
|
|
188
|
+
},
|
|
189
|
+
undefined,
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
>
|
|
193
|
+
<View
|
|
194
|
+
style={
|
|
195
|
+
Array [
|
|
196
|
+
Object {
|
|
197
|
+
"flexDirection": "row",
|
|
198
|
+
"justifyContent": "space-between",
|
|
199
|
+
},
|
|
200
|
+
undefined,
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
>
|
|
204
|
+
<View
|
|
205
|
+
style={
|
|
206
|
+
Array [
|
|
207
|
+
Object {
|
|
208
|
+
"alignItems": "center",
|
|
209
|
+
"flex": 1,
|
|
210
|
+
"flexDirection": "row",
|
|
211
|
+
"flexGrow": 4,
|
|
212
|
+
"marginRight": 4,
|
|
213
|
+
},
|
|
214
|
+
undefined,
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
>
|
|
218
|
+
<HeroIcon
|
|
219
|
+
name="circle-info"
|
|
220
|
+
style={
|
|
221
|
+
Array [
|
|
222
|
+
Object {
|
|
223
|
+
"color": "#de350b",
|
|
224
|
+
"fontSize": 16,
|
|
225
|
+
},
|
|
226
|
+
undefined,
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
testID="input-error-icon"
|
|
230
|
+
themeIntent="danger"
|
|
231
|
+
themeSize="xsmall"
|
|
232
|
+
/>
|
|
233
|
+
<Text
|
|
234
|
+
style={
|
|
235
|
+
Array [
|
|
236
|
+
Object {
|
|
237
|
+
"color": "#292a2b",
|
|
238
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
239
|
+
"fontSize": 14,
|
|
240
|
+
"letterSpacing": 0.42,
|
|
241
|
+
"lineHeight": 22,
|
|
242
|
+
},
|
|
243
|
+
Array [
|
|
244
|
+
Object {
|
|
245
|
+
"color": "#de350b",
|
|
246
|
+
"fontSize": 12,
|
|
247
|
+
"marginLeft": 4,
|
|
248
|
+
},
|
|
249
|
+
undefined,
|
|
250
|
+
],
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
testID="input-error-message"
|
|
254
|
+
themeFontSize="medium"
|
|
255
|
+
themeFontWeight="regular"
|
|
256
|
+
themeIntent="body"
|
|
257
|
+
>
|
|
258
|
+
this is error
|
|
259
|
+
</Text>
|
|
260
|
+
</View>
|
|
261
|
+
</View>
|
|
262
|
+
</View>
|
|
263
|
+
</View>
|
|
264
|
+
`;
|
|
265
|
+
|
|
266
|
+
exports[`RichTextEditor should render correctly 1`] = `
|
|
267
|
+
<View
|
|
268
|
+
style={
|
|
269
|
+
Array [
|
|
270
|
+
Object {
|
|
271
|
+
"marginVertical": 8,
|
|
272
|
+
"width": "100%",
|
|
273
|
+
},
|
|
274
|
+
Object {
|
|
275
|
+
"backgroundColor": "yellow",
|
|
276
|
+
},
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
>
|
|
280
|
+
<View
|
|
281
|
+
style={
|
|
282
|
+
Array [
|
|
283
|
+
Object {
|
|
284
|
+
"alignItems": "center",
|
|
285
|
+
"flexDirection": "row",
|
|
286
|
+
"padding": 16,
|
|
287
|
+
},
|
|
288
|
+
undefined,
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
>
|
|
292
|
+
<View
|
|
293
|
+
style={
|
|
294
|
+
Array [
|
|
295
|
+
Object {
|
|
296
|
+
"borderColor": "#de350b",
|
|
297
|
+
"borderRadius": 8,
|
|
298
|
+
"borderWidth": 1,
|
|
299
|
+
"bottom": 0,
|
|
300
|
+
"left": 0,
|
|
301
|
+
"position": "absolute",
|
|
302
|
+
"right": 0,
|
|
303
|
+
"top": 0,
|
|
304
|
+
},
|
|
305
|
+
undefined,
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
themeVariant="error"
|
|
309
|
+
/>
|
|
310
|
+
<View
|
|
311
|
+
style={
|
|
312
|
+
Array [
|
|
313
|
+
Object {
|
|
314
|
+
"alignItems": "center",
|
|
315
|
+
"alignSelf": "stretch",
|
|
316
|
+
"flexDirection": "row",
|
|
317
|
+
"flexGrow": 2,
|
|
318
|
+
},
|
|
319
|
+
undefined,
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
>
|
|
323
|
+
<View
|
|
324
|
+
pointerEvents="none"
|
|
325
|
+
style={
|
|
326
|
+
Array [
|
|
327
|
+
Object {
|
|
328
|
+
"alignItems": "center",
|
|
329
|
+
"bottom": 0,
|
|
330
|
+
"flexDirection": "row",
|
|
331
|
+
"left": 0,
|
|
332
|
+
"position": "absolute",
|
|
333
|
+
"right": 0,
|
|
334
|
+
"top": 0,
|
|
335
|
+
"zIndex": 9999,
|
|
336
|
+
},
|
|
337
|
+
undefined,
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
>
|
|
341
|
+
<Text
|
|
342
|
+
style={
|
|
343
|
+
Array [
|
|
344
|
+
Object {
|
|
345
|
+
"color": "#292a2b",
|
|
346
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
347
|
+
"fontSize": 14,
|
|
348
|
+
"letterSpacing": 0.42,
|
|
349
|
+
"lineHeight": 22,
|
|
350
|
+
},
|
|
351
|
+
Array [
|
|
352
|
+
Object {
|
|
353
|
+
"alignContent": "center",
|
|
354
|
+
"alignItems": "center",
|
|
355
|
+
"color": "#292a2b",
|
|
356
|
+
"fontSize": 14,
|
|
357
|
+
"textAlignVertical": "center",
|
|
358
|
+
},
|
|
359
|
+
undefined,
|
|
360
|
+
],
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
testID="input-label"
|
|
364
|
+
themeFontSize="medium"
|
|
365
|
+
themeFontWeight="regular"
|
|
366
|
+
themeIntent="body"
|
|
367
|
+
themeVariant="error"
|
|
368
|
+
>
|
|
369
|
+
Rich Text Editor
|
|
370
|
+
</Text>
|
|
371
|
+
</View>
|
|
372
|
+
<View
|
|
373
|
+
accessible={true}
|
|
374
|
+
focusable={true}
|
|
375
|
+
hideKeyboardAccessoryView={true}
|
|
376
|
+
keyboardDisplayRequiresUserAction={false}
|
|
377
|
+
onClick={[Function]}
|
|
378
|
+
onResponderGrant={[Function]}
|
|
379
|
+
onResponderMove={[Function]}
|
|
380
|
+
onResponderRelease={[Function]}
|
|
381
|
+
onResponderTerminate={[Function]}
|
|
382
|
+
onResponderTerminationRequest={[Function]}
|
|
383
|
+
onStartShouldSetResponder={[Function]}
|
|
384
|
+
originWhitelist={
|
|
385
|
+
Array [
|
|
386
|
+
"*",
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
scrollEnabled={false}
|
|
390
|
+
source={
|
|
391
|
+
Object {
|
|
392
|
+
"html": "
|
|
393
|
+
<!DOCTYPE html>
|
|
394
|
+
<html>
|
|
395
|
+
<head>
|
|
396
|
+
<meta charset=\\"utf-8\\">
|
|
397
|
+
<meta name=\\"viewport\\" content=\\"width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0\\">
|
|
398
|
+
<style>
|
|
399
|
+
body {
|
|
400
|
+
margin: 0;
|
|
401
|
+
}
|
|
402
|
+
</style>
|
|
403
|
+
</head>
|
|
404
|
+
<body>
|
|
405
|
+
<div id=\\"root\\"></div>
|
|
406
|
+
<script>
|
|
407
|
+
window.__editorConfigs = {
|
|
408
|
+
placeholder: \\"\\",
|
|
409
|
+
initialValue: [{\\"type\\":\\"paragraph\\",\\"children\\":[{\\"text\\":\\"\\"}]}],
|
|
410
|
+
isAndroid: false,
|
|
411
|
+
autoFocus: true,
|
|
412
|
+
style: {
|
|
413
|
+
padding: '0 !important',
|
|
414
|
+
fontSize: 14
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
[object Object]
|
|
418
|
+
</script>
|
|
419
|
+
</body>
|
|
420
|
+
</html>
|
|
421
|
+
",
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
style={
|
|
425
|
+
Array [
|
|
426
|
+
Object {
|
|
427
|
+
"alignSelf": "stretch",
|
|
428
|
+
"backgroundColor": "transparent",
|
|
429
|
+
"flexGrow": 2,
|
|
430
|
+
"fontSize": 14,
|
|
431
|
+
"height": undefined,
|
|
432
|
+
"marginHorizontal": 8,
|
|
433
|
+
"minHeight": 21,
|
|
434
|
+
"textAlignVertical": "center",
|
|
435
|
+
},
|
|
436
|
+
Object {
|
|
437
|
+
"backgroundColor": "yellow",
|
|
438
|
+
},
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
testID="webview"
|
|
442
|
+
/>
|
|
443
|
+
</View>
|
|
444
|
+
</View>
|
|
445
|
+
<View
|
|
446
|
+
style={
|
|
447
|
+
Array [
|
|
448
|
+
Object {
|
|
449
|
+
"paddingLeft": 16,
|
|
450
|
+
},
|
|
451
|
+
undefined,
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
>
|
|
455
|
+
<View
|
|
456
|
+
style={
|
|
457
|
+
Array [
|
|
458
|
+
Object {
|
|
459
|
+
"flexDirection": "row",
|
|
460
|
+
"justifyContent": "space-between",
|
|
461
|
+
},
|
|
462
|
+
undefined,
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
>
|
|
466
|
+
<View
|
|
467
|
+
style={
|
|
468
|
+
Array [
|
|
469
|
+
Object {
|
|
470
|
+
"alignItems": "center",
|
|
471
|
+
"flex": 1,
|
|
472
|
+
"flexDirection": "row",
|
|
473
|
+
"flexGrow": 4,
|
|
474
|
+
"marginRight": 4,
|
|
475
|
+
},
|
|
476
|
+
undefined,
|
|
477
|
+
]
|
|
478
|
+
}
|
|
479
|
+
>
|
|
480
|
+
<HeroIcon
|
|
481
|
+
name="circle-info"
|
|
482
|
+
style={
|
|
483
|
+
Array [
|
|
484
|
+
Object {
|
|
485
|
+
"color": "#de350b",
|
|
486
|
+
"fontSize": 16,
|
|
487
|
+
},
|
|
488
|
+
undefined,
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
testID="input-error-icon"
|
|
492
|
+
themeIntent="danger"
|
|
493
|
+
themeSize="xsmall"
|
|
494
|
+
/>
|
|
495
|
+
<Text
|
|
496
|
+
style={
|
|
497
|
+
Array [
|
|
498
|
+
Object {
|
|
499
|
+
"color": "#292a2b",
|
|
500
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
501
|
+
"fontSize": 14,
|
|
502
|
+
"letterSpacing": 0.42,
|
|
503
|
+
"lineHeight": 22,
|
|
504
|
+
},
|
|
505
|
+
Array [
|
|
506
|
+
Object {
|
|
507
|
+
"color": "#de350b",
|
|
508
|
+
"fontSize": 12,
|
|
509
|
+
"marginLeft": 4,
|
|
510
|
+
},
|
|
511
|
+
undefined,
|
|
512
|
+
],
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
testID="input-error-message"
|
|
516
|
+
themeFontSize="medium"
|
|
517
|
+
themeFontWeight="regular"
|
|
518
|
+
themeIntent="body"
|
|
519
|
+
>
|
|
520
|
+
this is error
|
|
521
|
+
</Text>
|
|
522
|
+
</View>
|
|
523
|
+
</View>
|
|
524
|
+
</View>
|
|
525
|
+
</View>
|
|
526
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export enum ToolbarEvents {
|
|
2
|
+
Bold = 'bold',
|
|
3
|
+
Italic = 'italic',
|
|
4
|
+
Underline = 'underline',
|
|
5
|
+
BulletedList = 'bulleted-list',
|
|
6
|
+
NumberedList = 'numbered-list',
|
|
7
|
+
HeadingOne = 'heading-one',
|
|
8
|
+
HeadingTwo = 'heading-two',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum ToolbarButtonName {
|
|
12
|
+
Bold = 'bold',
|
|
13
|
+
Italic = 'italic',
|
|
14
|
+
Underline = 'underline',
|
|
15
|
+
BulletedList = 'bulletedList',
|
|
16
|
+
NumberedList = 'numberedList',
|
|
17
|
+
HeadingOne = 'headingOne',
|
|
18
|
+
HeadingTwo = 'headingTwo',
|
|
19
|
+
Seperator = '|',
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
|
|
3
|
+
export interface Listener<T> {
|
|
4
|
+
(data: T): void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const off = <T>(
|
|
8
|
+
emitter: EventEmitter,
|
|
9
|
+
eventName: string,
|
|
10
|
+
listener: Listener<T>
|
|
11
|
+
) => {
|
|
12
|
+
emitter.off(eventName, listener);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const emit = <T>(emitter: EventEmitter, eventName: string, data: T) =>
|
|
16
|
+
emitter.emit(eventName, data);
|
|
17
|
+
|
|
18
|
+
export const setMaxListeners = (emitter: EventEmitter, n: number) => {
|
|
19
|
+
emitter.setMaxListeners(n);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const on = <T>(
|
|
23
|
+
emitter: EventEmitter,
|
|
24
|
+
eventName: string,
|
|
25
|
+
listener: Listener<T>
|
|
26
|
+
) => {
|
|
27
|
+
emitter.on(eventName, listener);
|
|
28
|
+
return () => {
|
|
29
|
+
emitter.off(eventName, listener);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import WebView from 'react-native-webview';
|
|
2
|
+
|
|
3
|
+
export const requestBlurEditor = (element: WebView): void => {
|
|
4
|
+
element.injectJavaScript(
|
|
5
|
+
'\n window.document.activeElement && window.document.activeElement.blur();\n '
|
|
6
|
+
);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export interface WebViewEventMessage {
|
|
10
|
+
type: string;
|
|
11
|
+
data: any;
|
|
12
|
+
}
|
|
13
|
+
export const postMessage = (
|
|
14
|
+
element: WebView,
|
|
15
|
+
message: WebViewEventMessage
|
|
16
|
+
): void => {
|
|
17
|
+
const messageString = JSON.stringify(message);
|
|
18
|
+
element.injectJavaScript(`window.postMessage(${messageString}, '*');`);
|
|
19
|
+
};
|