瀏覽代碼

initial commit

master
munir ishak 4 年之前
當前提交
e072d8b6d1
共有 100 個文件被更改,包括 3964 次插入0 次删除
  1. 49
    0
      .gitignore
  2. 224
    0
      .npmignore
  3. 34
    0
      LICENSE
  4. 33
    0
      README.md
  5. 3
    0
      example/.babelrc
  6. 6
    0
      example/.buckconfig
  7. 48
    0
      example/.flowconfig
  8. 1
    0
      example/.gitattributes
  9. 53
    0
      example/.gitignore
  10. 1
    0
      example/.watchmanconfig
  11. 12
    0
      example/__tests__/App.js
  12. 17
    0
      example/android/.project
  13. 2
    0
      example/android/.settings/org.eclipse.buildship.core.prefs
  14. 6
    0
      example/android/app/.classpath
  15. 23
    0
      example/android/app/.project
  16. 2
    0
      example/android/app/.settings/org.eclipse.buildship.core.prefs
  17. 65
    0
      example/android/app/BUCK
  18. 156
    0
      example/android/app/build.gradle
  19. 70
    0
      example/android/app/proguard-rules.pro
  20. 32
    0
      example/android/app/src/main/AndroidManifest.xml
  21. 15
    0
      example/android/app/src/main/java/com/example/MainActivity.java
  22. 47
    0
      example/android/app/src/main/java/com/example/MainApplication.java
  23. 二進制
      example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
  24. 二進制
      example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
  25. 二進制
      example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  26. 二進制
      example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  27. 3
    0
      example/android/app/src/main/res/values/strings.xml
  28. 8
    0
      example/android/app/src/main/res/values/styles.xml
  29. 24
    0
      example/android/build.gradle
  30. 20
    0
      example/android/gradle.properties
  31. 二進制
      example/android/gradle/wrapper/gradle-wrapper.jar
  32. 5
    0
      example/android/gradle/wrapper/gradle-wrapper.properties
  33. 164
    0
      example/android/gradlew
  34. 90
    0
      example/android/gradlew.bat
  35. 8
    0
      example/android/keystores/BUCK
  36. 4
    0
      example/android/keystores/debug.keystore.properties
  37. 6
    0
      example/android/settings.gradle
  38. 71
    0
      example/app.js
  39. 4
    0
      example/app.json
  40. 4
    0
      example/index.js
  41. 54
    0
      example/ios/example-tvOS/Info.plist
  42. 24
    0
      example/ios/example-tvOSTests/Info.plist
  43. 1456
    0
      example/ios/example.xcodeproj/project.pbxproj
  44. 129
    0
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme
  45. 129
    0
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme
  46. 16
    0
      example/ios/example/AppDelegate.h
  47. 37
    0
      example/ios/example/AppDelegate.m
  48. 42
    0
      example/ios/example/Base.lproj/LaunchScreen.xib
  49. 38
    0
      example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json
  50. 6
    0
      example/ios/example/Images.xcassets/Contents.json
  51. 56
    0
      example/ios/example/Info.plist
  52. 18
    0
      example/ios/example/main.m
  53. 24
    0
      example/ios/exampleTests/Info.plist
  54. 70
    0
      example/ios/exampleTests/exampleTests.m
  55. 24
    0
      example/package.json
  56. 12
    0
      htmlCopy.gradle
  57. 二進制
      img/icon_format_bold@1.5x.png
  58. 二進制
      img/icon_format_bold@1x.png
  59. 二進制
      img/icon_format_bold@2x.png
  60. 二進制
      img/icon_format_bold@3x.png
  61. 二進制
      img/icon_format_bold@4x.png
  62. 二進制
      img/icon_format_italic@1.5x.png
  63. 二進制
      img/icon_format_italic@1x.png
  64. 二進制
      img/icon_format_italic@2x.png
  65. 二進制
      img/icon_format_italic@3x.png
  66. 二進制
      img/icon_format_italic@4x.png
  67. 二進制
      img/icon_format_link@1.5x.png
  68. 二進制
      img/icon_format_link@1x.png
  69. 二進制
      img/icon_format_link@2x.png
  70. 二進制
      img/icon_format_link@3x.png
  71. 二進制
      img/icon_format_link@4x.png
  72. 二進制
      img/icon_format_media@1.5x.png
  73. 二進制
      img/icon_format_media@1x.png
  74. 二進制
      img/icon_format_media@2x.png
  75. 二進制
      img/icon_format_media@3x.png
  76. 二進制
      img/icon_format_media@4x.png
  77. 二進制
      img/icon_format_ol@1.5x.png
  78. 二進制
      img/icon_format_ol@1x.png
  79. 二進制
      img/icon_format_ol@2x.png
  80. 二進制
      img/icon_format_ol@3x.png
  81. 二進制
      img/icon_format_ol@4x.png
  82. 二進制
      img/icon_format_ul@1.5x.png
  83. 二進制
      img/icon_format_ul@1x.png
  84. 二進制
      img/icon_format_ul@2x.png
  85. 二進制
      img/icon_format_ul@3x.png
  86. 二進制
      img/icon_format_ul@4x.png
  87. 7
    0
      index.js
  88. 6
    0
      newExample/.buckconfig
  89. 4
    0
      newExample/.eslintrc.js
  90. 75
    0
      newExample/.flowconfig
  91. 1
    0
      newExample/.gitattributes
  92. 59
    0
      newExample/.gitignore
  93. 6
    0
      newExample/.prettierrc.js
  94. 1
    0
      newExample/.watchmanconfig
  95. 71
    0
      newExample/App.js
  96. 14
    0
      newExample/__tests__/App-test.js
  97. 55
    0
      newExample/android/app/BUCK
  98. 201
    0
      newExample/android/app/build.gradle
  99. 19
    0
      newExample/android/app/build_defs.bzl
  100. 0
    0
      newExample/android/app/debug.keystore

+ 49
- 0
.gitignore 查看文件

@@ -0,0 +1,49 @@
1
+# OSX
2
+#
3
+.DS_Store
4
+
5
+# Xcode
6
+#
7
+build/
8
+*.pbxuser
9
+!default.pbxuser
10
+*.mode1v3
11
+!default.mode1v3
12
+*.mode2v3
13
+!default.mode2v3
14
+*.perspectivev3
15
+!default.perspectivev3
16
+xcuserdata
17
+*.xccheckout
18
+*.moved-aside
19
+DerivedData
20
+*.hmap
21
+*.ipa
22
+*.xcuserstate
23
+project.xcworkspace
24
+
25
+# Android/IJ
26
+#
27
+.idea
28
+.gradle
29
+local.properties
30
+*.iml
31
+
32
+# node.js
33
+#
34
+node_modules/
35
+npm-debug.log
36
+
37
+# BUCK
38
+buck-out/
39
+\.buckd/
40
+android/app/libs
41
+android/keystores/debug.keystore
42
+android/*.iml
43
+android/app/*.iml
44
+yarn.lock
45
+*.log
46
+
47
+example/android/app/src/main/assets/editor.html
48
+
49
+.vscode/

+ 224
- 0
.npmignore 查看文件

@@ -0,0 +1,224 @@
1
+example/
2
+readme/
3
+test/
4
+res/generated/
5
+
6
+.npmignore
7
+
8
+
9
+#################
10
+# from .gitignore:
11
+################
12
+
13
+
14
+############
15
+# Node
16
+############
17
+# Logs
18
+logs
19
+*.log
20
+npm-debug.log*
21
+
22
+# Runtime data
23
+pids
24
+*.pid
25
+*.seed
26
+
27
+# Directory for instrumented libs generated by jscoverage/JSCover
28
+lib-cov
29
+
30
+# Coverage directory used by tools like istanbul
31
+coverage
32
+
33
+# nyc test coverage
34
+.nyc_output
35
+
36
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
37
+.grunt
38
+
39
+# node-waf configuration
40
+.lock-wscript
41
+
42
+# Compiled binary addons (http://nodejs.org/api/addons.html)
43
+build/Release
44
+
45
+# Dependency directories
46
+node_modules
47
+jspm_packages
48
+
49
+# Optional npm cache directory
50
+.npm
51
+
52
+# Optional REPL history
53
+.node_repl_history
54
+
55
+################
56
+# JetBrains
57
+################
58
+.idea
59
+
60
+## File-based project format:
61
+*.iws
62
+
63
+## Plugin-specific files:
64
+
65
+# IntelliJ
66
+/out/
67
+
68
+# mpeltonen/sbt-idea plugin
69
+.idea_modules/
70
+
71
+# JIRA plugin
72
+atlassian-ide-plugin.xml
73
+
74
+# Crashlytics plugin (for Android Studio and IntelliJ)
75
+com_crashlytics_export_strings.xml
76
+crashlytics.properties
77
+crashlytics-build.properties
78
+fabric.properties
79
+
80
+
81
+############
82
+# iOS
83
+############
84
+# Xcode
85
+#
86
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
87
+
88
+## Build generated
89
+ios/build/
90
+ios/DerivedData/
91
+
92
+## Various settings
93
+*.pbxuser
94
+!default.pbxuser
95
+*.mode1v3
96
+!default.mode1v3
97
+*.mode2v3
98
+!default.mode2v3
99
+*.perspectivev3
100
+!default.perspectivev3
101
+ios/xcuserdata/
102
+
103
+## Other
104
+*.moved-aside
105
+*.xcuserstate
106
+
107
+## Obj-C/Swift specific
108
+*.hmap
109
+*.ipa
110
+*.dSYM.zip
111
+*.dSYM
112
+
113
+# CocoaPods
114
+#
115
+# We recommend against adding the Pods directory to your .gitignore. However
116
+# you should judge for yourself, the pros and cons are mentioned at:
117
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
118
+#
119
+ios/Pods/
120
+
121
+# Carthage
122
+#
123
+# Add this line if you want to avoid checking in source code from Carthage dependencies.
124
+# Carthage/Checkouts
125
+
126
+Carthage/Build
127
+
128
+# fastlane
129
+#
130
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
131
+# screenshots whenever they are needed.
132
+# For more information about the recommended setup visit:
133
+# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
134
+
135
+fastlane/report.xml
136
+fastlane/screenshots
137
+
138
+
139
+############
140
+# Android
141
+############
142
+# Built application files
143
+*.apk
144
+*.ap_
145
+
146
+# Files for the Dalvik VM
147
+*.dex
148
+
149
+# Java class files
150
+*.class
151
+
152
+# Generated files
153
+android/bin/
154
+android/gen/
155
+android/out/
156
+
157
+# Gradle files
158
+android/.gradle/
159
+android/build/
160
+
161
+# Local configuration file (sdk path, etc)
162
+local.properties
163
+
164
+# Proguard folder generated by Eclipse
165
+android/proguard/
166
+
167
+# Log Files
168
+*.log
169
+
170
+# Android Studio Navigation editor temp files
171
+android/.navigation/
172
+
173
+# Android Studio captures folder
174
+android/captures/
175
+
176
+# Intellij
177
+*.iml
178
+
179
+# Keystore files
180
+*.jks
181
+
182
+##################
183
+# React-Native
184
+##################
185
+# OSX
186
+#
187
+.DS_Store
188
+
189
+# Xcode
190
+#
191
+build/
192
+*.pbxuser
193
+!default.pbxuser
194
+*.mode1v3
195
+!default.mode1v3
196
+*.mode2v3
197
+!default.mode2v3
198
+*.perspectivev3
199
+!default.perspectivev3
200
+xcuserdata
201
+*.xccheckout
202
+*.moved-aside
203
+DerivedData
204
+*.hmap
205
+*.ipa
206
+*.xcuserstate
207
+project.xcworkspace
208
+
209
+# Android/IJ
210
+#
211
+.idea
212
+.gradle
213
+local.properties
214
+
215
+# node.js
216
+#
217
+node_modules/
218
+npm-debug.log
219
+
220
+# BUCK
221
+buck-out/
222
+\.buckd/
223
+android/app/libs
224
+android/keystores/debug.keystore

+ 34
- 0
LICENSE 查看文件

@@ -0,0 +1,34 @@
1
+The Enhanced MIT License
2
+
3
+Introduction
4
+
5
+This license is exactly like the MIT License, with one exception –
6
+Any distribution of this source code or any modification thereof in source code format, must be done under the Enhanced MIT license and not under any other licenses, such as GPL.
7
+
8
+The Reason
9
+
10
+We believe MIT license has a bug since it allows others to use it against its nature. Our belief is that the MIT license is intended to make source code available to anyone who wants to use it without additional obligations, but we have found cases where someone takes a project licensed under MIT license, adds a few lines of source code to it, and then changes the licensing to a different, more restrictive license which is against the nature and the intent of the MIT license. By doing so, the source code released under the original MIT is no longer a true “free/open” source code, thus undermining the intention of the original creator of the source code.
11
+The concept of this Enhanced MIT license is simple and more robust – you can do what you want with this source code, exactly like any other MIT license, but if you release it again as open source (even if modified), you must release it under this Enhanced MIT license – to be clear, this is not a “viral” license, it only refers to the actual source code released under this license and not to other components interacting with it. If GPL is a viral license, this license can be described as a “robust” one as it prevents licensing changes that are against its nature and it defends its own licensing principles. The essence of the Enhanced MIT license is to prevent bullies from using open source code that is truly free and open under the MIT License and turning it into other viral and more restrictive licenses – such as GPL.
12
+
13
+Q: Can I build an application with it, or DLL, or any other binary distribution, and not share the source code?
14
+A: Yes, exactly like in a regular MIT license
15
+
16
+Q: Can I use the EMIT license in combination with other source codes under other licenses without being forced to change the license for the other source codes?
17
+A: Yes, this license does not require any change to other source codes, and it allows you to distribute it with other source code licensed under other licenses.
18
+
19
+Q: Can I add code to this license and then change the license to something else, such as GPL? Or MIT?
20
+A: No, if you add/change the source code, the license must be kept as Enhanced MIT license.
21
+
22
+Official Wording of The EMIT
23
+
24
+The Enhanced MIT License (EMIT)
25
+Copyright (c) 2016 Wix.com
26
+
27
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
28
+
29
+1) the above copyright notice, this permission notice and the complete introduction section above shall be included in all copies or substantial portions of the Software.
30
+2) when the Software is distributed as source code, the licensee is prohibited to change the license of the Software to any “viral” copyleft-type license, such as, inter alia: GPL, LGPL, EPL, MPL, etc.
31
+
32
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
+
34
+******************

+ 33
- 0
README.md 查看文件

@@ -0,0 +1,33 @@
1
+# React Native Rich Text Editor with react-native-webview
2
+
3
+> Visit [original repo](https://github.com/wix/react-native-zss-rich-text-editor) first
4
+
5
+This resolves [#171](https://github.com/wix/react-native-zss-rich-text-editor/issues/171), [#174](https://github.com/wix/react-native-zss-rich-text-editor/issues/174), and [#178](https://github.com/wix/react-native-zss-rich-text-editor/issues/178) 
6
+
7
+## Inspirations
8
+
9
+For now, the original library has problems of using two deprecated modules, ListView and react-native-webview-bridge-updated. ListView problem is solved by [Ankit-96](https://github.com/Ankit-96) 's [PR](https://github.com/wix/react-native-zss-rich-text-editor/pull/179). So I focused on removing react-native-webview-bridge-updated and making use of react-native-webview. 
10
+
11
+## What I did
12
+
13
+* Did just like what [Ankit-96](https://github.com/Ankit-96) did; replaced ListView with FlatList
14
+* Replaced react-native-webview-bridge-updated with react-native-webview
15
+  * Instead of injecting `MessageHandler` into webpage(WebViewBridge) and sending message through `sendToBridge`, I directly inject `zss_editor`'s function calls through `injectJavaScript`. To achieve that, I fixed `WebViewMessageHandler.js` to be mapper function, translating functions of `RichTextEditor` to those of `zss_editor`.
16
+  * In `editor.html`, replace `WebViewBridge.send` with `ReactNativeWebView.postMessage`
17
+* Added `./newExample`. You should `$ cd newExample; yarn; cd ios; pod install; cd ..; react-native run-ios;`.
18
+
19
+## How to use it
20
+
21
+* `$ yarn add https://github.com/jb-/react-native-zss-rich-text-editor`
22
+* `$ yarn add react-native-webview` (I'm not sure why I have to do this)
23
+* `$ cd ios; pod install;`
24
+
25
+## Limitations
26
+
27
+* Tested on RN 0.61.5, iOS only.
28
+
29
+* Since I worked it for my project only, I did not test it on other versions or on Android platform. If any of you are familiar with both Android and iOS natives, please refer to my project and collaborate.
30
+
31
+## References
32
+
33
+* https://github.com/react-native-community/react-native-webview/blob/master/docs/Guide.md#communicating-between-js-and-native

+ 3
- 0
example/.babelrc 查看文件

@@ -0,0 +1,3 @@
1
+{
2
+  "presets": ["react-native"]
3
+}

+ 6
- 0
example/.buckconfig 查看文件

@@ -0,0 +1,6 @@
1
+
2
+[android]
3
+  target = Google Inc.:Google APIs:23
4
+
5
+[maven_repositories]
6
+  central = https://repo1.maven.org/maven2

+ 48
- 0
example/.flowconfig 查看文件

@@ -0,0 +1,48 @@
1
+[ignore]
2
+; We fork some components by platform
3
+.*/*[.]android.js
4
+
5
+; Ignore "BUCK" generated dirs
6
+<PROJECT_ROOT>/\.buckd/
7
+
8
+; Ignore unexpected extra "@providesModule"
9
+.*/node_modules/.*/node_modules/fbjs/.*
10
+
11
+; Ignore duplicate module providers
12
+; For RN Apps installed via npm, "Libraries" folder is inside
13
+; "node_modules/react-native" but in the source repo it is in the root
14
+.*/Libraries/react-native/React.js
15
+
16
+; Ignore polyfills
17
+.*/Libraries/polyfills/.*
18
+
19
+[include]
20
+
21
+[libs]
22
+node_modules/react-native/Libraries/react-native/react-native-interface.js
23
+node_modules/react-native/flow/
24
+
25
+[options]
26
+emoji=true
27
+
28
+module.system=haste
29
+
30
+munge_underscores=true
31
+
32
+module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
33
+
34
+suppress_type=$FlowIssue
35
+suppress_type=$FlowFixMe
36
+suppress_type=$FlowFixMeProps
37
+suppress_type=$FlowFixMeState
38
+suppress_type=$FixMe
39
+
40
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
41
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
42
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
43
+suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
44
+
45
+unsafe.enable_getters_and_setters=true
46
+
47
+[version]
48
+^0.57.0

+ 1
- 0
example/.gitattributes 查看文件

@@ -0,0 +1 @@
1
+*.pbxproj -text

+ 53
- 0
example/.gitignore 查看文件

@@ -0,0 +1,53 @@
1
+# OSX
2
+#
3
+.DS_Store
4
+
5
+# Xcode
6
+#
7
+build/
8
+*.pbxuser
9
+!default.pbxuser
10
+*.mode1v3
11
+!default.mode1v3
12
+*.mode2v3
13
+!default.mode2v3
14
+*.perspectivev3
15
+!default.perspectivev3
16
+xcuserdata
17
+*.xccheckout
18
+*.moved-aside
19
+DerivedData
20
+*.hmap
21
+*.ipa
22
+*.xcuserstate
23
+project.xcworkspace
24
+
25
+# Android/IntelliJ
26
+#
27
+build/
28
+.idea
29
+.gradle
30
+local.properties
31
+*.iml
32
+
33
+# node.js
34
+#
35
+node_modules/
36
+npm-debug.log
37
+yarn-error.log
38
+
39
+# BUCK
40
+buck-out/
41
+\.buckd/
42
+*.keystore
43
+
44
+# fastlane
45
+#
46
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
+# screenshots whenever they are needed.
48
+# For more information about the recommended setup visit:
49
+# https://docs.fastlane.tools/best-practices/source-control/
50
+
51
+*/fastlane/report.xml
52
+*/fastlane/Preview.html
53
+*/fastlane/screenshots

+ 1
- 0
example/.watchmanconfig 查看文件

@@ -0,0 +1 @@
1
+{}

+ 12
- 0
example/__tests__/App.js 查看文件

@@ -0,0 +1,12 @@
1
+import 'react-native';
2
+import React from 'react';
3
+import App from '../App';
4
+
5
+// Note: test renderer must be required after react-native.
6
+import renderer from 'react-test-renderer';
7
+
8
+it('renders correctly', () => {
9
+  const tree = renderer.create(
10
+    <App />
11
+  );
12
+});

+ 17
- 0
example/android/.project 查看文件

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>example</name>
4
+	<comment>Project example created by Buildship.</comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+	</buildSpec>
14
+	<natures>
15
+		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
+	</natures>
17
+</projectDescription>

+ 2
- 0
example/android/.settings/org.eclipse.buildship.core.prefs 查看文件

@@ -0,0 +1,2 @@
1
+#Wed Jan 10 18:03:52 IST 2018
2
+connection.project.dir=

+ 6
- 0
example/android/app/.classpath 查看文件

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4
+	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
+	<classpathentry kind="output" path="bin"/>
6
+</classpath>

+ 23
- 0
example/android/app/.project 查看文件

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>app</name>
4
+	<comment>Project app created by Buildship.</comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>org.eclipse.jdt.core.javabuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+	</buildSpec>
19
+	<natures>
20
+		<nature>org.eclipse.jdt.core.javanature</nature>
21
+		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22
+	</natures>
23
+</projectDescription>

+ 2
- 0
example/android/app/.settings/org.eclipse.buildship.core.prefs 查看文件

@@ -0,0 +1,2 @@
1
+#Wed Jan 10 18:03:52 IST 2018
2
+connection.project.dir=..

+ 65
- 0
example/android/app/BUCK 查看文件

@@ -0,0 +1,65 @@
1
+# To learn about Buck see [Docs](https://buckbuild.com/).
2
+# To run your application with Buck:
3
+# - install Buck
4
+# - `npm start` - to start the packager
5
+# - `cd android`
6
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
+# - `buck install -r android/app` - compile, install and run application
9
+#
10
+
11
+lib_deps = []
12
+
13
+for jarfile in glob(['libs/*.jar']):
14
+  name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15
+  lib_deps.append(':' + name)
16
+  prebuilt_jar(
17
+    name = name,
18
+    binary_jar = jarfile,
19
+  )
20
+
21
+for aarfile in glob(['libs/*.aar']):
22
+  name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23
+  lib_deps.append(':' + name)
24
+  android_prebuilt_aar(
25
+    name = name,
26
+    aar = aarfile,
27
+  )
28
+
29
+android_library(
30
+    name = "all-libs",
31
+    exported_deps = lib_deps,
32
+)
33
+
34
+android_library(
35
+    name = "app-code",
36
+    srcs = glob([
37
+        "src/main/java/**/*.java",
38
+    ]),
39
+    deps = [
40
+        ":all-libs",
41
+        ":build_config",
42
+        ":res",
43
+    ],
44
+)
45
+
46
+android_build_config(
47
+    name = "build_config",
48
+    package = "com.example",
49
+)
50
+
51
+android_resource(
52
+    name = "res",
53
+    package = "com.example",
54
+    res = "src/main/res",
55
+)
56
+
57
+android_binary(
58
+    name = "app",
59
+    keystore = "//android/keystores:debug",
60
+    manifest = "src/main/AndroidManifest.xml",
61
+    package_type = "debug",
62
+    deps = [
63
+        ":app-code",
64
+    ],
65
+)

+ 156
- 0
example/android/app/build.gradle 查看文件

@@ -0,0 +1,156 @@
1
+apply plugin: "com.android.application"
2
+
3
+import com.android.build.OutputFile
4
+
5
+/**
6
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
+ * and bundleReleaseJsAndAssets).
8
+ * These basically call `react-native bundle` with the correct arguments during the Android build
9
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
+ * bundle directly from the development server. Below you can see all the possible configurations
11
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
+ *
14
+ * project.ext.react = [
15
+ *   // the name of the generated asset file containing your JS bundle
16
+ *   bundleAssetName: "index.android.bundle",
17
+ *
18
+ *   // the entry file for bundle generation
19
+ *   entryFile: "index.android.js",
20
+ *
21
+ *   // whether to bundle JS and assets in debug mode
22
+ *   bundleInDebug: false,
23
+ *
24
+ *   // whether to bundle JS and assets in release mode
25
+ *   bundleInRelease: true,
26
+ *
27
+ *   // whether to bundle JS and assets in another build variant (if configured).
28
+ *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29
+ *   // The configuration property can be in the following formats
30
+ *   //         'bundleIn${productFlavor}${buildType}'
31
+ *   //         'bundleIn${buildType}'
32
+ *   // bundleInFreeDebug: true,
33
+ *   // bundleInPaidRelease: true,
34
+ *   // bundleInBeta: true,
35
+ *
36
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
37
+ *   // for example: to disable dev mode in the staging build type (if configured)
38
+ *   devDisabledInStaging: true,
39
+ *   // The configuration property can be in the following formats
40
+ *   //         'devDisabledIn${productFlavor}${buildType}'
41
+ *   //         'devDisabledIn${buildType}'
42
+ *
43
+ *   // the root of your project, i.e. where "package.json" lives
44
+ *   root: "../../",
45
+ *
46
+ *   // where to put the JS bundle asset in debug mode
47
+ *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48
+ *
49
+ *   // where to put the JS bundle asset in release mode
50
+ *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51
+ *
52
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
53
+ *   // require('./image.png')), in debug mode
54
+ *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55
+ *
56
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
57
+ *   // require('./image.png')), in release mode
58
+ *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59
+ *
60
+ *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61
+ *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62
+ *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
63
+ *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64
+ *   // for example, you might want to remove it from here.
65
+ *   inputExcludes: ["android/**", "ios/**"],
66
+ *
67
+ *   // override which node gets called and with what additional arguments
68
+ *   nodeExecutableAndArgs: ["node"],
69
+ *
70
+ *   // supply additional arguments to the packager
71
+ *   extraPackagerArgs: []
72
+ * ]
73
+ */
74
+
75
+project.ext.react = [
76
+    entryFile: "index.js"
77
+]
78
+
79
+apply from: "../../node_modules/react-native/react.gradle"
80
+
81
+/**
82
+ * Set this to true to create two separate APKs instead of one:
83
+ *   - An APK that only works on ARM devices
84
+ *   - An APK that only works on x86 devices
85
+ * The advantage is the size of the APK is reduced by about 4MB.
86
+ * Upload all the APKs to the Play Store and people will download
87
+ * the correct one based on the CPU architecture of their device.
88
+ */
89
+def enableSeparateBuildPerCPUArchitecture = false
90
+
91
+/**
92
+ * Run Proguard to shrink the Java bytecode in release builds.
93
+ */
94
+def enableProguardInReleaseBuilds = false
95
+
96
+android {
97
+    compileSdkVersion 23
98
+    buildToolsVersion "23.0.1"
99
+
100
+    defaultConfig {
101
+        applicationId "com.example"
102
+        minSdkVersion 16
103
+        targetSdkVersion 22
104
+        versionCode 1
105
+        versionName "1.0"
106
+        ndk {
107
+            abiFilters "armeabi-v7a", "x86"
108
+        }
109
+    }
110
+    splits {
111
+        abi {
112
+            reset()
113
+            enable enableSeparateBuildPerCPUArchitecture
114
+            universalApk false  // If true, also generate a universal APK
115
+            include "armeabi-v7a", "x86"
116
+        }
117
+    }
118
+    buildTypes {
119
+        release {
120
+            minifyEnabled enableProguardInReleaseBuilds
121
+            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
122
+        }
123
+    }
124
+    // applicationVariants are e.g. debug, release
125
+    applicationVariants.all { variant ->
126
+        variant.outputs.each { output ->
127
+            // For each separate APK per architecture, set a unique version code as described here:
128
+            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129
+            def versionCodes = ["armeabi-v7a":1, "x86":2]
130
+            def abi = output.getFilter(OutputFile.ABI)
131
+            if (abi != null) {  // null for the universal-debug, universal-release variants
132
+                output.versionCodeOverride =
133
+                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134
+            }
135
+        }
136
+    }
137
+}
138
+
139
+dependencies {
140
+    compile fileTree(dir: "libs", include: ["*.jar"])
141
+    compile "com.android.support:appcompat-v7:23.0.1"
142
+    compile "com.facebook.react:react-native:+"  // From node_modules
143
+    compile project(':react-native-webview-bridge')
144
+}
145
+
146
+// Run this once to be able to run the application with BUCK
147
+// puts all compile dependencies into folder libs for BUCK to use
148
+task copyDownloadableDepsToLibs(type: Copy) {
149
+  from configurations.compile
150
+  into 'libs'
151
+}
152
+
153
+project.afterEvaluate {
154
+    apply from: '../../node_modules/react-native-zss-rich-text-editor/htmlCopy.gradle';
155
+    copyEditorHtmlToAppAssets(file('../../node_modules/react-native-zss-rich-text-editor'))
156
+}

+ 70
- 0
example/android/app/proguard-rules.pro 查看文件

@@ -0,0 +1,70 @@
1
+# Add project specific ProGuard rules here.
2
+# By default, the flags in this file are appended to flags specified
3
+# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+# You can edit the include path and order by changing the proguardFiles
5
+# directive in build.gradle.
6
+#
7
+# For more details, see
8
+#   http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+# Add any project specific keep options here:
11
+
12
+# If your project uses WebView with JS, uncomment the following
13
+# and specify the fully qualified class name to the JavaScript interface
14
+# class:
15
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+#   public *;
17
+#}
18
+
19
+# Disabling obfuscation is useful if you collect stack traces from production crashes
20
+# (unless you are using a system that supports de-obfuscate the stack traces).
21
+-dontobfuscate
22
+
23
+# React Native
24
+
25
+# Keep our interfaces so they can be used by other ProGuard rules.
26
+# See http://sourceforge.net/p/proguard/bugs/466/
27
+-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28
+-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29
+-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
30
+
31
+# Do not strip any method/class that is annotated with @DoNotStrip
32
+-keep @com.facebook.proguard.annotations.DoNotStrip class *
33
+-keep @com.facebook.common.internal.DoNotStrip class *
34
+-keepclassmembers class * {
35
+    @com.facebook.proguard.annotations.DoNotStrip *;
36
+    @com.facebook.common.internal.DoNotStrip *;
37
+}
38
+
39
+-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
40
+  void set*(***);
41
+  *** get*();
42
+}
43
+
44
+-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
45
+-keep class * extends com.facebook.react.bridge.NativeModule { *; }
46
+-keepclassmembers,includedescriptorclasses class * { native <methods>; }
47
+-keepclassmembers class *  { @com.facebook.react.uimanager.UIProp <fields>; }
48
+-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
49
+-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
50
+
51
+-dontwarn com.facebook.react.**
52
+
53
+# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
54
+# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
55
+-dontwarn android.text.StaticLayout
56
+
57
+# okhttp
58
+
59
+-keepattributes Signature
60
+-keepattributes *Annotation*
61
+-keep class okhttp3.** { *; }
62
+-keep interface okhttp3.** { *; }
63
+-dontwarn okhttp3.**
64
+
65
+# okio
66
+
67
+-keep class sun.misc.Unsafe { *; }
68
+-dontwarn java.nio.file.*
69
+-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
70
+-dontwarn okio.**

+ 32
- 0
example/android/app/src/main/AndroidManifest.xml 查看文件

@@ -0,0 +1,32 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+    package="com.example"
3
+    android:versionCode="1"
4
+    android:versionName="1.0">
5
+
6
+    <uses-permission android:name="android.permission.INTERNET" />
7
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
8
+
9
+    <uses-sdk
10
+        android:minSdkVersion="16"
11
+        android:targetSdkVersion="22" />
12
+
13
+    <application
14
+      android:name=".MainApplication"
15
+      android:allowBackup="true"
16
+      android:label="@string/app_name"
17
+      android:icon="@mipmap/ic_launcher"
18
+      android:theme="@style/AppTheme">
19
+      <activity
20
+        android:name=".MainActivity"
21
+        android:label="@string/app_name"
22
+        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
23
+        android:windowSoftInputMode="adjustResize">
24
+        <intent-filter>
25
+            <action android:name="android.intent.action.MAIN" />
26
+            <category android:name="android.intent.category.LAUNCHER" />
27
+        </intent-filter>
28
+      </activity>
29
+      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
30
+    </application>
31
+
32
+</manifest>

+ 15
- 0
example/android/app/src/main/java/com/example/MainActivity.java 查看文件

@@ -0,0 +1,15 @@
1
+package com.example;
2
+
3
+import com.facebook.react.ReactActivity;
4
+
5
+public class MainActivity extends ReactActivity {
6
+
7
+    /**
8
+     * Returns the name of the main component registered from JavaScript.
9
+     * This is used to schedule rendering of the component.
10
+     */
11
+    @Override
12
+    protected String getMainComponentName() {
13
+        return "example";
14
+    }
15
+}

+ 47
- 0
example/android/app/src/main/java/com/example/MainApplication.java 查看文件

@@ -0,0 +1,47 @@
1
+package com.example;
2
+
3
+import android.app.Application;
4
+
5
+import com.facebook.react.ReactApplication;
6
+import com.facebook.react.ReactNativeHost;
7
+import com.facebook.react.ReactPackage;
8
+import com.facebook.react.shell.MainReactPackage;
9
+import com.facebook.soloader.SoLoader;
10
+import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage;
11
+
12
+import java.util.Arrays;
13
+import java.util.List;
14
+
15
+public class MainApplication extends Application implements ReactApplication {
16
+
17
+  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18
+    @Override
19
+    public boolean getUseDeveloperSupport() {
20
+      return BuildConfig.DEBUG;
21
+    }
22
+
23
+    @Override
24
+    protected List<ReactPackage> getPackages() {
25
+      return Arrays.<ReactPackage>asList(
26
+          new MainReactPackage(),
27
+          new WebViewBridgePackage()
28
+      );
29
+    }
30
+
31
+    @Override
32
+    protected String getJSMainModuleName() {
33
+      return "index";
34
+    }
35
+  };
36
+
37
+  @Override
38
+  public ReactNativeHost getReactNativeHost() {
39
+    return mReactNativeHost;
40
+  }
41
+
42
+  @Override
43
+  public void onCreate() {
44
+    super.onCreate();
45
+    SoLoader.init(this, /* native exopackage */ false);
46
+  }
47
+}

二進制
example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png 查看文件


二進制
example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png 查看文件


二進制
example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png 查看文件


二進制
example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png 查看文件


+ 3
- 0
example/android/app/src/main/res/values/strings.xml 查看文件

@@ -0,0 +1,3 @@
1
+<resources>
2
+    <string name="app_name">example</string>
3
+</resources>

+ 8
- 0
example/android/app/src/main/res/values/styles.xml 查看文件

@@ -0,0 +1,8 @@
1
+<resources>
2
+
3
+    <!-- Base application theme. -->
4
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5
+        <!-- Customize your theme here. -->
6
+    </style>
7
+
8
+</resources>

+ 24
- 0
example/android/build.gradle 查看文件

@@ -0,0 +1,24 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    repositories {
5
+        jcenter()
6
+    }
7
+    dependencies {
8
+        classpath 'com.android.tools.build:gradle:2.2.3'
9
+
10
+        // NOTE: Do not place your application dependencies here; they belong
11
+        // in the individual module build.gradle files
12
+    }
13
+}
14
+
15
+allprojects {
16
+    repositories {
17
+        mavenLocal()
18
+        jcenter()
19
+        maven {
20
+            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21
+            url "$rootDir/../node_modules/react-native/android"
22
+        }
23
+    }
24
+}

+ 20
- 0
example/android/gradle.properties 查看文件

@@ -0,0 +1,20 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+# When configured, Gradle will run in incubating parallel mode.
16
+# This option should only be used with decoupled projects. More details, visit
17
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+# org.gradle.parallel=true
19
+
20
+android.useDeprecatedNdk=true

二進制
example/android/gradle/wrapper/gradle-wrapper.jar 查看文件


+ 5
- 0
example/android/gradle/wrapper/gradle-wrapper.properties 查看文件

@@ -0,0 +1,5 @@
1
+distributionBase=GRADLE_USER_HOME
2
+distributionPath=wrapper/dists
3
+zipStoreBase=GRADLE_USER_HOME
4
+zipStorePath=wrapper/dists
5
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

+ 164
- 0
example/android/gradlew 查看文件

@@ -0,0 +1,164 @@
1
+#!/usr/bin/env bash
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
+DEFAULT_JVM_OPTS=""
11
+
12
+APP_NAME="Gradle"
13
+APP_BASE_NAME=`basename "$0"`
14
+
15
+# Use the maximum available, or set MAX_FD != -1 to use that value.
16
+MAX_FD="maximum"
17
+
18
+warn ( ) {
19
+    echo "$*"
20
+}
21
+
22
+die ( ) {
23
+    echo
24
+    echo "$*"
25
+    echo
26
+    exit 1
27
+}
28
+
29
+# OS specific support (must be 'true' or 'false').
30
+cygwin=false
31
+msys=false
32
+darwin=false
33
+case "`uname`" in
34
+  CYGWIN* )
35
+    cygwin=true
36
+    ;;
37
+  Darwin* )
38
+    darwin=true
39
+    ;;
40
+  MINGW* )
41
+    msys=true
42
+    ;;
43
+esac
44
+
45
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
46
+if $cygwin ; then
47
+    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48
+fi
49
+
50
+# Attempt to set APP_HOME
51
+# Resolve links: $0 may be a link
52
+PRG="$0"
53
+# Need this for relative symlinks.
54
+while [ -h "$PRG" ] ; do
55
+    ls=`ls -ld "$PRG"`
56
+    link=`expr "$ls" : '.*-> \(.*\)$'`
57
+    if expr "$link" : '/.*' > /dev/null; then
58
+        PRG="$link"
59
+    else
60
+        PRG=`dirname "$PRG"`"/$link"
61
+    fi
62
+done
63
+SAVED="`pwd`"
64
+cd "`dirname \"$PRG\"`/" >&-
65
+APP_HOME="`pwd -P`"
66
+cd "$SAVED" >&-
67
+
68
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69
+
70
+# Determine the Java command to use to start the JVM.
71
+if [ -n "$JAVA_HOME" ] ; then
72
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73
+        # IBM's JDK on AIX uses strange locations for the executables
74
+        JAVACMD="$JAVA_HOME/jre/sh/java"
75
+    else
76
+        JAVACMD="$JAVA_HOME/bin/java"
77
+    fi
78
+    if [ ! -x "$JAVACMD" ] ; then
79
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80
+
81
+Please set the JAVA_HOME variable in your environment to match the
82
+location of your Java installation."
83
+    fi
84
+else
85
+    JAVACMD="java"
86
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87
+
88
+Please set the JAVA_HOME variable in your environment to match the
89
+location of your Java installation."
90
+fi
91
+
92
+# Increase the maximum file descriptors if we can.
93
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94
+    MAX_FD_LIMIT=`ulimit -H -n`
95
+    if [ $? -eq 0 ] ; then
96
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97
+            MAX_FD="$MAX_FD_LIMIT"
98
+        fi
99
+        ulimit -n $MAX_FD
100
+        if [ $? -ne 0 ] ; then
101
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
102
+        fi
103
+    else
104
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105
+    fi
106
+fi
107
+
108
+# For Darwin, add options to specify how the application appears in the dock
109
+if $darwin; then
110
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111
+fi
112
+
113
+# For Cygwin, switch paths to Windows format before running java
114
+if $cygwin ; then
115
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117
+
118
+    # We build the pattern for arguments to be converted via cygpath
119
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
+    SEP=""
121
+    for dir in $ROOTDIRSRAW ; do
122
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
123
+        SEP="|"
124
+    done
125
+    OURCYGPATTERN="(^($ROOTDIRS))"
126
+    # Add a user-defined pattern to the cygpath arguments
127
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
+    fi
130
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
+    i=0
132
+    for arg in "$@" ; do
133
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
135
+
136
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
137
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
+        else
139
+            eval `echo args$i`="\"$arg\""
140
+        fi
141
+        i=$((i+1))
142
+    done
143
+    case $i in
144
+        (0) set -- ;;
145
+        (1) set -- "$args0" ;;
146
+        (2) set -- "$args0" "$args1" ;;
147
+        (3) set -- "$args0" "$args1" "$args2" ;;
148
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
+    esac
155
+fi
156
+
157
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158
+function splitJvmOpts() {
159
+    JVM_OPTS=("$@")
160
+}
161
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163
+
164
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90
- 0
example/android/gradlew.bat 查看文件

@@ -0,0 +1,90 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
+set DEFAULT_JVM_OPTS=
13
+
14
+set DIRNAME=%~dp0
15
+if "%DIRNAME%" == "" set DIRNAME=.
16
+set APP_BASE_NAME=%~n0
17
+set APP_HOME=%DIRNAME%
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windowz variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+if "%@eval[2+2]" == "4" goto 4NT_args
53
+
54
+:win9xME_args
55
+@rem Slurp the command line arguments.
56
+set CMD_LINE_ARGS=
57
+set _SKIP=2
58
+
59
+:win9xME_args_slurp
60
+if "x%~1" == "x" goto execute
61
+
62
+set CMD_LINE_ARGS=%*
63
+goto execute
64
+
65
+:4NT_args
66
+@rem Get arguments from the 4NT Shell from JP Software
67
+set CMD_LINE_ARGS=%$
68
+
69
+:execute
70
+@rem Setup the command line
71
+
72
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
+
74
+@rem Execute Gradle
75
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
+
77
+:end
78
+@rem End local scope for the variables with windows NT shell
79
+if "%ERRORLEVEL%"=="0" goto mainEnd
80
+
81
+:fail
82
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+rem the _cmd.exe /c_ return code!
84
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
+exit /b 1
86
+
87
+:mainEnd
88
+if "%OS%"=="Windows_NT" endlocal
89
+
90
+:omega

+ 8
- 0
example/android/keystores/BUCK 查看文件

@@ -0,0 +1,8 @@
1
+keystore(
2
+    name = "debug",
3
+    properties = "debug.keystore.properties",
4
+    store = "debug.keystore",
5
+    visibility = [
6
+        "PUBLIC",
7
+    ],
8
+)

+ 4
- 0
example/android/keystores/debug.keystore.properties 查看文件

@@ -0,0 +1,4 @@
1
+key.store=debug.keystore
2
+key.alias=androiddebugkey
3
+key.store.password=android
4
+key.alias.password=android

+ 6
- 0
example/android/settings.gradle 查看文件

@@ -0,0 +1,6 @@
1
+rootProject.name = 'example'
2
+
3
+include ':app'
4
+
5
+include ':react-native-webview-bridge'
6
+project(':react-native-webview-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview-bridge-updated/android')

+ 71
- 0
example/app.js 查看文件

@@ -0,0 +1,71 @@
1
+import React, { Component } from 'react';
2
+import {
3
+    StyleSheet,
4
+    Text,
5
+    View,
6
+    Platform
7
+} from 'react-native';
8
+import {RichTextEditor, RichTextToolbar} from 'react-native-zss-rich-text-editor';
9
+import KeyboardSpacer from 'react-native-keyboard-spacer';
10
+
11
+export default class RichTextExample extends Component {
12
+
13
+  constructor(props) {
14
+    super(props);
15
+    this.getHTML = this.getHTML.bind(this);
16
+    this.setFocusHandlers = this.setFocusHandlers.bind(this);
17
+  }
18
+
19
+  render() {
20
+    return (
21
+        <View style={styles.container}>
22
+          <RichTextEditor
23
+              ref={(r)=>this.richtext = r}
24
+              style={styles.richText}
25
+              initialTitleHTML={'Title!!'}
26
+              initialContentHTML={'Hello <b>World</b> <p>this is a new paragraph</p> <p>this is another new paragraph</p>'}
27
+              editorInitializedCallback={() => this.onEditorInitialized()}
28
+          />
29
+          <RichTextToolbar
30
+            getEditor={() => this.richtext}
31
+          />
32
+          {Platform.OS === 'ios' && <KeyboardSpacer/>}
33
+        </View>
34
+    );
35
+  }
36
+
37
+  onEditorInitialized() {
38
+    this.setFocusHandlers();
39
+    this.getHTML();
40
+  }
41
+
42
+  async getHTML() {
43
+    const titleHtml = await this.richtext.getTitleHtml();
44
+    const contentHtml = await this.richtext.getContentHtml();
45
+    //alert(titleHtml + ' ' + contentHtml)
46
+  }
47
+
48
+  setFocusHandlers() {
49
+    this.richtext.setTitleFocusHandler(() => {
50
+      //alert('title focus');
51
+    });
52
+    this.richtext.setContentFocusHandler(() => {
53
+      //alert('content focus');
54
+    });
55
+  }
56
+}
57
+
58
+const styles = StyleSheet.create({
59
+  container: {
60
+    flex: 1,
61
+    flexDirection: 'column',
62
+    backgroundColor: '#ffffff',
63
+    paddingTop: 40
64
+  },
65
+  richText: {
66
+    alignItems:'center',
67
+    justifyContent: 'center',
68
+    backgroundColor: 'transparent',
69
+  },
70
+});
71
+

+ 4
- 0
example/app.json 查看文件

@@ -0,0 +1,4 @@
1
+{
2
+  "name": "example",
3
+  "displayName": "example"
4
+}

+ 4
- 0
example/index.js 查看文件

@@ -0,0 +1,4 @@
1
+import { AppRegistry } from 'react-native';
2
+import App from './App';
3
+
4
+AppRegistry.registerComponent('example', () => App);

+ 54
- 0
example/ios/example-tvOS/Info.plist 查看文件

@@ -0,0 +1,54 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>APPL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+	<key>LSRequiresIPhoneOS</key>
24
+	<true/>
25
+	<key>UILaunchStoryboardName</key>
26
+	<string>LaunchScreen</string>
27
+	<key>UIRequiredDeviceCapabilities</key>
28
+	<array>
29
+		<string>armv7</string>
30
+	</array>
31
+	<key>UISupportedInterfaceOrientations</key>
32
+	<array>
33
+		<string>UIInterfaceOrientationPortrait</string>
34
+		<string>UIInterfaceOrientationLandscapeLeft</string>
35
+		<string>UIInterfaceOrientationLandscapeRight</string>
36
+	</array>
37
+	<key>UIViewControllerBasedStatusBarAppearance</key>
38
+	<false/>
39
+	<key>NSLocationWhenInUseUsageDescription</key>
40
+	<string></string>
41
+	<key>NSAppTransportSecurity</key>
42
+	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
43
+	<dict>
44
+		<key>NSExceptionDomains</key>
45
+		<dict>
46
+			<key>localhost</key>
47
+			<dict>
48
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
49
+				<true/>
50
+			</dict>
51
+		</dict>
52
+	</dict>
53
+</dict>
54
+</plist>

+ 24
- 0
example/ios/example-tvOSTests/Info.plist 查看文件

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

+ 1456
- 0
example/ios/example.xcodeproj/project.pbxproj
文件差異過大導致無法顯示
查看文件


+ 129
- 0
example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme 查看文件

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0820"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React-tvOS"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
32
+               BuildableName = "example-tvOS.app"
33
+               BlueprintName = "example-tvOS"
34
+               ReferencedContainer = "container:example.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46
+               BuildableName = "example-tvOSTests.xctest"
47
+               BlueprintName = "example-tvOSTests"
48
+               ReferencedContainer = "container:example.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
64
+               BuildableName = "example-tvOSTests.xctest"
65
+               BlueprintName = "example-tvOSTests"
66
+               ReferencedContainer = "container:example.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74
+            BuildableName = "example-tvOS.app"
75
+            BlueprintName = "example-tvOS"
76
+            ReferencedContainer = "container:example.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
97
+            BuildableName = "example-tvOS.app"
98
+            BlueprintName = "example-tvOS"
99
+            ReferencedContainer = "container:example.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
116
+            BuildableName = "example-tvOS.app"
117
+            BlueprintName = "example-tvOS"
118
+            ReferencedContainer = "container:example.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 129
- 0
example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme 查看文件

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0620"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "NO"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
18
+               BuildableName = "libReact.a"
19
+               BlueprintName = "React"
20
+               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "YES"
27
+            buildForArchiving = "YES"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32
+               BuildableName = "example.app"
33
+               BlueprintName = "example"
34
+               ReferencedContainer = "container:example.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+         <BuildActionEntry
38
+            buildForTesting = "YES"
39
+            buildForRunning = "YES"
40
+            buildForProfiling = "NO"
41
+            buildForArchiving = "NO"
42
+            buildForAnalyzing = "YES">
43
+            <BuildableReference
44
+               BuildableIdentifier = "primary"
45
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46
+               BuildableName = "exampleTests.xctest"
47
+               BlueprintName = "exampleTests"
48
+               ReferencedContainer = "container:example.xcodeproj">
49
+            </BuildableReference>
50
+         </BuildActionEntry>
51
+      </BuildActionEntries>
52
+   </BuildAction>
53
+   <TestAction
54
+      buildConfiguration = "Debug"
55
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
+      shouldUseLaunchSchemeArgsEnv = "YES">
58
+      <Testables>
59
+         <TestableReference
60
+            skipped = "NO">
61
+            <BuildableReference
62
+               BuildableIdentifier = "primary"
63
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64
+               BuildableName = "exampleTests.xctest"
65
+               BlueprintName = "exampleTests"
66
+               ReferencedContainer = "container:example.xcodeproj">
67
+            </BuildableReference>
68
+         </TestableReference>
69
+      </Testables>
70
+      <MacroExpansion>
71
+         <BuildableReference
72
+            BuildableIdentifier = "primary"
73
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74
+            BuildableName = "example.app"
75
+            BlueprintName = "example"
76
+            ReferencedContainer = "container:example.xcodeproj">
77
+         </BuildableReference>
78
+      </MacroExpansion>
79
+      <AdditionalOptions>
80
+      </AdditionalOptions>
81
+   </TestAction>
82
+   <LaunchAction
83
+      buildConfiguration = "Debug"
84
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
+      launchStyle = "0"
87
+      useCustomWorkingDirectory = "NO"
88
+      ignoresPersistentStateOnLaunch = "NO"
89
+      debugDocumentVersioning = "YES"
90
+      debugServiceExtension = "internal"
91
+      allowLocationSimulation = "YES">
92
+      <BuildableProductRunnable
93
+         runnableDebuggingMode = "0">
94
+         <BuildableReference
95
+            BuildableIdentifier = "primary"
96
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97
+            BuildableName = "example.app"
98
+            BlueprintName = "example"
99
+            ReferencedContainer = "container:example.xcodeproj">
100
+         </BuildableReference>
101
+      </BuildableProductRunnable>
102
+      <AdditionalOptions>
103
+      </AdditionalOptions>
104
+   </LaunchAction>
105
+   <ProfileAction
106
+      buildConfiguration = "Release"
107
+      shouldUseLaunchSchemeArgsEnv = "YES"
108
+      savedToolIdentifier = ""
109
+      useCustomWorkingDirectory = "NO"
110
+      debugDocumentVersioning = "YES">
111
+      <BuildableProductRunnable
112
+         runnableDebuggingMode = "0">
113
+         <BuildableReference
114
+            BuildableIdentifier = "primary"
115
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116
+            BuildableName = "example.app"
117
+            BlueprintName = "example"
118
+            ReferencedContainer = "container:example.xcodeproj">
119
+         </BuildableReference>
120
+      </BuildableProductRunnable>
121
+   </ProfileAction>
122
+   <AnalyzeAction
123
+      buildConfiguration = "Debug">
124
+   </AnalyzeAction>
125
+   <ArchiveAction
126
+      buildConfiguration = "Release"
127
+      revealArchiveInOrganizer = "YES">
128
+   </ArchiveAction>
129
+</Scheme>

+ 16
- 0
example/ios/example/AppDelegate.h 查看文件

@@ -0,0 +1,16 @@
1
+/**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+#import <UIKit/UIKit.h>
11
+
12
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
13
+
14
+@property (nonatomic, strong) UIWindow *window;
15
+
16
+@end

+ 37
- 0
example/ios/example/AppDelegate.m 查看文件

@@ -0,0 +1,37 @@
1
+/**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+#import "AppDelegate.h"
11
+
12
+#import <React/RCTBundleURLProvider.h>
13
+#import <React/RCTRootView.h>
14
+
15
+@implementation AppDelegate
16
+
17
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18
+{
19
+  NSURL *jsCodeLocation;
20
+
21
+  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
22
+
23
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
24
+                                                      moduleName:@"example"
25
+                                               initialProperties:nil
26
+                                                   launchOptions:launchOptions];
27
+  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
28
+
29
+  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
30
+  UIViewController *rootViewController = [UIViewController new];
31
+  rootViewController.view = rootView;
32
+  self.window.rootViewController = rootViewController;
33
+  [self.window makeKeyAndVisible];
34
+  return YES;
35
+}
36
+
37
+@end

+ 42
- 0
example/ios/example/Base.lproj/LaunchScreen.xib 查看文件

@@ -0,0 +1,42 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
+    <dependencies>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6
+        <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
7
+    </dependencies>
8
+    <objects>
9
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
10
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
11
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
12
+            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
13
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14
+            <subviews>
15
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
16
+                    <rect key="frame" x="20" y="439" width="441" height="21"/>
17
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
18
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
19
+                    <nil key="highlightedColor"/>
20
+                </label>
21
+                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="example" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
22
+                    <rect key="frame" x="20" y="140" width="441" height="43"/>
23
+                    <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24
+                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25
+                    <nil key="highlightedColor"/>
26
+                </label>
27
+            </subviews>
28
+            <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
29
+            <constraints>
30
+                <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
31
+                <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
32
+                <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
33
+                <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
34
+                <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
35
+                <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
36
+            </constraints>
37
+            <nil key="simulatedStatusBarMetrics"/>
38
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
39
+            <point key="canvasLocation" x="548" y="455"/>
40
+        </view>
41
+    </objects>
42
+</document>

+ 38
- 0
example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json 查看文件

@@ -0,0 +1,38 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "iphone",
5
+      "size" : "29x29",
6
+      "scale" : "2x"
7
+    },
8
+    {
9
+      "idiom" : "iphone",
10
+      "size" : "29x29",
11
+      "scale" : "3x"
12
+    },
13
+    {
14
+      "idiom" : "iphone",
15
+      "size" : "40x40",
16
+      "scale" : "2x"
17
+    },
18
+    {
19
+      "idiom" : "iphone",
20
+      "size" : "40x40",
21
+      "scale" : "3x"
22
+    },
23
+    {
24
+      "idiom" : "iphone",
25
+      "size" : "60x60",
26
+      "scale" : "2x"
27
+    },
28
+    {
29
+      "idiom" : "iphone",
30
+      "size" : "60x60",
31
+      "scale" : "3x"
32
+    }
33
+  ],
34
+  "info" : {
35
+    "version" : 1,
36
+    "author" : "xcode"
37
+  }
38
+}

+ 6
- 0
example/ios/example/Images.xcassets/Contents.json 查看文件

@@ -0,0 +1,6 @@
1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  }
6
+}

+ 56
- 0
example/ios/example/Info.plist 查看文件

@@ -0,0 +1,56 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleDisplayName</key>
8
+	<string>example</string>
9
+	<key>CFBundleExecutable</key>
10
+	<string>$(EXECUTABLE_NAME)</string>
11
+	<key>CFBundleIdentifier</key>
12
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
13
+	<key>CFBundleInfoDictionaryVersion</key>
14
+	<string>6.0</string>
15
+	<key>CFBundleName</key>
16
+	<string>$(PRODUCT_NAME)</string>
17
+	<key>CFBundlePackageType</key>
18
+	<string>APPL</string>
19
+	<key>CFBundleShortVersionString</key>
20
+	<string>1.0</string>
21
+	<key>CFBundleSignature</key>
22
+	<string>????</string>
23
+	<key>CFBundleVersion</key>
24
+	<string>1</string>
25
+	<key>LSRequiresIPhoneOS</key>
26
+	<true/>
27
+	<key>UILaunchStoryboardName</key>
28
+	<string>LaunchScreen</string>
29
+	<key>UIRequiredDeviceCapabilities</key>
30
+	<array>
31
+		<string>armv7</string>
32
+	</array>
33
+	<key>UISupportedInterfaceOrientations</key>
34
+	<array>
35
+		<string>UIInterfaceOrientationPortrait</string>
36
+		<string>UIInterfaceOrientationLandscapeLeft</string>
37
+		<string>UIInterfaceOrientationLandscapeRight</string>
38
+	</array>
39
+	<key>UIViewControllerBasedStatusBarAppearance</key>
40
+	<false/>
41
+	<key>NSLocationWhenInUseUsageDescription</key>
42
+	<string></string>
43
+	<key>NSAppTransportSecurity</key>
44
+	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
45
+	<dict>
46
+		<key>NSExceptionDomains</key>
47
+		<dict>
48
+			<key>localhost</key>
49
+			<dict>
50
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
51
+				<true/>
52
+			</dict>
53
+		</dict>
54
+	</dict>
55
+</dict>
56
+</plist>

+ 18
- 0
example/ios/example/main.m 查看文件

@@ -0,0 +1,18 @@
1
+/**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+#import <UIKit/UIKit.h>
11
+
12
+#import "AppDelegate.h"
13
+
14
+int main(int argc, char * argv[]) {
15
+  @autoreleasepool {
16
+    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17
+  }
18
+}

+ 24
- 0
example/ios/exampleTests/Info.plist 查看文件

@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>BNDL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.0</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>1</string>
23
+</dict>
24
+</plist>

+ 70
- 0
example/ios/exampleTests/exampleTests.m 查看文件

@@ -0,0 +1,70 @@
1
+/**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+#import <UIKit/UIKit.h>
11
+#import <XCTest/XCTest.h>
12
+
13
+#import <React/RCTLog.h>
14
+#import <React/RCTRootView.h>
15
+
16
+#define TIMEOUT_SECONDS 600
17
+#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18
+
19
+@interface exampleTests : XCTestCase
20
+
21
+@end
22
+
23
+@implementation exampleTests
24
+
25
+- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26
+{
27
+  if (test(view)) {
28
+    return YES;
29
+  }
30
+  for (UIView *subview in [view subviews]) {
31
+    if ([self findSubviewInView:subview matching:test]) {
32
+      return YES;
33
+    }
34
+  }
35
+  return NO;
36
+}
37
+
38
+- (void)testRendersWelcomeScreen
39
+{
40
+  UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
41
+  NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42
+  BOOL foundElement = NO;
43
+
44
+  __block NSString *redboxError = nil;
45
+  RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46
+    if (level >= RCTLogLevelError) {
47
+      redboxError = message;
48
+    }
49
+  });
50
+
51
+  while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52
+    [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53
+    [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54
+
55
+    foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56
+      if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57
+        return YES;
58
+      }
59
+      return NO;
60
+    }];
61
+  }
62
+
63
+  RCTSetLogFunction(RCTDefaultLogFunction);
64
+
65
+  XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66
+  XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67
+}
68
+
69
+
70
+@end

+ 24
- 0
example/package.json 查看文件

@@ -0,0 +1,24 @@
1
+{
2
+  "name": "example",
3
+  "version": "0.0.1",
4
+  "private": true,
5
+  "scripts": {
6
+    "start": "node node_modules/react-native/local-cli/cli.js start",
7
+    "test": "jest"
8
+  },
9
+  "dependencies": {
10
+    "react": "16.0.0",
11
+    "react-native": "0.51.0",
12
+    "react-native-zss-rich-text-editor": "file:../",
13
+    "react-native-keyboard-spacer": "*"
14
+  },
15
+  "devDependencies": {
16
+    "babel-jest": "22.0.4",
17
+    "babel-preset-react-native": "4.0.0",
18
+    "jest": "22.0.5",
19
+    "react-test-renderer": "16.0.0"
20
+  },
21
+  "jest": {
22
+    "preset": "react-native"
23
+  }
24
+}

+ 12
- 0
htmlCopy.gradle 查看文件

@@ -0,0 +1,12 @@
1
+ext {
2
+ copyEditorHtmlToAppAssets = { dir ->
3
+    def fromF = new File(dir, '/src/editor.html');
4
+    def toF = new File(projectDir, '/src/main/assets/');
5
+    println ('Copying ZSSRichTextEditor html asset file from ' + fromF.toString() + ' to ' + toF.toString());
6
+
7
+    copy  {
8
+      from fromF
9
+      into toF
10
+    }
11
+  }
12
+}

二進制
img/icon_format_bold@1.5x.png 查看文件


二進制
img/icon_format_bold@1x.png 查看文件


二進制
img/icon_format_bold@2x.png 查看文件


二進制
img/icon_format_bold@3x.png 查看文件


二進制
img/icon_format_bold@4x.png 查看文件


二進制
img/icon_format_italic@1.5x.png 查看文件


二進制
img/icon_format_italic@1x.png 查看文件


二進制
img/icon_format_italic@2x.png 查看文件


二進制
img/icon_format_italic@3x.png 查看文件


二進制
img/icon_format_italic@4x.png 查看文件


二進制
img/icon_format_link@1.5x.png 查看文件


二進制
img/icon_format_link@1x.png 查看文件


二進制
img/icon_format_link@2x.png 查看文件


二進制
img/icon_format_link@3x.png 查看文件


二進制
img/icon_format_link@4x.png 查看文件


二進制
img/icon_format_media@1.5x.png 查看文件


二進制
img/icon_format_media@1x.png 查看文件


二進制
img/icon_format_media@2x.png 查看文件


二進制
img/icon_format_media@3x.png 查看文件


二進制
img/icon_format_media@4x.png 查看文件


二進制
img/icon_format_ol@1.5x.png 查看文件


二進制
img/icon_format_ol@1x.png 查看文件


二進制
img/icon_format_ol@2x.png 查看文件


二進制
img/icon_format_ol@3x.png 查看文件


二進制
img/icon_format_ol@4x.png 查看文件


二進制
img/icon_format_ul@1.5x.png 查看文件


二進制
img/icon_format_ul@1x.png 查看文件


二進制
img/icon_format_ul@2x.png 查看文件


二進制
img/icon_format_ul@3x.png 查看文件


二進制
img/icon_format_ul@4x.png 查看文件


+ 7
- 0
index.js 查看文件

@@ -0,0 +1,7 @@
1
+import RichTextEditor from './src/RichTextEditor';
2
+import RichTextToolbar from './src/RichTextToolbar';
3
+import {actions} from './src/const';
4
+
5
+module.exports = {
6
+  RichTextEditor, RichTextToolbar, actions
7
+}

+ 6
- 0
newExample/.buckconfig 查看文件

@@ -0,0 +1,6 @@
1
+
2
+[android]
3
+  target = Google Inc.:Google APIs:23
4
+
5
+[maven_repositories]
6
+  central = https://repo1.maven.org/maven2

+ 4
- 0
newExample/.eslintrc.js 查看文件

@@ -0,0 +1,4 @@
1
+module.exports = {
2
+  root: true,
3
+  extends: '@react-native-community',
4
+};

+ 75
- 0
newExample/.flowconfig 查看文件

@@ -0,0 +1,75 @@
1
+[ignore]
2
+; We fork some components by platform
3
+.*/*[.]android.js
4
+
5
+; Ignore "BUCK" generated dirs
6
+<PROJECT_ROOT>/\.buckd/
7
+
8
+; Ignore polyfills
9
+node_modules/react-native/Libraries/polyfills/.*
10
+
11
+; These should not be required directly
12
+; require from fbjs/lib instead: require('fbjs/lib/warning')
13
+node_modules/warning/.*
14
+
15
+; Flow doesn't support platforms
16
+.*/Libraries/Utilities/LoadingView.js
17
+
18
+[untyped]
19
+.*/node_modules/@react-native-community/cli/.*/.*
20
+
21
+[include]
22
+
23
+[libs]
24
+node_modules/react-native/Libraries/react-native/react-native-interface.js
25
+node_modules/react-native/flow/
26
+
27
+[options]
28
+emoji=true
29
+
30
+esproposal.optional_chaining=enable
31
+esproposal.nullish_coalescing=enable
32
+
33
+module.file_ext=.js
34
+module.file_ext=.json
35
+module.file_ext=.ios.js
36
+
37
+munge_underscores=true
38
+
39
+module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40
+module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41
+module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
42
+
43
+suppress_type=$FlowIssue
44
+suppress_type=$FlowFixMe
45
+suppress_type=$FlowFixMeProps
46
+suppress_type=$FlowFixMeState
47
+
48
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
49
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
50
+suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51
+
52
+[lints]
53
+sketchy-null-number=warn
54
+sketchy-null-mixed=warn
55
+sketchy-number=warn
56
+untyped-type-import=warn
57
+nonstrict-import=warn
58
+deprecated-type=warn
59
+unsafe-getters-setters=warn
60
+inexact-spread=warn
61
+unnecessary-invariant=warn
62
+signature-verification-failure=warn
63
+deprecated-utility=error
64
+
65
+[strict]
66
+deprecated-type
67
+nonstrict-import
68
+sketchy-null
69
+unclear-type
70
+unsafe-getters-setters
71
+untyped-import
72
+untyped-type-import
73
+
74
+[version]
75
+^0.105.0

+ 1
- 0
newExample/.gitattributes 查看文件

@@ -0,0 +1 @@
1
+*.pbxproj -text

+ 59
- 0
newExample/.gitignore 查看文件

@@ -0,0 +1,59 @@
1
+# OSX
2
+#
3
+.DS_Store
4
+
5
+# Xcode
6
+#
7
+build/
8
+*.pbxuser
9
+!default.pbxuser
10
+*.mode1v3
11
+!default.mode1v3
12
+*.mode2v3
13
+!default.mode2v3
14
+*.perspectivev3
15
+!default.perspectivev3
16
+xcuserdata
17
+*.xccheckout
18
+*.moved-aside
19
+DerivedData
20
+*.hmap
21
+*.ipa
22
+*.xcuserstate
23
+
24
+# Android/IntelliJ
25
+#
26
+build/
27
+.idea
28
+.gradle
29
+local.properties
30
+*.iml
31
+
32
+# node.js
33
+#
34
+node_modules/
35
+npm-debug.log
36
+yarn-error.log
37
+
38
+# BUCK
39
+buck-out/
40
+\.buckd/
41
+*.keystore
42
+!debug.keystore
43
+
44
+# fastlane
45
+#
46
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
+# screenshots whenever they are needed.
48
+# For more information about the recommended setup visit:
49
+# https://docs.fastlane.tools/best-practices/source-control/
50
+
51
+*/fastlane/report.xml
52
+*/fastlane/Preview.html
53
+*/fastlane/screenshots
54
+
55
+# Bundle artifact
56
+*.jsbundle
57
+
58
+# CocoaPods
59
+/ios/Pods/

+ 6
- 0
newExample/.prettierrc.js 查看文件

@@ -0,0 +1,6 @@
1
+module.exports = {
2
+  bracketSpacing: false,
3
+  jsxBracketSameLine: true,
4
+  singleQuote: true,
5
+  trailingComma: 'all',
6
+};

+ 1
- 0
newExample/.watchmanconfig 查看文件

@@ -0,0 +1 @@
1
+{}

+ 71
- 0
newExample/App.js 查看文件

@@ -0,0 +1,71 @@
1
+import React, { Component } from 'react';
2
+import {
3
+    StyleSheet,
4
+    Text,
5
+    View,
6
+    Platform
7
+} from 'react-native';
8
+import {RichTextEditor, RichTextToolbar} from 'react-native-zss-rich-text-editor';
9
+import KeyboardSpacer from 'react-native-keyboard-spacer';
10
+
11
+export default class RichTextExample extends Component {
12
+
13
+  constructor(props) {
14
+    super(props);
15
+    this.getHTML = this.getHTML.bind(this);
16
+    this.setFocusHandlers = this.setFocusHandlers.bind(this);
17
+  }
18
+
19
+  render() {
20
+    return (
21
+        <View style={styles.container}>
22
+          <RichTextEditor
23
+              ref={(r)=>this.richtext = r}
24
+              style={styles.richText}
25
+              initialTitleHTML={'Title!!'}
26
+              initialContentHTML={'Hello <b>World</b> <p>this is a new paragraph</p> <p>this is another new paragraph</p>'}
27
+              editorInitializedCallback={() => this.onEditorInitialized()}
28
+          />
29
+          <RichTextToolbar
30
+            getEditor={() => this.richtext}
31
+          />
32
+          {Platform.OS === 'ios' && <KeyboardSpacer/>}
33
+        </View>
34
+    );
35
+  }
36
+
37
+  onEditorInitialized() {
38
+    this.setFocusHandlers();
39
+    this.getHTML();
40
+  }
41
+
42
+  async getHTML() {
43
+    const titleHtml = await this.richtext.getTitleHtml();
44
+    const contentHtml = await this.richtext.getContentHtml();
45
+    //alert(titleHtml + ' ' + contentHtml)
46
+  }
47
+
48
+  setFocusHandlers() {
49
+    this.richtext.setTitleFocusHandler(() => {
50
+      //alert('title focus');
51
+    });
52
+    this.richtext.setContentFocusHandler(() => {
53
+      //alert('content focus');
54
+    });
55
+  }
56
+}
57
+
58
+const styles = StyleSheet.create({
59
+  container: {
60
+    flex: 1,
61
+    flexDirection: 'column',
62
+    backgroundColor: '#ffffff',
63
+    paddingTop: 40
64
+  },
65
+  richText: {
66
+    alignItems:'center',
67
+    justifyContent: 'center',
68
+    backgroundColor: 'transparent',
69
+  },
70
+});
71
+

+ 14
- 0
newExample/__tests__/App-test.js 查看文件

@@ -0,0 +1,14 @@
1
+/**
2
+ * @format
3
+ */
4
+
5
+import 'react-native';
6
+import React from 'react';
7
+import App from '../App';
8
+
9
+// Note: test renderer must be required after react-native.
10
+import renderer from 'react-test-renderer';
11
+
12
+it('renders correctly', () => {
13
+  renderer.create(<App />);
14
+});

+ 55
- 0
newExample/android/app/BUCK 查看文件

@@ -0,0 +1,55 @@
1
+# To learn about Buck see [Docs](https://buckbuild.com/).
2
+# To run your application with Buck:
3
+# - install Buck
4
+# - `npm start` - to start the packager
5
+# - `cd android`
6
+# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
+# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
+# - `buck install -r android/app` - compile, install and run application
9
+#
10
+
11
+load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12
+
13
+lib_deps = []
14
+
15
+create_aar_targets(glob(["libs/*.aar"]))
16
+
17
+create_jar_targets(glob(["libs/*.jar"]))
18
+
19
+android_library(
20
+    name = "all-libs",
21
+    exported_deps = lib_deps,
22
+)
23
+
24
+android_library(
25
+    name = "app-code",
26
+    srcs = glob([
27
+        "src/main/java/**/*.java",
28
+    ]),
29
+    deps = [
30
+        ":all-libs",
31
+        ":build_config",
32
+        ":res",
33
+    ],
34
+)
35
+
36
+android_build_config(
37
+    name = "build_config",
38
+    package = "com.newexample",
39
+)
40
+
41
+android_resource(
42
+    name = "res",
43
+    package = "com.newexample",
44
+    res = "src/main/res",
45
+)
46
+
47
+android_binary(
48
+    name = "app",
49
+    keystore = "//android/keystores:debug",
50
+    manifest = "src/main/AndroidManifest.xml",
51
+    package_type = "debug",
52
+    deps = [
53
+        ":app-code",
54
+    ],
55
+)

+ 201
- 0
newExample/android/app/build.gradle 查看文件

@@ -0,0 +1,201 @@
1
+apply plugin: "com.android.application"
2
+
3
+import com.android.build.OutputFile
4
+
5
+/**
6
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
+ * and bundleReleaseJsAndAssets).
8
+ * These basically call `react-native bundle` with the correct arguments during the Android build
9
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
+ * bundle directly from the development server. Below you can see all the possible configurations
11
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
+ *
14
+ * project.ext.react = [
15
+ *   // the name of the generated asset file containing your JS bundle
16
+ *   bundleAssetName: "index.android.bundle",
17
+ *
18
+ *   // the entry file for bundle generation
19
+ *   entryFile: "index.android.js",
20
+ *
21
+ *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22
+ *   bundleCommand: "ram-bundle",
23
+ *
24
+ *   // whether to bundle JS and assets in debug mode
25
+ *   bundleInDebug: false,
26
+ *
27
+ *   // whether to bundle JS and assets in release mode
28
+ *   bundleInRelease: true,
29
+ *
30
+ *   // whether to bundle JS and assets in another build variant (if configured).
31
+ *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
32
+ *   // The configuration property can be in the following formats
33
+ *   //         'bundleIn${productFlavor}${buildType}'
34
+ *   //         'bundleIn${buildType}'
35
+ *   // bundleInFreeDebug: true,
36
+ *   // bundleInPaidRelease: true,
37
+ *   // bundleInBeta: true,
38
+ *
39
+ *   // whether to disable dev mode in custom build variants (by default only disabled in release)
40
+ *   // for example: to disable dev mode in the staging build type (if configured)
41
+ *   devDisabledInStaging: true,
42
+ *   // The configuration property can be in the following formats
43
+ *   //         'devDisabledIn${productFlavor}${buildType}'
44
+ *   //         'devDisabledIn${buildType}'
45
+ *
46
+ *   // the root of your project, i.e. where "package.json" lives
47
+ *   root: "../../",
48
+ *
49
+ *   // where to put the JS bundle asset in debug mode
50
+ *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
51
+ *
52
+ *   // where to put the JS bundle asset in release mode
53
+ *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
54
+ *
55
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
56
+ *   // require('./image.png')), in debug mode
57
+ *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
58
+ *
59
+ *   // where to put drawable resources / React Native assets, e.g. the ones you use via
60
+ *   // require('./image.png')), in release mode
61
+ *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
62
+ *
63
+ *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
64
+ *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
65
+ *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
66
+ *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67
+ *   // for example, you might want to remove it from here.
68
+ *   inputExcludes: ["android/**", "ios/**"],
69
+ *
70
+ *   // override which node gets called and with what additional arguments
71
+ *   nodeExecutableAndArgs: ["node"],
72
+ *
73
+ *   // supply additional arguments to the packager
74
+ *   extraPackagerArgs: []
75
+ * ]
76
+ */
77
+
78
+project.ext.react = [
79
+    entryFile: "index.js",
80
+    enableHermes: false,  // clean and rebuild if changing
81
+]
82
+
83
+apply from: "../../node_modules/react-native/react.gradle"
84
+
85
+/**
86
+ * Set this to true to create two separate APKs instead of one:
87
+ *   - An APK that only works on ARM devices
88
+ *   - An APK that only works on x86 devices
89
+ * The advantage is the size of the APK is reduced by about 4MB.
90
+ * Upload all the APKs to the Play Store and people will download
91
+ * the correct one based on the CPU architecture of their device.
92
+ */
93
+def enableSeparateBuildPerCPUArchitecture = false
94
+
95
+/**
96
+ * Run Proguard to shrink the Java bytecode in release builds.
97
+ */
98
+def enableProguardInReleaseBuilds = false
99
+
100
+/**
101
+ * The preferred build flavor of JavaScriptCore.
102
+ *
103
+ * For example, to use the international variant, you can use:
104
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105
+ *
106
+ * The international variant includes ICU i18n library and necessary data
107
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108
+ * give correct results when using with locales other than en-US.  Note that
109
+ * this variant is about 6MiB larger per architecture than default.
110
+ */
111
+def jscFlavor = 'org.webkit:android-jsc:+'
112
+
113
+/**
114
+ * Whether to enable the Hermes VM.
115
+ *
116
+ * This should be set on project.ext.react and mirrored here.  If it is not set
117
+ * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118
+ * and the benefits of using Hermes will therefore be sharply reduced.
119
+ */
120
+def enableHermes = project.ext.react.get("enableHermes", false);
121
+
122
+android {
123
+    compileSdkVersion rootProject.ext.compileSdkVersion
124
+
125
+    compileOptions {
126
+        sourceCompatibility JavaVersion.VERSION_1_8
127
+        targetCompatibility JavaVersion.VERSION_1_8
128
+    }
129
+
130
+    defaultConfig {
131
+        applicationId "com.newexample"
132
+        minSdkVersion rootProject.ext.minSdkVersion
133
+        targetSdkVersion rootProject.ext.targetSdkVersion
134
+        versionCode 1
135
+        versionName "1.0"
136
+    }
137
+    splits {
138
+        abi {
139
+            reset()
140
+            enable enableSeparateBuildPerCPUArchitecture
141
+            universalApk false  // If true, also generate a universal APK
142
+            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143
+        }
144
+    }
145
+    signingConfigs {
146
+        debug {
147
+            storeFile file('debug.keystore')
148
+            storePassword 'android'
149
+            keyAlias 'androiddebugkey'
150
+            keyPassword 'android'
151
+        }
152
+    }
153
+    buildTypes {
154
+        debug {
155
+            signingConfig signingConfigs.debug
156
+        }
157
+        release {
158
+            // Caution! In production, you need to generate your own keystore file.
159
+            // see https://facebook.github.io/react-native/docs/signed-apk-android.
160
+            signingConfig signingConfigs.debug
161
+            minifyEnabled enableProguardInReleaseBuilds
162
+            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
163
+        }
164
+    }
165
+    // applicationVariants are e.g. debug, release
166
+    applicationVariants.all { variant ->
167
+        variant.outputs.each { output ->
168
+            // For each separate APK per architecture, set a unique version code as described here:
169
+            // https://developer.android.com/studio/build/configure-apk-splits.html
170
+            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
171
+            def abi = output.getFilter(OutputFile.ABI)
172
+            if (abi != null) {  // null for the universal-debug, universal-release variants
173
+                output.versionCodeOverride =
174
+                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
175
+            }
176
+
177
+        }
178
+    }
179
+}
180
+
181
+dependencies {
182
+    implementation fileTree(dir: "libs", include: ["*.jar"])
183
+    implementation "com.facebook.react:react-native:+"  // From node_modules
184
+
185
+    if (enableHermes) {
186
+        def hermesPath = "../../node_modules/hermes-engine/android/";
187
+        debugImplementation files(hermesPath + "hermes-debug.aar")
188
+        releaseImplementation files(hermesPath + "hermes-release.aar")
189
+    } else {
190
+        implementation jscFlavor
191
+    }
192
+}
193
+
194
+// Run this once to be able to run the application with BUCK
195
+// puts all compile dependencies into folder libs for BUCK to use
196
+task copyDownloadableDepsToLibs(type: Copy) {
197
+    from configurations.compile
198
+    into 'libs'
199
+}
200
+
201
+apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

+ 19
- 0
newExample/android/app/build_defs.bzl 查看文件

@@ -0,0 +1,19 @@
1
+"""Helper definitions to glob .aar and .jar targets"""
2
+
3
+def create_aar_targets(aarfiles):
4
+    for aarfile in aarfiles:
5
+        name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6
+        lib_deps.append(":" + name)
7
+        android_prebuilt_aar(
8
+            name = name,
9
+            aar = aarfile,
10
+        )
11
+
12
+def create_jar_targets(jarfiles):
13
+    for jarfile in jarfiles:
14
+        name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15
+        lib_deps.append(":" + name)
16
+        prebuilt_jar(
17
+            name = name,
18
+            binary_jar = jarfile,
19
+        )

+ 0
- 0
newExample/android/app/debug.keystore 查看文件


部分文件因文件數量過多而無法顯示

Loading…
取消
儲存