@xrnjs/app-template 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/$package.json +30 -36
  2. package/android/app/build.gradle +56 -73
  3. package/android/app/src/debug/java/com/xrn/template/ReactNativeFlipper.java +23 -44
  4. package/android/app/src/main/assets/xrn-manifest.json +1 -1
  5. package/android/app/src/main/java/com/xrn/template/MainApplication.kt +54 -65
  6. package/android/app/src/main/java/com/xrn/template/multibundle/CodePushBundleActivity.kt +65 -0
  7. package/android/app/src/main/java/com/xrn/template/multibundle/CodePushJSBundleLoader.kt +18 -0
  8. package/android/app/src/main/java/com/xrn/template/multibundle/CodePushUtils.kt +263 -0
  9. package/android/app/src/main/java/com/xrn/template/multibundle/XBundleTool.kt +9 -0
  10. package/android/app/src/main/java/com/xrn/template/multibundle/XRNReactHostDelegate.kt +56 -0
  11. package/android/app/src/main/java/com/xrn/template/navigation/XBundleActivity.kt +10 -7
  12. package/android/app/src/main/res/raw/bundle_config.json +2 -6
  13. package/android/build.gradle +40 -39
  14. package/android/buildSrc/build.gradle.kts +15 -0
  15. package/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  16. package/android/gradle.properties +17 -10
  17. package/android/settings.gradle +40 -12
  18. package/harmony/.clang-tidy +1 -1
  19. package/harmony/.clangd +3 -1
  20. package/harmony/AppScope/app.json5 +1 -1
  21. package/harmony/build-profile.json5 +8 -8
  22. package/harmony/entry/oh-package-lock.json5 +283 -262
  23. package/harmony/entry/oh-package.json5 +35 -36
  24. package/harmony/entry/src/main/cpp/CMakeLists.txt +37 -17
  25. package/harmony/entry/src/main/cpp/PackageProvider.cpp +20 -2
  26. package/harmony/entry/src/main/cpp/generated/BundleNavigation.cpp +3 -0
  27. package/harmony/entry/src/main/cpp/generated/RNOHGeneratedPackage.h +31 -87
  28. package/harmony/entry/src/main/cpp/generated/RTNCodePush.cpp +7 -1
  29. package/harmony/entry/src/main/cpp/generated/XRNBundleModule.cpp +9 -0
  30. package/harmony/entry/src/main/cpp/generated/XRNDebugToolsModule.cpp +10 -0
  31. package/harmony/entry/src/main/cpp/generated/{ImageResizer.cpp → XRNImageView.cpp} +6 -3
  32. package/harmony/entry/src/main/cpp/generated/{ImageResizer.h → XRNImageView.h} +2 -2
  33. package/harmony/entry/src/main/cpp/generated/{RNCWebViewComponentDescriptor.h → XRNImageViewComponentDescriptor.h} +11 -10
  34. package/harmony/entry/src/main/cpp/generated/XRNImageViewJSIBinder.h +58 -0
  35. package/harmony/entry/src/main/cpp/generated/XRNKeyboard.cpp +23 -0
  36. package/harmony/entry/src/main/cpp/generated/{RNLocalize.h → XRNKeyboard.h} +2 -2
  37. package/harmony/entry/src/main/cpp/generated/XRNNavigation.cpp +5 -0
  38. package/harmony/entry/src/main/cpp/generated/{RNCWebViewModule.cpp → XRNNetworkModule.cpp} +2 -4
  39. package/harmony/entry/src/main/cpp/generated/{RNCWebViewModule.h → XRNNetworkModule.h} +2 -2
  40. package/harmony/entry/src/main/ets/BundleHelper.ets +41 -45
  41. package/harmony/entry/src/main/ets/MainAbilityStage.ets +9 -4
  42. package/harmony/entry/src/main/ets/entryability/EntryAbility.ets +1 -1
  43. package/harmony/entry/src/main/ets/navDestination/BizModuleContainer.ets +2 -2
  44. package/harmony/entry/src/main/ets/navDestination/MainModuleContainer.ets +2 -2
  45. package/harmony/entry/src/main/ets/navDestination/Splash.ets +1 -2
  46. package/harmony/entry/src/main/ets/pages/Index.ets +4 -4
  47. package/harmony/entry/src/main/resources/rawfile/bundle_config.json5 +2 -6
  48. package/harmony/entry/src/main/resources/rawfile/xrn-manifest.json +1 -0
  49. package/harmony/oh-package-lock.json5 +2 -1
  50. package/harmony/oh-package.json5 +12 -4
  51. package/index.ts +0 -0
  52. package/ios/BundleEventCenter/Hooks/XRNCustomKeyborad+XTHooks.h +16 -0
  53. package/ios/BundleEventCenter/Hooks/XRNCustomKeyborad+XTHooks.mm +40 -0
  54. package/ios/BundleEventCenter/Hooks/XTIQKeyboardManagerBridge.h +15 -0
  55. package/ios/BundleEventCenter/Hooks/XTIQKeyboardManagerBridge.m +22 -0
  56. package/ios/BundleEventCenter/XTBundleProvider.m +98 -72
  57. package/ios/BundleEventCenter/XTBundleViewControllerFactory.m +4 -15
  58. package/ios/BundleEventCenter/bundleController/XTBundleViewController.mm +43 -0
  59. package/ios/BundleEventCenter/bundleController/XTMainBundleViewController.mm +48 -0
  60. package/ios/BundleEventCenter/bundleController/xtBundles.plist +1 -1
  61. package/ios/Podfile +234 -151
  62. package/ios/Podfile.lock +2810 -594
  63. package/ios/RNDebug/DebugPlugin/XTPluginManage.m +5 -5
  64. package/ios/RNDebug/MotroTools/XTMetroAutoConnector.h +21 -0
  65. package/ios/RNDebug/MotroTools/XTMetroAutoConnector.m +124 -0
  66. package/ios/RNDebug/MotroTools/XTReloadCommandHelper.h +30 -0
  67. package/ios/RNDebug/MotroTools/XTReloadCommandHelper.mm +128 -0
  68. package/ios/RNDebug/Views/XTScanQRPlugin.swift +9 -4
  69. package/ios/XRNTemplate/AppDelegate.h +3 -3
  70. package/ios/XRNTemplate/AppDelegate.mm +40 -102
  71. package/ios/XRNTemplate/Info.plist +4 -4
  72. package/ios/XRNTemplate/PrivacyInfo.xcprivacy +48 -0
  73. package/ios/XRNTemplate-Bridging-Header.h +2 -1
  74. package/ios/XRNTemplate.xcodeproj/project.pbxproj +68 -77
  75. package/ios/ios_patches/fixed_glog_config.h +195 -0
  76. package/ios/ios_patches/xt_IQKeyboardManager+Position.swift +1341 -0
  77. package/ios/ios_patches/xt_IQKeyboardManager.swift +454 -0
  78. package/ios/subBundles/.gitkeep +0 -0
  79. package/main-bundle/babel.config.js +2 -2
  80. package/main-bundle/package.json +11 -20
  81. package/main-bundle/yarn.lock +14655 -9651
  82. package/metro.config.js +21 -0
  83. package/package.json +2 -2
  84. package/react-native.config.js +3 -45
  85. package/src/.gitkeep +0 -0
  86. package/sub-bundle/babel.config.js +2 -2
  87. package/sub-bundle/package.json +11 -20
  88. package/sub-bundle/react-native.config.js +4 -0
  89. package/sub-bundle/yarn.lock +14655 -9651
  90. package/xrn.config.json +12 -12
  91. package/android/app/src/main/java/com/xrn/template/multibundle/XDevSupportParams.kt +0 -6
  92. package/android/app/src/main/java/com/xrn/template/multibundle/XRNHostParams.kt +0 -82
  93. package/harmony/entry/src/main/cpp/generated/ConfigNativeModule.cpp +0 -21
  94. package/harmony/entry/src/main/cpp/generated/ConfigNativeModule.h +0 -21
  95. package/harmony/entry/src/main/cpp/generated/GetRandomValuesNativeModule.cpp +0 -21
  96. package/harmony/entry/src/main/cpp/generated/GetRandomValuesNativeModule.h +0 -21
  97. package/harmony/entry/src/main/cpp/generated/NativeHarmonyTouchId.cpp +0 -22
  98. package/harmony/entry/src/main/cpp/generated/NativeHarmonyTouchId.h +0 -21
  99. package/harmony/entry/src/main/cpp/generated/OreitationLockerNativeModule.cpp +0 -31
  100. package/harmony/entry/src/main/cpp/generated/OreitationLockerNativeModule.h +0 -21
  101. package/harmony/entry/src/main/cpp/generated/RNCCameraRoll.cpp +0 -28
  102. package/harmony/entry/src/main/cpp/generated/RNCCameraRoll.h +0 -21
  103. package/harmony/entry/src/main/cpp/generated/RNCCameraRollPermission.cpp +0 -26
  104. package/harmony/entry/src/main/cpp/generated/RNCCameraRollPermission.h +0 -21
  105. package/harmony/entry/src/main/cpp/generated/RNCWebViewJSIBinder.h +0 -120
  106. package/harmony/entry/src/main/cpp/generated/RNDeviceInfo.cpp +0 -164
  107. package/harmony/entry/src/main/cpp/generated/RNDeviceInfo.h +0 -21
  108. package/harmony/entry/src/main/cpp/generated/RNDocumentPicker.cpp +0 -24
  109. package/harmony/entry/src/main/cpp/generated/RNDocumentPicker.h +0 -21
  110. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerButtonComponentDescriptor.h +0 -43
  111. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerButtonJSIBinder.h +0 -38
  112. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerModule.cpp +0 -28
  113. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerModule.h +0 -21
  114. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerRootViewComponentDescriptor.h +0 -43
  115. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerRootViewJSIBinder.h +0 -31
  116. package/harmony/entry/src/main/cpp/generated/RNLocalize.cpp +0 -31
  117. package/harmony/entry/src/main/cpp/generated/ReactNativeBlobUtil.cpp +0 -51
  118. package/harmony/entry/src/main/cpp/generated/ReactNativeBlobUtil.h +0 -21
  119. package/harmony/entry/src/main/cpp/generated/XRNAssetLoaderModule.cpp +0 -21
  120. package/harmony/entry/src/main/cpp/generated/XRNAssetLoaderModule.h +0 -21
  121. package/harmony/entry/src/main/cpp/generated/XRNFileModule.cpp +0 -22
  122. package/harmony/entry/src/main/cpp/generated/XRNFileModule.h +0 -21
  123. package/ios/BundleEventCenter/bundleController/XTBundleViewController.m +0 -35
  124. package/ios/BundleEventCenter/bundleController/XTMainBundleViewController.m +0 -41
  125. package/main-bundle/.watchmanconfig +0 -1
  126. package/sub-bundle/.watchmanconfig +0 -1
@@ -0,0 +1,454 @@
1
+ //
2
+ // IQKeyboardManager.swift
3
+ // https://github.com/hackiftekhar/IQKeyboardManager
4
+ // Copyright (c) 2013-20 Iftekhar Qurashi.
5
+ //
6
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ // of this software and associated documentation files (the "Software"), to deal
8
+ // in the Software without restriction, including without limitation the rights
9
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ // copies of the Software, and to permit persons to whom the Software is
11
+ // furnished to do so, subject to the following conditions:
12
+ //
13
+ // The above copyright notice and this permission notice shall be included in
14
+ // all copies or substantial portions of the Software.
15
+ //
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ // THE SOFTWARE.
23
+
24
+ // import Foundation - UIKit contains Foundation
25
+ import UIKit
26
+ import CoreGraphics
27
+ import QuartzCore
28
+
29
+ // MARK: IQToolbar tags
30
+
31
+ /**
32
+ Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. A generic version of KeyboardManagement. https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html
33
+ */
34
+
35
+ @objc
36
+ public class SoftIpuntModelInfo: NSObject {
37
+ @objc public var softInputMode = "resize"
38
+ @objc public var space: NSNumber = 24
39
+ @objc public var scrollableViewTag: String = ""
40
+ @objc public var modalHeaderSpace: NSNumber = 0
41
+ }
42
+
43
+ @available(iOSApplicationExtension, unavailable)
44
+ @objc public final class IQKeyboardManager: NSObject {
45
+
46
+ /**
47
+ Returns the default singleton instance.
48
+ */
49
+ @objc public static let shared = IQKeyboardManager()
50
+
51
+ /**
52
+ Invalid point value.
53
+ */
54
+ internal static let kIQCGPointInvalid = CGPoint.init(x: CGFloat.greatestFiniteMagnitude, y: CGFloat.greatestFiniteMagnitude)
55
+
56
+ // MARK: UIKeyboard handling
57
+
58
+ /**
59
+ Enable/disable managing distance between keyboard and textField. Default is YES(Enabled when class loads in `+(void)load` method).
60
+ */
61
+ @objc public var enable = false {
62
+
63
+ didSet {
64
+ // If not enable, enable it.
65
+ if enable, !oldValue {
66
+ // If keyboard is currently showing. Sending a fake notification for keyboardWillHide to retain view's original position.
67
+ if let notification = keyboardShowNotification {
68
+ keyboardWillShow(notification)
69
+ }
70
+ showLog("Enabled")
71
+ } else if !enable, oldValue { // If not disable, desable it.
72
+ scrollViewOffsetY = 0.0
73
+ keyboardWillHide(nil)
74
+ showLog("Disabled")
75
+ }
76
+ }
77
+ }
78
+
79
+ @objc public var softInputMode: SoftIpuntModelInfo = SoftIpuntModelInfo()
80
+ @objc public var viewSoftInputMode: SoftIpuntModelInfo = SoftIpuntModelInfo()
81
+ @objc public var modalSoftInputMode: SoftIpuntModelInfo = SoftIpuntModelInfo()
82
+
83
+ @objc public var scrollViewOffsetY = 0.0
84
+
85
+ /**
86
+ To set keyboard distance from textField. can't be less than zero. Default is 10.0.
87
+ */
88
+ @objc public var keyboardDistanceFromTextField: CGFloat = 10.0
89
+
90
+ // MARK: IQToolbar handling
91
+
92
+ /**
93
+ Automatic add the IQToolbar functionality. Default is YES.
94
+ */
95
+ @objc public var enableAutoToolbar = true {
96
+ didSet {
97
+ if privateIsEnableAutoToolbar() {
98
+ addToolbarIfRequired()
99
+ } else {
100
+ removeToolbarIfRequired()
101
+ }
102
+
103
+ let enableToolbar = enableAutoToolbar ? "Yes" : "NO"
104
+
105
+ showLog("enableAutoToolbar: \(enableToolbar)")
106
+ }
107
+ }
108
+
109
+ /**
110
+ /**
111
+ IQAutoToolbarBySubviews: Creates Toolbar according to subview's hirarchy of Textfield's in view.
112
+ IQAutoToolbarByTag: Creates Toolbar according to tag property of TextField's.
113
+ IQAutoToolbarByPosition: Creates Toolbar according to the y,x position of textField in it's superview coordinate.
114
+
115
+ Default is IQAutoToolbarBySubviews.
116
+ */
117
+ AutoToolbar managing behaviour. Default is IQAutoToolbarBySubviews.
118
+ */
119
+ @objc public var toolbarManageBehaviour = IQAutoToolbarManageBehaviour.bySubviews
120
+
121
+ /**
122
+ If YES, then uses textField's tintColor property for IQToolbar, otherwise tint color is default. Default is NO.
123
+ */
124
+ @objc public var shouldToolbarUsesTextFieldTintColor = false
125
+
126
+ /**
127
+ This is used for toolbar.tintColor when textfield.keyboardAppearance is UIKeyboardAppearanceDefault. If shouldToolbarUsesTextFieldTintColor is YES then this property is ignored. Default is nil and uses black color.
128
+ */
129
+ @objc public var toolbarTintColor: UIColor?
130
+
131
+ /**
132
+ This is used for toolbar.barTintColor. Default is nil.
133
+ */
134
+ @objc public var toolbarBarTintColor: UIColor?
135
+
136
+ /**
137
+ IQPreviousNextDisplayModeDefault: Show NextPrevious when there are more than 1 textField otherwise hide.
138
+ IQPreviousNextDisplayModeAlwaysHide: Do not show NextPrevious buttons in any case.
139
+ IQPreviousNextDisplayModeAlwaysShow: Always show nextPrevious buttons, if there are more than 1 textField then both buttons will be visible but will be shown as disabled.
140
+ */
141
+ @objc public var previousNextDisplayMode = IQPreviousNextDisplayMode.default
142
+
143
+ /**
144
+ Toolbar previous/next/done button icon, If nothing is provided then check toolbarDoneBarButtonItemText to draw done button.
145
+ */
146
+ @objc public var toolbarPreviousBarButtonItemImage: UIImage?
147
+ @objc public var toolbarNextBarButtonItemImage: UIImage?
148
+ @objc public var toolbarDoneBarButtonItemImage: UIImage?
149
+
150
+ /**
151
+ Toolbar previous/next/done button text, If nothing is provided then system default 'UIBarButtonSystemItemDone' will be used.
152
+ */
153
+ @objc public var toolbarPreviousBarButtonItemText: String?
154
+ @objc public var toolbarPreviousBarButtonItemAccessibilityLabel: String?
155
+ @objc public var toolbarNextBarButtonItemText: String?
156
+ @objc public var toolbarNextBarButtonItemAccessibilityLabel: String?
157
+ @objc public var toolbarDoneBarButtonItemText: String?
158
+ @objc public var toolbarDoneBarButtonItemAccessibilityLabel: String?
159
+ @objc public var toolbarTitlBarButtonItemAccessibilityLabel: String?
160
+ /**
161
+ If YES, then it add the textField's placeholder text on IQToolbar. Default is YES.
162
+ */
163
+ @objc public var shouldShowToolbarPlaceholder = true
164
+
165
+ /**
166
+ Placeholder Font. Default is nil.
167
+ */
168
+ @objc public var placeholderFont: UIFont?
169
+
170
+ /**
171
+ Placeholder Color. Default is nil. Which means lightGray
172
+ */
173
+ @objc public var placeholderColor: UIColor?
174
+
175
+ /**
176
+ Placeholder Button Color when it's treated as button. Default is nil.
177
+ */
178
+ @objc public var placeholderButtonColor: UIColor?
179
+
180
+ // MARK: UIKeyboard appearance overriding
181
+
182
+ /**
183
+ Override the keyboardAppearance for all textField/textView. Default is NO.
184
+ */
185
+ @objc public var overrideKeyboardAppearance = false
186
+
187
+ /**
188
+ If overrideKeyboardAppearance is YES, then all the textField keyboardAppearance is set using this property.
189
+ */
190
+ @objc public var keyboardAppearance = UIKeyboardAppearance.default
191
+
192
+ // MARK: UITextField/UITextView Next/Previous/Resign handling
193
+
194
+ /**
195
+ Resigns Keyboard on touching outside of UITextField/View. Default is NO.
196
+ */
197
+ @objc public var shouldResignOnTouchOutside = false {
198
+
199
+ didSet {
200
+ resignFirstResponderGesture.isEnabled = privateShouldResignOnTouchOutside()
201
+
202
+ let shouldResign = shouldResignOnTouchOutside ? "Yes" : "NO"
203
+
204
+ showLog("shouldResignOnTouchOutside: \(shouldResign)")
205
+ }
206
+ }
207
+
208
+ /** TapGesture to resign keyboard on view's touch. It's a readonly property and exposed only for adding/removing dependencies if your added gesture does have collision with this one */
209
+ @objc lazy public var resignFirstResponderGesture: UITapGestureRecognizer = {
210
+
211
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapRecognized(_:)))
212
+ tapGesture.cancelsTouchesInView = false
213
+ tapGesture.delegate = self
214
+
215
+ return tapGesture
216
+ }()
217
+
218
+ /*******************************************/
219
+
220
+ /**
221
+ Resigns currently first responder field.
222
+ */
223
+ @objc @discardableResult public func resignFirstResponder() -> Bool {
224
+
225
+ guard let textFieldRetain = textFieldView else {
226
+ return false
227
+ }
228
+
229
+ // Resigning first responder
230
+ guard textFieldRetain.resignFirstResponder() else {
231
+ showLog("Refuses to resign first responder: \(textFieldRetain)")
232
+ // If it refuses then becoming it as first responder again. (Bug ID: #96)
233
+ // If it refuses to resign then becoming it first responder again for getting notifications callback.
234
+ textFieldRetain.becomeFirstResponder()
235
+ return false
236
+ }
237
+ return true
238
+ }
239
+
240
+ // MARK: UISound handling
241
+
242
+ /**
243
+ If YES, then it plays inputClick sound on next/previous/done click.
244
+ */
245
+ @objc public var shouldPlayInputClicks = true
246
+
247
+ // MARK: UIAnimation handling
248
+
249
+ /**
250
+ If YES, then calls 'setNeedsLayout' and 'layoutIfNeeded' on any frame update of to viewController's view.
251
+ */
252
+ @objc public var layoutIfNeededOnUpdate = false
253
+
254
+ // MARK: Class Level disabling methods
255
+
256
+ /**
257
+ Disable distance handling within the scope of disabled distance handling viewControllers classes. Within this scope, 'enabled' property is ignored. Class should be kind of UIViewController.
258
+ */
259
+ @objc public var disabledDistanceHandlingClasses = [UIViewController.Type]()
260
+
261
+ /**
262
+ Enable distance handling within the scope of enabled distance handling viewControllers classes. Within this scope, 'enabled' property is ignored. Class should be kind of UIViewController. If same Class is added in disabledDistanceHandlingClasses list, then enabledDistanceHandlingClasses will be ignored.
263
+ */
264
+ @objc public var enabledDistanceHandlingClasses = [UIViewController.Type]()
265
+
266
+ /**
267
+ Disable automatic toolbar creation within the scope of disabled toolbar viewControllers classes. Within this scope, 'enableAutoToolbar' property is ignored. Class should be kind of UIViewController.
268
+ */
269
+ @objc public var disabledToolbarClasses = [UIViewController.Type]()
270
+
271
+ /**
272
+ Enable automatic toolbar creation within the scope of enabled toolbar viewControllers classes. Within this scope, 'enableAutoToolbar' property is ignored. Class should be kind of UIViewController. If same Class is added in disabledToolbarClasses list, then enabledToolbarClasses will be ignore.
273
+ */
274
+ @objc public var enabledToolbarClasses = [UIViewController.Type]()
275
+
276
+ /**
277
+ Allowed subclasses of UIView to add all inner textField, this will allow to navigate between textField contains in different superview. Class should be kind of UIView.
278
+ */
279
+ @objc public var toolbarPreviousNextAllowedClasses = [UIView.Type]()
280
+
281
+ /**
282
+ Disabled classes to ignore 'shouldResignOnTouchOutside' property, Class should be kind of UIViewController.
283
+ */
284
+ @objc public var disabledTouchResignedClasses = [UIViewController.Type]()
285
+
286
+ /**
287
+ Enabled classes to forcefully enable 'shouldResignOnTouchOutsite' property. Class should be kind of UIViewController. If same Class is added in disabledTouchResignedClasses list, then enabledTouchResignedClasses will be ignored.
288
+ */
289
+ @objc public var enabledTouchResignedClasses = [UIViewController.Type]()
290
+
291
+ /**
292
+ if shouldResignOnTouchOutside is enabled then you can customise the behaviour to not recognise gesture touches on some specific view subclasses. Class should be kind of UIView. Default is [UIControl, UINavigationBar]
293
+ */
294
+ @objc public var touchResignedGestureIgnoreClasses = [UIView.Type]()
295
+
296
+ // MARK: Third Party Library support
297
+ /// Add TextField/TextView Notifications customised Notifications. For example while using YYTextView https://github.com/ibireme/YYText
298
+
299
+ /**
300
+ Add/Remove customised Notification for third party customised TextField/TextView. Please be aware that the Notification object must be idential to UITextField/UITextView Notification objects and customised TextField/TextView support must be idential to UITextField/UITextView.
301
+ @param didBeginEditingNotificationName This should be identical to UITextViewTextDidBeginEditingNotification
302
+ @param didEndEditingNotificationName This should be identical to UITextViewTextDidEndEditingNotification
303
+ */
304
+
305
+ @objc public func registerTextFieldViewClass(_ aClass: UIView.Type, didBeginEditingNotificationName: String, didEndEditingNotificationName: String) {
306
+
307
+ NotificationCenter.default.addObserver(self, selector: #selector(self.textFieldViewDidBeginEditing(_:)), name: Notification.Name(rawValue: didBeginEditingNotificationName), object: nil)
308
+ NotificationCenter.default.addObserver(self, selector: #selector(self.textFieldViewDidEndEditing(_:)), name: Notification.Name(rawValue: didEndEditingNotificationName), object: nil)
309
+ }
310
+
311
+ @objc public func unregisterTextFieldViewClass(_ aClass: UIView.Type, didBeginEditingNotificationName: String, didEndEditingNotificationName: String) {
312
+
313
+ NotificationCenter.default.removeObserver(self, name: Notification.Name(rawValue: didBeginEditingNotificationName), object: nil)
314
+ NotificationCenter.default.removeObserver(self, name: Notification.Name(rawValue: didEndEditingNotificationName), object: nil)
315
+ }
316
+
317
+ /**************************************************************************************/
318
+ internal struct WeakObjectContainer {
319
+ weak var object: AnyObject?
320
+ }
321
+
322
+ /**************************************************************************************/
323
+
324
+ // MARK: Initialization/Deinitialization
325
+
326
+ /* Singleton Object Initialization. */
327
+ override init() {
328
+
329
+ super.init()
330
+
331
+ self.registerAllNotifications()
332
+
333
+ // Creating gesture for @shouldResignOnTouchOutside. (Enhancement ID: #14)
334
+ resignFirstResponderGesture.isEnabled = shouldResignOnTouchOutside
335
+
336
+ disabledDistanceHandlingClasses.append(UITableViewController.self)
337
+ disabledDistanceHandlingClasses.append(UIAlertController.self)
338
+ disabledToolbarClasses.append(UIAlertController.self)
339
+ disabledTouchResignedClasses.append(UIAlertController.self)
340
+ toolbarPreviousNextAllowedClasses.append(UITableView.self)
341
+ toolbarPreviousNextAllowedClasses.append(UICollectionView.self)
342
+ toolbarPreviousNextAllowedClasses.append(IQPreviousNextView.self)
343
+ touchResignedGestureIgnoreClasses.append(UIControl.self)
344
+ touchResignedGestureIgnoreClasses.append(UINavigationBar.self)
345
+
346
+ // Loading IQToolbar, IQTitleBarButtonItem, IQBarButtonItem to fix first time keyboard appearance delay (Bug ID: #550)
347
+ // If you experience exception breakpoint issue at below line then try these solutions https://stackoverflow.com/questions/27375640/all-exception-break-point-is-stopping-for-no-reason-on-simulator
348
+ DispatchQueue.main.async {
349
+ let textField = UITextField()
350
+ textField.addDoneOnKeyboardWithTarget(nil, action: #selector(self.doneAction(_:)))
351
+ textField.addPreviousNextDoneOnKeyboardWithTarget(nil, previousAction: #selector(self.previousAction(_:)), nextAction: #selector(self.nextAction(_:)), doneAction: #selector(self.doneAction(_:)))
352
+ }
353
+ }
354
+
355
+ deinit {
356
+ // Disable the keyboard manager.
357
+ enable = false
358
+ }
359
+
360
+ /** Getting keyWindow. */
361
+ internal func keyWindow() -> UIWindow? {
362
+
363
+ if let keyWindow = textFieldView?.window {
364
+ return keyWindow
365
+ } else {
366
+
367
+ struct Static {
368
+ /** @abstract Save keyWindow object for reuse.
369
+ @discussion Sometimes [[UIApplication sharedApplication] keyWindow] is returning nil between the app. */
370
+ static weak var keyWindow: UIWindow?
371
+ }
372
+
373
+ var originalKeyWindow: UIWindow?
374
+
375
+ #if swift(>=5.1)
376
+ if #available(iOS 13, *) {
377
+ originalKeyWindow = UIApplication.shared.connectedScenes
378
+ .compactMap { $0 as? UIWindowScene }
379
+ .flatMap { $0.windows }
380
+ .first(where: { $0.isKeyWindow })
381
+ } else {
382
+ originalKeyWindow = UIApplication.shared.keyWindow
383
+ }
384
+ #else
385
+ originalKeyWindow = UIApplication.shared.keyWindow
386
+ #endif
387
+
388
+ // If original key window is not nil and the cached keywindow is also not original keywindow then changing keywindow.
389
+ if let originalKeyWindow = originalKeyWindow {
390
+ Static.keyWindow = originalKeyWindow
391
+ }
392
+
393
+ // Return KeyWindow
394
+ return Static.keyWindow
395
+ }
396
+ }
397
+
398
+ // MARK: Public Methods
399
+
400
+ /* Refreshes textField/textView position if any external changes is explicitly made by user. */
401
+ @objc public func reloadLayoutIfNeeded() {
402
+
403
+ guard privateIsEnabled(),
404
+ keyboardShowing,
405
+ topViewBeginOrigin.equalTo(IQKeyboardManager.kIQCGPointInvalid) == false, let textFieldView = textFieldView,
406
+ textFieldView.isAlertViewTextField() == false else {
407
+ return
408
+ }
409
+ self.adjustPosition()
410
+ }
411
+
412
+ @objc public func clearViewPositionInfo() {
413
+ viewSoftInputMode = SoftIpuntModelInfo()
414
+
415
+ scrollViewOffsetY = 0.0
416
+ }
417
+
418
+ @objc public func clearModalPositionInfo() {
419
+ modalSoftInputMode = SoftIpuntModelInfo()
420
+
421
+ scrollViewOffsetY = 0.0
422
+ }
423
+ }
424
+
425
+ @available(iOSApplicationExtension, unavailable)
426
+ extension IQKeyboardManager: UIGestureRecognizerDelegate {
427
+
428
+ /** Resigning on tap gesture. (Enhancement ID: #14)*/
429
+ @objc internal func tapRecognized(_ gesture: UITapGestureRecognizer) {
430
+
431
+ if gesture.state == .ended {
432
+
433
+ // Resigning currently responder textField.
434
+ resignFirstResponder()
435
+ }
436
+ }
437
+
438
+ /** Note: returning YES is guaranteed to allow simultaneous recognition. returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES. */
439
+ @objc public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
440
+ return false
441
+ }
442
+
443
+ /** To not detect touch events in a subclass of UIControl, these may have added their own selector for specific work */
444
+ @objc public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
445
+ // Should not recognize gesture if the clicked view is either UIControl or UINavigationBar(<Back button etc...) (Bug ID: #145)
446
+
447
+ for ignoreClass in touchResignedGestureIgnoreClasses where touch.view?.isKind(of: ignoreClass) ?? false {
448
+ return false
449
+ }
450
+
451
+ return true
452
+ }
453
+
454
+ }
File without changes
@@ -1,3 +1,3 @@
1
1
  module.exports = {
2
- presets: ["module:metro-react-native-babel-preset"],
3
- };
2
+ extends: "@xrnjs/core/app-config/babel.config.js",
3
+ };
@@ -4,28 +4,19 @@
4
4
  "private": true,
5
5
  "main": "index.ts",
6
6
  "scripts": {
7
- "start": "xrn start",
8
- "postinstall": "xrn-bundle-postinstall"
9
- },
10
- "resolutions": {
11
- "@react-native-community/cli": "9.3.3",
12
- "metro": "0.72.4",
13
- "metro-config": "0.72.4"
7
+ "start": "xrn start --nativeRoot ../",
8
+ "bundle:ios": "xrn build-bundle ios",
9
+ "bundle:android": "xrn build-bundle android",
10
+ "bundle:harmony": "xrn build-bundle harmony",
11
+ "postinstall": "xrn postinstall bundle"
14
12
  },
15
13
  "dependencies": {
16
- "@xrnjs/core": "0.0.4",
17
- "react": "18.2.0",
18
- "react-native": "0.72.5"
14
+ "@xrnjs/cli": "0.1.0",
15
+ "@xrnjs/core": "0.1.0",
16
+ "@xrnjs/ui": "0.1.1"
19
17
  },
20
- "devDependencies": {
21
- "@babel/core": "^7.12.9",
22
- "@babel/runtime": "^7.12.5",
23
- "@react-native-community/eslint-config": "^2.0.0",
24
- "@react-native/metro-config": "^0.72.9",
25
- "@types/react": "18.0.25",
26
- "@types/react-native": "0.72.8",
27
- "@xrnjs/cli": "0.0.6",
28
- "eslint": "^7.32.0",
29
- "metro-react-native-babel-preset": "0.72.4"
18
+ "resolutions": {
19
+ "react-native-view-shot": "4.0.3",
20
+ "@react-native-community/push-notification-ios": "1.11.0"
30
21
  }
31
22
  }