react-native-ui-lib 8.1.1 → 8.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android/build.gradle +32 -0
- package/lib/android/src/main/AndroidManifest.xml +4 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +28 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/dynamicfont/DynamicFontModule.java +139 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/dynamicfont/DynamicFontPackage.java +28 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlightFrame.java +33 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlightViewTagParams.java +50 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterView.java +167 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +131 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewPackage.java +28 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/UiUtils.java +50 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/AppContextHolder.java +52 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.java +213 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.java +39 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewManager.java +29 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewShadow.java +29 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/KeyboardInputModule.java +34 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/KeyboardInputPackage.java +49 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/ReactContextHolder.java +16 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor.java +83 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor.java +163 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/PredicateFunc.java +5 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +33 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils.java +65 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/utils/LogForwarder.java +45 -0
- package/lib/android/src/main/res/layout/wheel_picker.xml +9 -0
- package/lib/android/src/main/res/values/colors.xml +9 -0
- package/lib/android/src/main/res/values/styles.xml +9 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/keyboardRegistry.api.json +50 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/keyboardAccessoryView.api.json +58 -0
- package/lib/components/Keyboard/KeyboardAwareInsetsView/keyboardAwareInsetsView.api.json +14 -0
- package/lib/components/Keyboard/KeyboardTrackingView/keyboardTrackingView.api.json +86 -0
- package/lib/ios/reactnativeuilib/dynamicfont/DynamicFont.h +9 -0
- package/lib/ios/reactnativeuilib/dynamicfont/DynamicFont.m +115 -0
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterView.h +19 -0
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterView.m +216 -0
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterViewManager.h +6 -0
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterViewManager.m +28 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/Color+Interpolation.h +39 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/Color+Interpolation.m +160 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNAnimatorTemp.h +36 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNAnimatorTemp.m +121 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNInterpolable.h +48 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNInterpolable.m +27 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNInterpolation.h +16 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/NSValue+Interpolation.h +19 -0
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/NSValue+Interpolation.mm +155 -0
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.h +16 -0
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +450 -0
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +18 -0
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +99 -0
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.h +14 -0
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +827 -0
- package/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.h +44 -0
- package/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.m +171 -0
- package/lib/ios/reactnativeuilib/keyboardtrackingview/UIResponder+FirstResponderTemp.h +6 -0
- package/lib/ios/reactnativeuilib/keyboardtrackingview/UIResponder+FirstResponderTemp.m +17 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaManager.h +6 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaManager.m +105 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerShadowView.h +5 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerShadowView.m +20 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerView.h +7 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerView.m +76 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewLocalData.h +9 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewLocalData.m +14 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewManager.h +5 -0
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewManager.m +26 -0
- package/lib/specs/HighlighterViewNativeComponent.ts +78 -0
- package/lib/specs/KeyboardTrackingViewNativeComponent.ts +74 -0
- package/package.json +2 -25
- package/src/assets/Assets.d.ts +5 -0
- package/src/assets/emojis/index.d.ts +1343 -0
- package/src/assets/index.d.ts +3 -0
- package/src/assets/internal/index.d.ts +4 -0
- package/src/commons/Config.d.ts +24 -0
- package/src/commons/Constants.d.ts +54 -0
- package/src/commons/UIComponent.d.ts +4 -0
- package/src/commons/asBaseComponent.d.ts +15 -0
- package/src/commons/baseComponent.d.ts +2 -0
- package/src/commons/forwardRef.d.ts +8 -0
- package/src/commons/modifiers.d.ts +118 -0
- package/src/commons/new.d.ts +8 -0
- package/src/commons/withScrollEnabler.d.ts +13 -0
- package/src/commons/withScrollReached.d.ts +35 -0
- package/src/components/WheelPicker/Item.d.ts +28 -0
- package/src/components/WheelPicker/WheelPicker.driver.d.ts +18 -0
- package/src/components/WheelPicker/WheelPickerItem.driver.d.ts +8 -0
- package/src/components/WheelPicker/helpers/useListMiddleIndex.d.ts +6 -0
- package/src/components/WheelPicker/index.d.ts +88 -0
- package/src/components/WheelPicker/types.d.ts +6 -0
- package/src/components/WheelPicker/usePresenter.d.ts +21 -0
- package/src/components/actionBar/index.d.ts +35 -0
- package/src/components/actionSheet/index.d.ts +80 -0
- package/src/components/animatedImage/index.d.ts +28 -0
- package/src/components/avatar/index.d.ts +382 -0
- package/src/components/badge/index.d.ts +879 -0
- package/src/components/baseInput/Validators.d.ts +8 -0
- package/src/components/baseInput/index.d.ts +29 -0
- package/src/components/button/Button.driver.new.d.ts +34 -0
- package/src/components/button/ButtonConstants.d.ts +26 -0
- package/src/components/button/index.d.ts +573 -0
- package/src/components/button/types.d.ts +157 -0
- package/src/components/card/CardContext.d.ts +3 -0
- package/src/components/card/CardImage.d.ts +20 -0
- package/src/components/card/CardPresenter.d.ts +12 -0
- package/src/components/card/CardSection.d.ts +79 -0
- package/src/components/card/asCardChild.d.ts +6 -0
- package/src/components/card/index.d.ts +120 -0
- package/src/components/carousel/Carousel.driver.new.d.ts +9 -0
- package/src/components/carousel/CarouselPresenter.d.ts +9 -0
- package/src/components/carousel/index.d.ts +73 -0
- package/src/components/carousel/types.d.ts +107 -0
- package/src/components/checkbox/Checkbox.driver.d.ts +15 -0
- package/src/components/checkbox/index.d.ts +129 -0
- package/src/components/chip/chip.driver.d.ts +33 -0
- package/src/components/chip/index.d.ts +209 -0
- package/src/components/chipsInput/index.d.ts +55 -0
- package/src/components/colorPalette/index.d.ts +116 -0
- package/src/components/colorPicker/ColorPickerDialog.d.ts +39 -0
- package/src/components/colorPicker/ColorPickerDialogHeader.d.ts +9 -0
- package/src/components/colorPicker/ColorPickerDialogSliders.d.ts +10 -0
- package/src/components/colorPicker/ColorPickerPresenter.d.ts +16 -0
- package/src/components/colorPicker/ColorPickerPreview.d.ts +12 -0
- package/src/components/colorPicker/index.d.ts +45 -0
- package/src/components/colorSwatch/index.d.ts +50 -0
- package/src/components/connectionStatusBar/index.d.ts +33 -0
- package/src/components/connectionStatusBar/types.d.ts +28 -0
- package/src/components/dash/index.d.ts +19 -0
- package/src/components/dateTimePicker/DateTimePicker.driver.d.ts +7 -0
- package/src/components/dateTimePicker/index.d.ts +288 -0
- package/src/components/dateTimePicker/useOldApi.d.ts +27 -0
- package/src/components/dialog/Dialog.driver.new.d.ts +6 -0
- package/src/components/dialog/DialogHeader.d.ts +4 -0
- package/src/components/dialog/index.d.ts +15 -0
- package/src/components/dialog/types.d.ts +138 -0
- package/src/components/dialog/useDialogContent.d.ts +13 -0
- package/src/components/drawer/Swipeable.d.ts +94 -0
- package/src/components/drawer/index.d.ts +161 -0
- package/src/components/expandableSection/index.d.ts +40 -0
- package/src/components/fadedScrollView/index.d.ts +59 -0
- package/src/components/fader/index.d.ts +37 -0
- package/src/components/featureHighlight/index.d.ts +147 -0
- package/src/components/floatingButton/index.d.ts +89 -0
- package/src/components/gradient/index.d.ts +19 -0
- package/src/components/gridList/index.d.ts +5 -0
- package/src/components/gridList/types.d.ts +29 -0
- package/src/components/gridList/useGridLayout.d.ts +15 -0
- package/src/components/gridListItem/index.d.ts +132 -0
- package/src/components/gridView/index.d.ts +80 -0
- package/src/components/hint/Hint.driver.d.ts +6 -0
- package/src/components/hint/Hint.driver.new.d.ts +19 -0
- package/src/components/hint/HintAnchor.d.ts +13 -0
- package/src/components/hint/HintBubble.d.ts +12 -0
- package/src/components/hint/HintMockChildren.d.ts +8 -0
- package/src/components/hint/HintOld.d.ts +196 -0
- package/src/components/hint/hooks/useHintAccessibility.d.ts +10 -0
- package/src/components/hint/hooks/useHintLayout.d.ts +13 -0
- package/src/components/hint/hooks/useHintPosition.d.ts +29 -0
- package/src/components/hint/hooks/useHintVisibility.d.ts +6 -0
- package/src/components/hint/index.d.ts +14 -0
- package/src/components/hint/types.d.ts +106 -0
- package/src/components/icon/index.d.ts +97 -0
- package/src/components/image/Image.driver.d.ts +4 -0
- package/src/components/image/Image.driver.new.d.ts +2 -0
- package/src/components/image/index.d.ts +192 -0
- package/src/components/listItem/ListItemPart.d.ts +15 -0
- package/src/components/listItem/index.d.ts +52 -0
- package/src/components/listItem/types.d.ts +60 -0
- package/src/components/loaderScreen/index.d.ts +13 -0
- package/src/components/loaderScreen/types.d.ts +32 -0
- package/src/components/marquee/index.d.ts +5 -0
- package/src/components/marquee/types.d.ts +35 -0
- package/src/components/maskedInput/index.d.ts +5 -0
- package/src/components/maskedInput/new.d.ts +22 -0
- package/src/components/modal/Modal.driver.new.d.ts +8 -0
- package/src/components/modal/TopBar.d.ts +89 -0
- package/src/components/modal/index.d.ts +64 -0
- package/src/components/numberInput/NumberInput.driver.d.ts +6 -0
- package/src/components/numberInput/Presenter.d.ts +21 -0
- package/src/components/numberInput/index.d.ts +57 -0
- package/src/components/overlay/index.d.ts +68 -0
- package/src/components/pageControl/index.d.ts +56 -0
- package/src/components/panView/index.d.ts +21 -0
- package/src/components/panView/panningUtil.d.ts +38 -0
- package/src/components/panView/usePanGesture.d.ts +49 -0
- package/src/components/picker/Picker.driver.new.d.ts +44 -0
- package/src/components/picker/PickerContext.d.ts +4 -0
- package/src/components/picker/PickerItem.d.ts +11 -0
- package/src/components/picker/PickerItemsList.d.ts +4 -0
- package/src/components/picker/PickerPresenter.d.ts +7 -0
- package/src/components/picker/PickerSelectionStatusBar.d.ts +3 -0
- package/src/components/picker/helpers/useFieldType.d.ts +373 -0
- package/src/components/picker/helpers/useImperativePickerHandle.d.ts +5 -0
- package/src/components/picker/helpers/useNewPickerProps.d.ts +3 -0
- package/src/components/picker/helpers/usePickerLabel.d.ts +17 -0
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +4 -0
- package/src/components/picker/helpers/usePickerSearch.d.ts +9 -0
- package/src/components/picker/helpers/usePickerSelection.d.ts +16 -0
- package/src/components/picker/index.d.ts +15 -0
- package/src/components/picker/types.d.ts +321 -0
- package/src/components/pieChart/PieSegment.d.ts +34 -0
- package/src/components/pieChart/index.d.ts +15 -0
- package/src/components/progressBar/index.d.ts +65 -0
- package/src/components/progressiveImage/index.d.ts +23 -0
- package/src/components/radioButton/RadioButton.driver.d.ts +9 -0
- package/src/components/radioButton/index.d.ts +121 -0
- package/src/components/radioGroup/RadioGroup.driver.d.ts +13 -0
- package/src/components/radioGroup/RadioGroupContext.d.ts +14 -0
- package/src/components/radioGroup/asRadioGroupChild.d.ts +2 -0
- package/src/components/radioGroup/index.d.ts +47 -0
- package/src/components/scrollBar/index.d.ts +88 -0
- package/src/components/searchInput/index.d.ts +37 -0
- package/src/components/searchInput/types.d.ts +66 -0
- package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +25 -0
- package/src/components/sectionsWheelPicker/index.d.ts +43 -0
- package/src/components/segmentedControl/index.d.ts +90 -0
- package/src/components/segmentedControl/segment.d.ts +111 -0
- package/src/components/segmentedControl/useSegmentedControlPreset.d.ts +10 -0
- package/src/components/skeletonView/index.d.ts +163 -0
- package/src/components/slider/ColorSliderGroup.d.ts +13 -0
- package/src/components/slider/GradientSlider.d.ts +20 -0
- package/src/components/slider/SliderContext.d.ts +8 -0
- package/src/components/slider/Thumb.d.ts +32 -0
- package/src/components/slider/index.d.ts +31 -0
- package/src/components/slider/slider.driver.d.ts +5 -0
- package/src/components/slider/types.d.ts +197 -0
- package/src/components/sortableGridList/SortableItem.d.ts +6 -0
- package/src/components/sortableGridList/index.d.ts +5 -0
- package/src/components/sortableGridList/types.d.ts +34 -0
- package/src/components/sortableGridList/usePresenter.d.ts +21 -0
- package/src/components/sortableList/SortableList.driver.new.d.ts +2 -0
- package/src/components/sortableList/SortableListContext.d.ts +19 -0
- package/src/components/sortableList/SortableListItem.d.ts +8 -0
- package/src/components/sortableList/SortableListItem.driver.new.d.ts +11 -0
- package/src/components/sortableList/index.d.ts +5 -0
- package/src/components/sortableList/types.d.ts +48 -0
- package/src/components/sortableList/usePresenter.d.ts +12 -0
- package/src/components/stackAggregator/index.d.ts +89 -0
- package/src/components/stateScreen/index.d.ts +5 -0
- package/src/components/stateScreen/types.d.ts +30 -0
- package/src/components/stepper/index.d.ts +47 -0
- package/src/components/svgImage/index.d.ts +14 -0
- package/src/components/svgImage/index.web.d.ts +18 -0
- package/src/components/switch/index.d.ts +102 -0
- package/src/components/switch/switch.driver.d.ts +18 -0
- package/src/components/tabController/PageCarousel.d.ts +9 -0
- package/src/components/tabController/TabBar.d.ts +97 -0
- package/src/components/tabController/TabBarContext.d.ts +18 -0
- package/src/components/tabController/TabBarItem.d.ts +105 -0
- package/src/components/tabController/TabPage.d.ts +33 -0
- package/src/components/tabController/index.d.ts +48 -0
- package/src/components/tabController/useImperativeTabControllerHandle.d.ts +6 -0
- package/src/components/tabController/useScrollToItem.d.ts +79 -0
- package/src/components/text/Text.driver.d.ts +7 -0
- package/src/components/text/Text.driver.new.d.ts +17 -0
- package/src/components/text/index.d.ts +195 -0
- package/src/components/textField/CharCounter.d.ts +7 -0
- package/src/components/textField/ClearButton.d.ts +4 -0
- package/src/components/textField/FieldContext.d.ts +4 -0
- package/src/components/textField/FloatingPlaceholder.d.ts +7 -0
- package/src/components/textField/Input.d.ts +8 -0
- package/src/components/textField/Label.d.ts +7 -0
- package/src/components/textField/Presenter.d.ts +7 -0
- package/src/components/textField/TextField.driver.new.d.ts +129 -0
- package/src/components/textField/ValidationMessage.d.ts +7 -0
- package/src/components/textField/index.d.ts +114 -0
- package/src/components/textField/presets/outline.d.ts +737 -0
- package/src/components/textField/presets/underline.d.ts +735 -0
- package/src/components/textField/textInput/index.d.ts +1 -0
- package/src/components/textField/textInput/index.web.d.ts +3 -0
- package/src/components/textField/types.d.ts +287 -0
- package/src/components/textField/useFieldState.d.ts +16 -0
- package/src/components/textField/useImperativeInputHandle.d.ts +4 -0
- package/src/components/textField/usePreset.d.ts +1696 -0
- package/src/components/textField/validators.d.ts +9 -0
- package/src/components/textFieldOld/index.d.ts +71 -0
- package/src/components/timeline/Line.d.ts +10 -0
- package/src/components/timeline/Point.d.ts +9 -0
- package/src/components/timeline/index.d.ts +11 -0
- package/src/components/timeline/line.driver.d.ts +10 -0
- package/src/components/timeline/point.driver.d.ts +8 -0
- package/src/components/timeline/timeline.driver.d.ts +25 -0
- package/src/components/timeline/types.d.ts +50 -0
- package/src/components/touchableOpacity/index.d.ts +50 -0
- package/src/components/view/View.driver.new.d.ts +7 -0
- package/src/components/view/index.d.ts +46 -0
- package/src/components/wizard/WizardStates.d.ts +2 -0
- package/src/components/wizard/WizardStep.d.ts +4 -0
- package/src/components/wizard/index.d.ts +31 -0
- package/src/components/wizard/types.d.ts +90 -0
- package/src/helpers/AvatarHelper.d.ts +9 -0
- package/src/helpers/FormattingPresenter.d.ts +6 -0
- package/src/helpers/Profiler.d.ts +22 -0
- package/src/helpers/index.d.ts +3 -0
- package/src/hooks/index.d.ts +14 -0
- package/src/hooks/useCombinedRefs/index.d.ts +3 -0
- package/src/hooks/useDebounce/index.d.ts +5 -0
- package/src/hooks/useDidUpdate/index.d.ts +6 -0
- package/src/hooks/useHiddenLocation/index.d.ts +13 -0
- package/src/hooks/useHiddenLocation/index.web.d.ts +13 -0
- package/src/hooks/useKeyboardHeight/index.d.ts +5 -0
- package/src/hooks/useMeasure/index.d.ts +15 -0
- package/src/hooks/useModifiers/index.d.ts +3 -0
- package/src/hooks/useOrientation/index.d.ts +7 -0
- package/src/hooks/useScrollEnabler/index.d.ts +23 -0
- package/src/hooks/useScrollReached/index.d.ts +28 -0
- package/src/hooks/useScrollTo/index.d.ts +37 -0
- package/src/hooks/useScrollToItem/index.d.ts +65 -0
- package/src/hooks/useThemeProps/index.d.ts +2 -0
- package/src/hooks/useToggleValue/index.d.ts +2 -0
- package/src/incubator/TouchableOpacity.d.ts +52 -0
- package/src/incubator/calendar/Agenda.d.ts +4 -0
- package/src/incubator/calendar/CalendarContext.d.ts +4 -0
- package/src/incubator/calendar/CalendarItem.d.ts +5 -0
- package/src/incubator/calendar/Day.d.ts +4 -0
- package/src/incubator/calendar/Day_OLD.d.ts +4 -0
- package/src/incubator/calendar/Header.d.ts +4 -0
- package/src/incubator/calendar/Month.d.ts +4 -0
- package/src/incubator/calendar/TodayButton.d.ts +4 -0
- package/src/incubator/calendar/Week.d.ts +4 -0
- package/src/incubator/calendar/WeekDaysNames.d.ts +4 -0
- package/src/incubator/calendar/helpers/CalendarProcessor.d.ts +2 -0
- package/src/incubator/calendar/helpers/DataProcessor.d.ts +2 -0
- package/src/incubator/calendar/helpers/DateUtils.d.ts +23 -0
- package/src/incubator/calendar/index.d.ts +7 -0
- package/src/incubator/calendar/types.d.ts +118 -0
- package/src/incubator/expandableOverlay/ExpandableOverlay.driver.d.ts +7 -0
- package/src/incubator/expandableOverlay/index.d.ts +83 -0
- package/src/incubator/gradient/BorderGradient.d.ts +4 -0
- package/src/incubator/gradient/CircleGradient.d.ts +4 -0
- package/src/incubator/gradient/RectangleGradient.d.ts +4 -0
- package/src/incubator/gradient/index.d.ts +5 -0
- package/src/incubator/gradient/types.d.ts +26 -0
- package/src/incubator/gradient/useAngleTransform.d.ts +27 -0
- package/src/incubator/index.d.ts +9 -0
- package/src/incubator/slider/Slider.driver.d.ts +5 -0
- package/src/incubator/slider/SliderPresenter.d.ts +6 -0
- package/src/incubator/slider/Thumb.d.ts +24 -0
- package/src/incubator/slider/Track.d.ts +13 -0
- package/src/incubator/slider/index.d.ts +139 -0
- package/src/incubator/toast/Toast.driver.new.d.ts +54 -0
- package/src/incubator/toast/helpers/useToastAnimation.d.ts +22 -0
- package/src/incubator/toast/helpers/useToastPresets.d.ts +8 -0
- package/src/incubator/toast/helpers/useToastTimer.d.ts +6 -0
- package/src/incubator/toast/index.d.ts +9 -0
- package/src/incubator/toast/index.js +4 -1
- package/src/incubator/toast/types.d.ts +111 -0
- package/src/index.d.ts +92 -0
- package/src/optionalDependencies/BlurViewPackage.d.ts +2 -0
- package/src/optionalDependencies/BlurViewPackage.web.d.ts +2 -0
- package/src/optionalDependencies/DateTimePickerPackage.d.ts +2 -0
- package/src/optionalDependencies/FlashListPackage.d.ts +2 -0
- package/src/optionalDependencies/HapticFeedbackPackage.d.ts +2 -0
- package/src/optionalDependencies/LinearGradientPackage.d.ts +2 -0
- package/src/optionalDependencies/MomentPackage.d.ts +2 -0
- package/src/optionalDependencies/NetInfoPackage.d.ts +2 -0
- package/src/optionalDependencies/PostCssPackage.d.ts +5 -0
- package/src/optionalDependencies/ShimmerPackage.d.ts +2 -0
- package/src/optionalDependencies/SvgPackage.d.ts +3 -0
- package/src/optionalDependencies/index.d.ts +9 -0
- package/src/optionalDependencies/index.web.d.ts +7 -0
- package/src/services/HapticService.d.ts +15 -0
- package/src/services/LogService.d.ts +35 -0
- package/src/services/index.d.ts +2 -0
- package/src/style/borderRadiuses.d.ts +30 -0
- package/src/style/colorName.d.ts +8 -0
- package/src/style/colorNameMap.d.ts +2 -0
- package/src/style/colors.d.ts +274 -0
- package/src/style/colorsPalette.d.ts +101 -0
- package/src/style/components.d.ts +15 -0
- package/src/style/componentsColors.d.ts +5 -0
- package/src/style/designTokens.d.ts +69 -0
- package/src/style/designTokensDM.d.ts +69 -0
- package/src/style/dividers.d.ts +11 -0
- package/src/style/index.d.ts +13 -0
- package/src/style/scheme.d.ts +57 -0
- package/src/style/shadows.d.ts +223 -0
- package/src/style/spacings.d.ts +32 -0
- package/src/style/themeManager.d.ts +22 -0
- package/src/style/typography.d.ts +26 -0
- package/src/style/typographyPresets.d.ts +7 -0
- package/src/testkit/Component.driver.d.ts +30 -0
- package/src/testkit/DriverException.d.ts +12 -0
- package/src/testkit/UniDriver.d.ts +29 -0
- package/src/testkit/drivers/TestingLibraryDriver.d.ts +26 -0
- package/src/testkit/index.d.ts +25 -0
- package/src/testkit/new/Component.driver.d.ts +16 -0
- package/src/testkit/new/useDraggable.driver.d.ts +15 -0
- package/src/testkit/new/usePressable.driver.d.ts +14 -0
- package/src/testkit/new/useScrollable.driver.d.ts +13 -0
- package/src/typings/assets.d.ts +52 -0
- package/src/typings/common.d.ts +12 -0
- package/src/typings/module.d.ts +13 -0
- package/src/typings/recorderTypes.d.ts +13 -0
- package/src/uilib-test-renderer/helper.d.ts +8 -0
- package/src/uilib-test-renderer/index.d.ts +4 -0
- package/src/uilib-test-renderer/scrollViewHelper.d.ts +9 -0
- package/src/utils/dateUtils.d.ts +2 -0
- package/src/utils/imageUtils.d.ts +5 -0
- package/src/utils/index.d.ts +4 -0
- package/src/utils/styleUtils.d.ts +7 -0
- package/src/utils/textUtils.d.ts +8 -0
- package/jestSetup/jest-setup.js +0 -154
- package/lib/components/DynamicFonts/FontDownloader.d.js +0 -1
- package/lib/components/DynamicFonts/FontLoader.d.js +0 -1
- package/lib/components/DynamicFonts/NoPermissionsAcquirer.d.js +0 -1
- package/lib/components/DynamicFonts/PermissionsAcquirer.android.d.js +0 -1
- package/lib/components/DynamicFonts/PermissionsAcquirer.ios.d.js +0 -2
- package/lib/components/DynamicFonts/PermissionsAcquirer.web.d.js +0 -2
- package/lib/components/DynamicFonts/RNFSPackage.d.js +0 -1
- package/lib/components/DynamicFonts/index.d.js +0 -3
- package/lib/components/HighlighterOverlayView/index.d.js +0 -1
- package/lib/components/HighlighterOverlayView/index.web.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.d.js +0 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.ios.d.js +0 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardViewBase.d.js +0 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/index.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/index.web.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/index.d.js +0 -5
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/TextInputKeyboardManager/TextInputKeyboardManager.android.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/TextInputKeyboardManager/index.d.js +0 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/index.d.js +0 -7
- package/lib/components/Keyboard/KeyboardAwareInsetsView/index.d.js +0 -1
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.android.d.js +0 -1
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.d.js +0 -10
- package/lib/components/Keyboard/KeyboardTrackingView/index.d.js +0 -1
- package/lib/components/Keyboard/KeyboardTrackingView/index.web.d.js +0 -1
- package/lib/components/Keyboard/index.d.js +0 -4
- package/lib/components/SafeArea/SafeAreaInsetsManager.d.js +0 -1
- package/lib/components/SafeArea/SafeAreaSpacerView.d.js +0 -1
- package/lib/components/SafeArea/SafeAreaSpacerView.web.d.js +0 -1
- package/lib/components/SafeArea/index.d.js +0 -1
- package/lib/components/index.d.js +0 -6
- package/lib/scripts/releaseNative.js +0 -72
- package/lib/specs/HighlighterViewNativeComponent.d.js +0 -1
- package/lib/specs/HighlighterViewNativeComponent.js +0 -8
- package/lib/specs/KeyboardTrackingViewNativeComponent.d.js +0 -1
- package/lib/specs/KeyboardTrackingViewNativeComponent.js +0 -8
- package/scripts/build/.babelrc.exports.js +0 -6
- package/scripts/build/build.js +0 -35
- package/scripts/build/buildPackages/buildComponentsPackages.js +0 -18
- package/scripts/build/buildPackages/buildCustomPackages.js +0 -106
- package/scripts/build/buildPackages/index.js +0 -6
- package/scripts/createCalendarMockData.js +0 -37
- package/scripts/docs/buildDocs.js +0 -1
- package/scripts/prepush.js +0 -71
- package/scripts/release/prReleaseNotes.js +0 -6
- package/scripts/release/release.js +0 -99
- package/scripts/updateWebAssets.js +0 -88
- package/scripts/utils.js +0 -21
- package/src/assets/__tests__/Assets.spec.js +0 -110
- package/src/commons/__tests__/baseComponent.spec.js +0 -36
- package/src/commons/__tests__/constants.spec.js +0 -202
- package/src/commons/__tests__/modifiers.spec.js +0 -453
- package/src/components/WheelPicker/__tests__/index.spec.js +0 -121
- package/src/components/WheelPicker/__tests__/useListMiddleIndex.spec.js +0 -40
- package/src/components/WheelPicker/__tests__/usePresenter.spec.js +0 -87
- package/src/components/avatar/__tests__/index.spec.js +0 -25
- package/src/components/badge/__tests__/index.spec.js +0 -84
- package/src/components/button/__tests__/index.driver.spec.js +0 -209
- package/src/components/button/__tests__/index.spec.js +0 -287
- package/src/components/card/__tests__/CardPresenter.spec.js +0 -35
- package/src/components/carousel/__tests__/CarouselPresenter.spec.js +0 -52
- package/src/components/carousel/__tests__/index.spec.js +0 -89
- package/src/components/checkbox/__tests__/index.spec.js +0 -357
- package/src/components/chip/__tests__/index.spec.js +0 -63
- package/src/components/connectionStatusBar/__tests__/index.spec.js +0 -41
- package/src/components/dateTimePicker/__tests__/index.spec.js +0 -44
- package/src/components/dialog/__tests__/index.new.spec.js +0 -118
- package/src/components/featureHighlight/__tests__/index.spec.js +0 -76
- package/src/components/floatingButton/__tests__/index.spec.js +0 -229
- package/src/components/hint/__tests__/index.spec.js +0 -108
- package/src/components/image/__tests__/index.spec.js +0 -56
- package/src/components/maskedInput/__tests__/maskedInput.new.spec.js +0 -19
- package/src/components/maskedInput/__tests__/maskedInput.old.spec.js +0 -20
- package/src/components/modal/__tests__/index.spec.js +0 -58
- package/src/components/numberInput/__tests__/Presenter.spec.js +0 -374
- package/src/components/numberInput/__tests__/index.spec.js +0 -38
- package/src/components/panView/__tests__/panningUtil.spec.js +0 -693
- package/src/components/picker/__tests__/PickerPresenter.spec.js +0 -15
- package/src/components/picker/__tests__/index.spec.js +0 -364
- package/src/components/picker/helpers/__tests__/usePickerLabel.spec.js +0 -96
- package/src/components/radioButton/__tests__/index.spec.js +0 -43
- package/src/components/radioGroup/__tests__/index.spec.js +0 -96
- package/src/components/sectionsWheelPicker/__tests__/index.spec.js +0 -35
- package/src/components/sectionsWheelPicker/__tests__/mockSections.js +0 -28
- package/src/components/segmentedControl/__tests__/index.spec.js +0 -25
- package/src/components/slider/__tests__/index.spec.js +0 -35
- package/src/components/sortableGridList/__tests__/index.spec.js +0 -51
- package/src/components/sortableGridList/__tests__/usePresenter.spec.js +0 -231
- package/src/components/sortableList/__tests__/index.spec.js +0 -105
- package/src/components/switch/__tests__/index.spec.js +0 -96
- package/src/components/text/__tests__/index.driver.spec.js +0 -124
- package/src/components/text/__tests__/index.spec.js +0 -245
- package/src/components/textField/__tests__/Presenter.spec.js +0 -240
- package/src/components/textField/__tests__/index.driver.spec.js +0 -639
- package/src/components/timeline/__tests__/driver.index.spec.js +0 -133
- package/src/helpers/__tests__/AvatarHelper.spec.js +0 -170
- package/src/hooks/useDidUpdate/__tests__/useDidUpdate.spec.js +0 -80
- package/src/hooks/useOrientation/__tests__/useOrientation.spec.js +0 -70
- package/src/hooks/useToggleValue/__tests__/useToggleValue.spec.js +0 -89
- package/src/incubator/calendar/__tests__/DateUtils.spec.js +0 -367
- package/src/incubator/expandableOverlay/__tests__/index.spec.js +0 -114
- package/src/incubator/gradient/__tests__/useAngleTransform.spec.js +0 -126
- package/src/incubator/slider/__tests__/SliderPresenter.spec.js +0 -43
- package/src/incubator/slider/__tests__/index.spec.js +0 -34
- package/src/incubator/toast/__tests__/index.spec.js +0 -64
- package/src/style/__tests__/colors.spec.js +0 -313
- package/src/style/__tests__/scheme.spec.js +0 -119
- package/src/utils/__tests__/Playground.perf.js +0 -14
- package/src/utils/__tests__/imageUtils.spec.js +0 -54
- package/src/utils/__tests__/textUtils.spec.js +0 -446
|
@@ -0,0 +1,827 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardTrackingViewTempManager.m
|
|
3
|
+
// ReactNativeChat
|
|
4
|
+
//
|
|
5
|
+
// Created by Artal Druk on 19/04/2016.
|
|
6
|
+
// Copyright © 2016 Wix.com All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "KeyboardTrackingViewTempManager.h"
|
|
10
|
+
#import "ObservingInputAccessoryViewTemp.h"
|
|
11
|
+
#import "UIResponder+FirstResponderTemp.h"
|
|
12
|
+
|
|
13
|
+
#import <WebKit/WebKit.h>
|
|
14
|
+
|
|
15
|
+
#import <React/RCTBridge.h>
|
|
16
|
+
#import <React/RCTUIManager.h>
|
|
17
|
+
#import <React/UIView+React.h>
|
|
18
|
+
#import <React/RCTUIManagerUtils.h>
|
|
19
|
+
#import <React/RCTSurfaceHostingView.h>
|
|
20
|
+
|
|
21
|
+
#import <objc/runtime.h>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
NSUInteger const kInputViewKeyTemp = 101010;
|
|
25
|
+
NSUInteger const kMaxDeferedInitializeAccessoryViewsTemp = 15;
|
|
26
|
+
NSInteger const kTrackingViewNotFoundErrorCodeTemp = 1;
|
|
27
|
+
NSInteger const kBottomViewHeightTemp = 100;
|
|
28
|
+
|
|
29
|
+
typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
|
|
30
|
+
KeyboardTrackingScrollBehaviorNone,
|
|
31
|
+
KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly,
|
|
32
|
+
KeyboardTrackingScrollBehaviorFixedOffset
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
@interface KeyboardTrackingViewTemp : UIView
|
|
36
|
+
{
|
|
37
|
+
Class _newClass;
|
|
38
|
+
NSMapTable *_inputViewsMap;
|
|
39
|
+
ObservingInputAccessoryViewTemp *_ObservingInputAccessoryViewTemp;
|
|
40
|
+
UIView *_bottomView;
|
|
41
|
+
CGFloat _bottomViewHeight;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@property (nonatomic, strong) UIScrollView *scrollViewToManage;
|
|
45
|
+
@property (nonatomic) BOOL scrollIsInverted;
|
|
46
|
+
@property (nonatomic) BOOL revealKeyboardInteractive;
|
|
47
|
+
@property (nonatomic) BOOL isDraggingScrollView;
|
|
48
|
+
@property (nonatomic) BOOL manageScrollView;
|
|
49
|
+
@property (nonatomic) BOOL requiresSameParentToManageScrollView;
|
|
50
|
+
@property (nonatomic) NSUInteger deferedInitializeAccessoryViewsCount;
|
|
51
|
+
@property (nonatomic) CGFloat originalHeight;
|
|
52
|
+
@property (nonatomic) KeyboardTrackingScrollBehavior scrollBehavior;
|
|
53
|
+
@property (nonatomic) BOOL addBottomView;
|
|
54
|
+
@property (nonatomic, strong) UIColor *bottomViewColor;
|
|
55
|
+
@property (nonatomic) BOOL useSafeArea;
|
|
56
|
+
@property (nonatomic) BOOL usesBottomTabs;
|
|
57
|
+
@property (nonatomic) BOOL scrollToFocusedInput;
|
|
58
|
+
@property (nonatomic) BOOL allowHitsOutsideBounds;
|
|
59
|
+
|
|
60
|
+
@end
|
|
61
|
+
|
|
62
|
+
@interface KeyboardTrackingViewTemp () <ObservingInputAccessoryViewTempDelegate, UIScrollViewDelegate>
|
|
63
|
+
|
|
64
|
+
@end
|
|
65
|
+
|
|
66
|
+
@implementation KeyboardTrackingViewTemp
|
|
67
|
+
|
|
68
|
+
-(instancetype)init
|
|
69
|
+
{
|
|
70
|
+
self = [super init];
|
|
71
|
+
|
|
72
|
+
if (self)
|
|
73
|
+
{
|
|
74
|
+
[self addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];
|
|
75
|
+
_inputViewsMap = [NSMapTable weakToWeakObjectsMapTable];
|
|
76
|
+
_deferedInitializeAccessoryViewsCount = 0;
|
|
77
|
+
|
|
78
|
+
_ObservingInputAccessoryViewTemp = [ObservingInputAccessoryViewTemp new];
|
|
79
|
+
_ObservingInputAccessoryViewTemp.delegate = self;
|
|
80
|
+
|
|
81
|
+
_manageScrollView = YES;
|
|
82
|
+
_allowHitsOutsideBounds = NO;
|
|
83
|
+
|
|
84
|
+
_bottomViewHeight = kBottomViewHeightTemp;
|
|
85
|
+
|
|
86
|
+
self.addBottomView = NO;
|
|
87
|
+
self.bottomViewColor = [UIColor whiteColor];
|
|
88
|
+
self.scrollToFocusedInput = NO;
|
|
89
|
+
self.usesBottomTabs = NO;
|
|
90
|
+
|
|
91
|
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(rctContentDidAppearNotification:) name:RCTContentDidAppearNotification object:nil];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return self;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
-(UIView*)getRootView
|
|
98
|
+
{
|
|
99
|
+
UIView *view = self;
|
|
100
|
+
while (view.superview != nil)
|
|
101
|
+
{
|
|
102
|
+
view = view.superview;
|
|
103
|
+
if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
|
|
109
|
+
return view;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return nil;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
|
116
|
+
if (!_allowHitsOutsideBounds) {
|
|
117
|
+
return [super hitTest:point withEvent:event];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (self.isHidden || self.alpha == 0 || self.clipsToBounds) {
|
|
121
|
+
return nil;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
UIView *subview = [super hitTest:point withEvent:event];
|
|
125
|
+
if (subview == nil) {
|
|
126
|
+
NSArray<UIView*>* allSubviews = [self getBreadthFirstSubviewsForView:self];
|
|
127
|
+
for (UIView *tmpSubview in allSubviews) {
|
|
128
|
+
CGPoint pointInSubview = [self convertPoint:point toView:tmpSubview];
|
|
129
|
+
if ([tmpSubview pointInside:pointInSubview withEvent:event]) {
|
|
130
|
+
subview = tmpSubview;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return subview;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
-(void)_swizzleWebViewInputAccessory:(WKWebView*)webview
|
|
140
|
+
{
|
|
141
|
+
UIView* subview;
|
|
142
|
+
for (UIView* view in webview.scrollView.subviews)
|
|
143
|
+
{
|
|
144
|
+
if([[view.class description] hasPrefix:@"UIWeb"])
|
|
145
|
+
{
|
|
146
|
+
subview = view;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if(_newClass == nil)
|
|
151
|
+
{
|
|
152
|
+
NSString* name = [NSString stringWithFormat:@"%@_Tracking_%p", subview.class, self];
|
|
153
|
+
_newClass = NSClassFromString(name);
|
|
154
|
+
|
|
155
|
+
_newClass = objc_allocateClassPair(subview.class, [name cStringUsingEncoding:NSASCIIStringEncoding], 0);
|
|
156
|
+
if(!_newClass) return;
|
|
157
|
+
|
|
158
|
+
Method method = class_getInstanceMethod([UIResponder class], @selector(inputAccessoryView));
|
|
159
|
+
class_addMethod(_newClass, @selector(inputAccessoryView), imp_implementationWithBlock(^(id _self){return _ObservingInputAccessoryViewTemp;}), method_getTypeEncoding(method));
|
|
160
|
+
|
|
161
|
+
objc_registerClassPair(_newClass);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
object_setClass(subview, _newClass);
|
|
165
|
+
[subview reloadInputViews];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
-(void)layoutSubviews
|
|
169
|
+
{
|
|
170
|
+
[super layoutSubviews];
|
|
171
|
+
|
|
172
|
+
// Preserving the AccessoryView's Y position within its superview
|
|
173
|
+
CGFloat bottomSafeArea = [self getBottomSafeArea];
|
|
174
|
+
CGFloat tabBarHeight = [self getTabBarHeight];
|
|
175
|
+
CGFloat yOffset = MIN(-bottomSafeArea, -_ObservingInputAccessoryViewTemp.keyboardHeight + tabBarHeight);
|
|
176
|
+
|
|
177
|
+
if (self.frame.origin.y != yOffset) {
|
|
178
|
+
[self removeObserver:self forKeyPath:@"frame"];
|
|
179
|
+
self.frame = CGRectMake(self.frame.origin.x,
|
|
180
|
+
yOffset,
|
|
181
|
+
self.frame.size.width,
|
|
182
|
+
self.frame.size.height);
|
|
183
|
+
[self addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:NULL];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
[self updateBottomViewFrame];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
- (UIScrollView*)extractUIScrollView:(UIView*)view
|
|
190
|
+
{
|
|
191
|
+
for (UIView* subview in view.subviews) {
|
|
192
|
+
if ([subview isKindOfClass:[UIScrollView class]]) {
|
|
193
|
+
return (UIScrollView*)subview;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return nil;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
- (void)initializeAccessoryViewsAndHandleInsets
|
|
201
|
+
{
|
|
202
|
+
NSArray<UIView*>* allSubviews = [self getBreadthFirstSubviewsForView:[self getRootView]];
|
|
203
|
+
|
|
204
|
+
for (UIView* subview in allSubviews)
|
|
205
|
+
{
|
|
206
|
+
if(_manageScrollView)
|
|
207
|
+
{
|
|
208
|
+
if(_scrollViewToManage == nil)
|
|
209
|
+
{
|
|
210
|
+
if ([NSStringFromClass([subview class]) isEqualToString:@"RCTScrollViewComponentView"] &&
|
|
211
|
+
subview.superview != self) {
|
|
212
|
+
|
|
213
|
+
UIScrollView *scrollView = [self extractUIScrollView:subview];
|
|
214
|
+
|
|
215
|
+
if ([scrollView isKindOfClass:[UIScrollView class]])
|
|
216
|
+
{
|
|
217
|
+
if(_requiresSameParentToManageScrollView && subview.superview == self.superview)
|
|
218
|
+
{
|
|
219
|
+
_scrollViewToManage = scrollView;
|
|
220
|
+
}
|
|
221
|
+
else if(!_requiresSameParentToManageScrollView)
|
|
222
|
+
{
|
|
223
|
+
_scrollViewToManage = scrollView;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if(_scrollViewToManage != nil)
|
|
227
|
+
{
|
|
228
|
+
_scrollIsInverted = CGAffineTransformEqualToTransform(subview.superview.transform, CGAffineTransformMakeScale(1, -1));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
if ([subview isKindOfClass:NSClassFromString(@"RCTTextField")])
|
|
237
|
+
{
|
|
238
|
+
UITextField *textField = nil;
|
|
239
|
+
Ivar backedTextInputIvar = class_getInstanceVariable([subview class], "_backedTextInput");
|
|
240
|
+
if (backedTextInputIvar != NULL)
|
|
241
|
+
{
|
|
242
|
+
textField = [subview valueForKey:@"_backedTextInput"];
|
|
243
|
+
}
|
|
244
|
+
else if([subview isKindOfClass:[UITextField class]])
|
|
245
|
+
{
|
|
246
|
+
textField = (UITextField*)subview;
|
|
247
|
+
}
|
|
248
|
+
[self setupTextField:textField];
|
|
249
|
+
}
|
|
250
|
+
else if ([subview isKindOfClass:NSClassFromString(@"RCTUITextField")] && [subview isKindOfClass:[UITextField class]])
|
|
251
|
+
{
|
|
252
|
+
[self setupTextField:(UITextField*)subview];
|
|
253
|
+
}
|
|
254
|
+
else if ([subview isKindOfClass:NSClassFromString(@"RCTMultilineTextInputView")])
|
|
255
|
+
{
|
|
256
|
+
[self setupTextView:[subview valueForKey:@"_backedTextInputView"]];
|
|
257
|
+
}
|
|
258
|
+
else if ([subview isKindOfClass:NSClassFromString(@"RCTTextView")] ||
|
|
259
|
+
[subview isKindOfClass:NSClassFromString(@"RCTTextInputComponentView")])
|
|
260
|
+
{
|
|
261
|
+
|
|
262
|
+
UITextView *textView = nil;
|
|
263
|
+
|
|
264
|
+
if ([subview isKindOfClass:NSClassFromString(@"RCTTextInputComponentView")]) {
|
|
265
|
+
Ivar textFieldIvar = class_getInstanceVariable([subview class], "_backedTextInputView");
|
|
266
|
+
if (textFieldIvar != NULL)
|
|
267
|
+
{
|
|
268
|
+
textView = [subview valueForKey:@"_backedTextInputView"];
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
} else {
|
|
272
|
+
|
|
273
|
+
Ivar backedTextInputIvar = class_getInstanceVariable([subview class], "_backedTextInput");
|
|
274
|
+
if (backedTextInputIvar != NULL)
|
|
275
|
+
{
|
|
276
|
+
textView = [subview valueForKey:@"_backedTextInput"];
|
|
277
|
+
}
|
|
278
|
+
else if([subview isKindOfClass:[UITextView class]])
|
|
279
|
+
{
|
|
280
|
+
textView = (UITextView*)subview;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
[self setupTextView:textView];
|
|
284
|
+
}
|
|
285
|
+
else if ([subview isKindOfClass:NSClassFromString(@"RCTUITextView")] && [subview isKindOfClass:[UITextView class]])
|
|
286
|
+
{
|
|
287
|
+
[self setupTextView:(UITextView*)subview];
|
|
288
|
+
}
|
|
289
|
+
else if ([subview isKindOfClass:[WKWebView class]])
|
|
290
|
+
{
|
|
291
|
+
[self _swizzleWebViewInputAccessory:(WKWebView*)subview];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if(_scrollViewToManage != nil)
|
|
296
|
+
{
|
|
297
|
+
if(_scrollViewToManage.delegate == nil)
|
|
298
|
+
{
|
|
299
|
+
_scrollViewToManage.delegate = self;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
|
|
304
|
+
if (@available(iOS 11.0, *)) {
|
|
305
|
+
if (_scrollViewToManage != nil) {
|
|
306
|
+
_scrollViewToManage.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
#endif
|
|
310
|
+
|
|
311
|
+
[self _updateScrollViewInsets];
|
|
312
|
+
|
|
313
|
+
_originalHeight = _ObservingInputAccessoryViewTemp.height;
|
|
314
|
+
|
|
315
|
+
[self addBottomViewIfNecessary];
|
|
316
|
+
|
|
317
|
+
[self ensureLegacyViewManagerTouchDelegation];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
- (void)setupTextView:(UITextView*)textView
|
|
321
|
+
{
|
|
322
|
+
if (textView != nil)
|
|
323
|
+
{
|
|
324
|
+
[textView setInputAccessoryView:_ObservingInputAccessoryViewTemp];
|
|
325
|
+
[textView reloadInputViews];
|
|
326
|
+
[_inputViewsMap setObject:textView forKey:@(kInputViewKeyTemp)];
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
- (void)setupTextField:(UITextField*)textField
|
|
331
|
+
{
|
|
332
|
+
if (textField != nil)
|
|
333
|
+
{
|
|
334
|
+
[textField setInputAccessoryView:_ObservingInputAccessoryViewTemp];
|
|
335
|
+
[textField reloadInputViews];
|
|
336
|
+
[_inputViewsMap setObject:textField forKey:@(kInputViewKeyTemp)];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
-(void) deferedInitializeAccessoryViewsAndHandleInsets
|
|
341
|
+
{
|
|
342
|
+
if(self.window == nil)
|
|
343
|
+
{
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (_ObservingInputAccessoryViewTemp.height == 0 && self.deferedInitializeAccessoryViewsCount < kMaxDeferedInitializeAccessoryViewsTemp)
|
|
348
|
+
{
|
|
349
|
+
self.deferedInitializeAccessoryViewsCount++;
|
|
350
|
+
|
|
351
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
352
|
+
[self deferedInitializeAccessoryViewsAndHandleInsets];
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
else
|
|
356
|
+
{
|
|
357
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
358
|
+
[self initializeAccessoryViewsAndHandleInsets];
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
- (void)willMoveToWindow:(nullable UIWindow *)newWindow
|
|
364
|
+
{
|
|
365
|
+
if (newWindow == nil && [ObservingInputAccessoryViewTempManager sharedInstance].activeObservingInputAccessoryViewTemp == _ObservingInputAccessoryViewTemp)
|
|
366
|
+
{
|
|
367
|
+
[ObservingInputAccessoryViewTempManager sharedInstance].activeObservingInputAccessoryViewTemp = nil;
|
|
368
|
+
}
|
|
369
|
+
else if (newWindow != nil)
|
|
370
|
+
{
|
|
371
|
+
[ObservingInputAccessoryViewTempManager sharedInstance].activeObservingInputAccessoryViewTemp = _ObservingInputAccessoryViewTemp;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
-(void)didMoveToWindow
|
|
376
|
+
{
|
|
377
|
+
[super didMoveToWindow];
|
|
378
|
+
|
|
379
|
+
self.deferedInitializeAccessoryViewsCount = 0;
|
|
380
|
+
|
|
381
|
+
[self deferedInitializeAccessoryViewsAndHandleInsets];
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
-(void)dealloc
|
|
385
|
+
{
|
|
386
|
+
[self removeObserver:self forKeyPath:@"frame"];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
|
|
390
|
+
{
|
|
391
|
+
_ObservingInputAccessoryViewTemp.height = self.frame.size.height;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
- (void)ObservingInputAccessoryViewTempKeyboardWillDisappear:(ObservingInputAccessoryViewTemp *)ObservingInputAccessoryViewTemp
|
|
395
|
+
{
|
|
396
|
+
_bottomViewHeight = kBottomViewHeightTemp;
|
|
397
|
+
[self updateBottomViewFrame];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
- (NSArray*)getBreadthFirstSubviewsForView:(UIView*)view
|
|
401
|
+
{
|
|
402
|
+
if(view == nil)
|
|
403
|
+
{
|
|
404
|
+
return nil;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
NSMutableArray *allSubviews = [NSMutableArray new];
|
|
408
|
+
NSMutableArray *queue = [NSMutableArray new];
|
|
409
|
+
|
|
410
|
+
[allSubviews addObject:view];
|
|
411
|
+
[queue addObject:view];
|
|
412
|
+
|
|
413
|
+
while ([queue count] > 0) {
|
|
414
|
+
UIView *current = [queue lastObject];
|
|
415
|
+
[queue removeLastObject];
|
|
416
|
+
|
|
417
|
+
for (UIView *n in current.subviews)
|
|
418
|
+
{
|
|
419
|
+
[allSubviews addObject:n];
|
|
420
|
+
[queue insertObject:n atIndex:0];
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return allSubviews;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
- (NSArray*)getAllReactSubviewsForView:(UIView*)view
|
|
427
|
+
{
|
|
428
|
+
NSMutableArray *allSubviews = [NSMutableArray new];
|
|
429
|
+
for (UIView *subview in view.reactSubviews)
|
|
430
|
+
{
|
|
431
|
+
[allSubviews addObject:subview];
|
|
432
|
+
[allSubviews addObjectsFromArray:[self getAllReactSubviewsForView:subview]];
|
|
433
|
+
}
|
|
434
|
+
return allSubviews;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
- (void)_updateScrollViewInsets
|
|
438
|
+
{
|
|
439
|
+
if(self.scrollViewToManage != nil)
|
|
440
|
+
{
|
|
441
|
+
UIEdgeInsets insets = self.scrollViewToManage.contentInset;
|
|
442
|
+
CGFloat bottomSafeArea = [self getBottomSafeArea];
|
|
443
|
+
CGFloat bottomInset = MAX(self.bounds.size.height, _ObservingInputAccessoryViewTemp.keyboardHeight + _ObservingInputAccessoryViewTemp.height);
|
|
444
|
+
|
|
445
|
+
CGFloat originalBottomInset = self.scrollIsInverted ? insets.top : insets.bottom;
|
|
446
|
+
CGPoint originalOffset = self.scrollViewToManage.contentOffset;
|
|
447
|
+
|
|
448
|
+
bottomInset += (_ObservingInputAccessoryViewTemp.keyboardHeight == 0 ? bottomSafeArea : 0);
|
|
449
|
+
|
|
450
|
+
if(self.scrollIsInverted)
|
|
451
|
+
{
|
|
452
|
+
insets.top = bottomInset;
|
|
453
|
+
}
|
|
454
|
+
else
|
|
455
|
+
{
|
|
456
|
+
insets.bottom = bottomInset;
|
|
457
|
+
}
|
|
458
|
+
self.scrollViewToManage.contentInset = insets;
|
|
459
|
+
|
|
460
|
+
if(self.scrollBehavior == KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly && _scrollIsInverted)
|
|
461
|
+
{
|
|
462
|
+
BOOL fisrtTime = _ObservingInputAccessoryViewTemp.keyboardHeight == 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateHidden;
|
|
463
|
+
BOOL willOpen = _ObservingInputAccessoryViewTemp.keyboardHeight != 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateHidden;
|
|
464
|
+
BOOL isOpen = _ObservingInputAccessoryViewTemp.keyboardHeight != 0 && _ObservingInputAccessoryViewTemp.keyboardState == KeyboardStateShown;
|
|
465
|
+
if(fisrtTime || willOpen || (isOpen && !self.isDraggingScrollView))
|
|
466
|
+
{
|
|
467
|
+
[self.scrollViewToManage setContentOffset:CGPointMake(self.scrollViewToManage.contentOffset.x, -self.scrollViewToManage.contentInset.top) animated:!fisrtTime];
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
else if(self.scrollBehavior == KeyboardTrackingScrollBehaviorFixedOffset && !self.isDraggingScrollView)
|
|
471
|
+
{
|
|
472
|
+
CGFloat insetsDiff = (bottomInset - originalBottomInset) * (self.scrollIsInverted ? -1 : 1);
|
|
473
|
+
self.scrollViewToManage.contentOffset = CGPointMake(originalOffset.x, originalOffset.y + insetsDiff);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
insets = self.scrollViewToManage.contentInset;
|
|
477
|
+
if(self.scrollIsInverted)
|
|
478
|
+
{
|
|
479
|
+
insets.top = bottomInset;
|
|
480
|
+
}
|
|
481
|
+
else
|
|
482
|
+
{
|
|
483
|
+
insets.bottom = bottomInset;
|
|
484
|
+
}
|
|
485
|
+
self.scrollViewToManage.scrollIndicatorInsets = insets;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
#pragma mark - bottom view
|
|
490
|
+
|
|
491
|
+
-(void)setAddBottomView:(BOOL)addBottomView
|
|
492
|
+
{
|
|
493
|
+
_addBottomView = addBottomView;
|
|
494
|
+
|
|
495
|
+
[self addBottomViewIfNecessary];
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
-(void)setBottomViewColor:(UIColor *)bottomViewColor
|
|
499
|
+
{
|
|
500
|
+
_bottomViewColor = bottomViewColor;
|
|
501
|
+
|
|
502
|
+
if (self.addBottomView && _bottomView != nil) {
|
|
503
|
+
_bottomView.backgroundColor = _bottomViewColor;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
-(void)addBottomViewIfNecessary
|
|
508
|
+
{
|
|
509
|
+
if (self.addBottomView && _bottomView == nil)
|
|
510
|
+
{
|
|
511
|
+
_bottomView = [UIView new];
|
|
512
|
+
_bottomView.backgroundColor = self.bottomViewColor;
|
|
513
|
+
|
|
514
|
+
[self addSubview:_bottomView];
|
|
515
|
+
[self updateBottomViewFrame];
|
|
516
|
+
}
|
|
517
|
+
else if (!self.addBottomView && _bottomView != nil)
|
|
518
|
+
{
|
|
519
|
+
[_bottomView removeFromSuperview];
|
|
520
|
+
_bottomView = nil;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
-(void)updateBottomViewFrame
|
|
525
|
+
{
|
|
526
|
+
if (_bottomView != nil)
|
|
527
|
+
{
|
|
528
|
+
_bottomView.frame = CGRectMake(0, self.frame.size.height, self.frame.size.width, _bottomViewHeight);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
#pragma mark - safe area
|
|
533
|
+
|
|
534
|
+
-(void)safeAreaInsetsDidChange
|
|
535
|
+
{
|
|
536
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
|
|
537
|
+
if (@available(iOS 11.0, *)) {
|
|
538
|
+
[super safeAreaInsetsDidChange];
|
|
539
|
+
}
|
|
540
|
+
#endif
|
|
541
|
+
[self updateTransformAndInsets];
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
-(CGFloat)getBottomSafeArea
|
|
545
|
+
{
|
|
546
|
+
CGFloat bottomSafeArea = 0;
|
|
547
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
|
|
548
|
+
if (@available(iOS 11.0, *) && self.useSafeArea) {
|
|
549
|
+
bottomSafeArea = self.superview ? self.superview.safeAreaInsets.bottom : self.safeAreaInsets.bottom;
|
|
550
|
+
}
|
|
551
|
+
#endif
|
|
552
|
+
return bottomSafeArea;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
#pragma RCTRootView notifications
|
|
556
|
+
|
|
557
|
+
- (void) rctContentDidAppearNotification:(NSNotification*)notification
|
|
558
|
+
{
|
|
559
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
560
|
+
if(notification.object == [self getRootView] && _manageScrollView && _scrollViewToManage == nil)
|
|
561
|
+
{
|
|
562
|
+
[self initializeAccessoryViewsAndHandleInsets];
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
#pragma mark - TabBarController
|
|
568
|
+
|
|
569
|
+
-(CGFloat)getTabBarHeight
|
|
570
|
+
{
|
|
571
|
+
if (@available(iOS 11.0, *)) {
|
|
572
|
+
if (self.usesBottomTabs == YES)
|
|
573
|
+
{
|
|
574
|
+
UITabBarController *tabBarController = [UITabBarController new];
|
|
575
|
+
CGFloat tabBarHeight = tabBarController.tabBar.frame.size.height;
|
|
576
|
+
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
|
|
577
|
+
CGFloat bottomPadding = window.safeAreaInsets.bottom;
|
|
578
|
+
return tabBarHeight + bottomPadding;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return 0;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
#pragma mark - ObservingInputAccessoryViewTempDelegate methods
|
|
585
|
+
|
|
586
|
+
-(void)updateTransformAndInsets
|
|
587
|
+
{
|
|
588
|
+
CGFloat bottomSafeArea = [self getBottomSafeArea];
|
|
589
|
+
CGFloat tabBarHeight = [self getTabBarHeight];
|
|
590
|
+
CGFloat accessoryTranslation = MIN(-bottomSafeArea, -_ObservingInputAccessoryViewTemp.keyboardHeight + tabBarHeight);
|
|
591
|
+
|
|
592
|
+
if (_ObservingInputAccessoryViewTemp.keyboardHeight <= bottomSafeArea) {
|
|
593
|
+
_bottomViewHeight = kBottomViewHeightTemp;
|
|
594
|
+
} else if (_ObservingInputAccessoryViewTemp.keyboardState != KeyboardStateWillHide) {
|
|
595
|
+
_bottomViewHeight = 0;
|
|
596
|
+
}
|
|
597
|
+
[self updateBottomViewFrame];
|
|
598
|
+
|
|
599
|
+
CGAffineTransform oldTransform = self.transform;
|
|
600
|
+
CGAffineTransform newTransform = CGAffineTransformMakeTranslation(0, accessoryTranslation);
|
|
601
|
+
if (oldTransform.tx != newTransform.tx || oldTransform.ty != newTransform.ty) {
|
|
602
|
+
self.transform = CGAffineTransformMakeTranslation(0, accessoryTranslation);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
[self _updateScrollViewInsets];
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
- (void)ensureLegacyViewManagerTouchDelegation {
|
|
609
|
+
UIView *superview = self.superview;
|
|
610
|
+
if (superview) {
|
|
611
|
+
if ([NSStringFromClass([superview class]) isEqualToString:@"RCTLegacyViewManagerInteropComponentView"]) {
|
|
612
|
+
[self changeLegacyViewManagerHitTestDelegation:superview];
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
- (void)changeLegacyViewManagerHitTestDelegation:(UIView *)wrapperView {
|
|
618
|
+
static dispatch_once_t onceToken;
|
|
619
|
+
static IMP originalHitTestIMP = NULL;
|
|
620
|
+
|
|
621
|
+
dispatch_once(&onceToken, ^{
|
|
622
|
+
Class wrapperClass = [wrapperView class];
|
|
623
|
+
|
|
624
|
+
Method originalMethod = class_getInstanceMethod(wrapperClass, @selector(hitTest:withEvent:));
|
|
625
|
+
if (originalMethod) {
|
|
626
|
+
originalHitTestIMP = method_getImplementation(originalMethod);
|
|
627
|
+
|
|
628
|
+
IMP customHitTest = imp_implementationWithBlock(^UIView*(id self, CGPoint point, UIEvent *event) {
|
|
629
|
+
UIView *subview = [self subviews].firstObject;
|
|
630
|
+
if (subview &&
|
|
631
|
+
[subview isKindOfClass:[KeyboardTrackingViewTemp class]]) {
|
|
632
|
+
CGPoint convertedPoint = [self convertPoint:point toView:subview];
|
|
633
|
+
UIView *result = [subview hitTest:convertedPoint withEvent:event];
|
|
634
|
+
return result;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
UIView* (*originalFunc)(id, SEL, CGPoint, UIEvent*) = (void*)originalHitTestIMP;
|
|
638
|
+
return originalFunc(self, @selector(hitTest:withEvent:), point, event);
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
method_setImplementation(originalMethod, customHitTest);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
- (void)performScrollToFocusedInput
|
|
647
|
+
{
|
|
648
|
+
if (_scrollViewToManage != nil && self.scrollToFocusedInput)
|
|
649
|
+
{
|
|
650
|
+
UIResponder *currentFirstResponder = [UIResponder currentFirstResponder];
|
|
651
|
+
if (currentFirstResponder != nil && [currentFirstResponder isKindOfClass:[UIView class]])
|
|
652
|
+
{
|
|
653
|
+
UIView *reponderView = (UIView*)currentFirstResponder;
|
|
654
|
+
if ([reponderView isDescendantOfView:_scrollViewToManage])
|
|
655
|
+
{
|
|
656
|
+
CGRect frame = [_scrollViewToManage convertRect:reponderView.frame fromView:reponderView];
|
|
657
|
+
frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height + 20);
|
|
658
|
+
[_scrollViewToManage scrollRectToVisible:frame animated:NO];
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
- (void)ObservingInputAccessoryViewTempDidChangeFrame:(ObservingInputAccessoryViewTemp*)ObservingInputAccessoryViewTemp
|
|
665
|
+
{
|
|
666
|
+
[self updateTransformAndInsets];
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
- (void) ObservingInputAccessoryViewTempKeyboardWillAppear:(ObservingInputAccessoryViewTemp *)ObservingInputAccessoryViewTemp keyboardDelta:(CGFloat)delta
|
|
670
|
+
{
|
|
671
|
+
if (ObservingInputAccessoryViewTemp.keyboardHeight > 0) //prevent hiding the bottom view if an external keyboard is in use
|
|
672
|
+
{
|
|
673
|
+
_bottomViewHeight = 0;
|
|
674
|
+
[self updateBottomViewFrame];
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
[self performScrollToFocusedInput];
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
#pragma mark - UIScrollViewDelegate methods
|
|
681
|
+
|
|
682
|
+
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
|
683
|
+
{
|
|
684
|
+
if(_ObservingInputAccessoryViewTemp.keyboardState != KeyboardStateHidden || !self.revealKeyboardInteractive)
|
|
685
|
+
{
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
UIView *inputView = [_inputViewsMap objectForKey:@(kInputViewKeyTemp)];
|
|
690
|
+
if (inputView != nil && scrollView.contentOffset.y * (self.scrollIsInverted ? -1 : 1) > (self.scrollIsInverted ? scrollView.contentInset.top : scrollView.contentInset.bottom) + 50 && ![inputView isFirstResponder])
|
|
691
|
+
{
|
|
692
|
+
for (UIGestureRecognizer *gesture in scrollView.gestureRecognizers)
|
|
693
|
+
{
|
|
694
|
+
if([gesture isKindOfClass:[UIPanGestureRecognizer class]])
|
|
695
|
+
{
|
|
696
|
+
gesture.enabled = NO;
|
|
697
|
+
gesture.enabled = YES;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
[inputView reactFocus];
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
|
706
|
+
{
|
|
707
|
+
self.isDraggingScrollView = YES;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
|
|
711
|
+
{
|
|
712
|
+
self.isDraggingScrollView = NO;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
|
|
716
|
+
{
|
|
717
|
+
self.isDraggingScrollView = NO;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
- (CGFloat)getKeyboardHeight
|
|
721
|
+
{
|
|
722
|
+
return _ObservingInputAccessoryViewTemp ? _ObservingInputAccessoryViewTemp.keyboardHeight : 0;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
-(CGFloat)getScrollViewTopContentInset
|
|
726
|
+
{
|
|
727
|
+
return (self.scrollViewToManage != nil) ? -self.scrollViewToManage.contentInset.top : 0;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
-(void)scrollToStart
|
|
731
|
+
{
|
|
732
|
+
if (self.scrollViewToManage != nil)
|
|
733
|
+
{
|
|
734
|
+
[self.scrollViewToManage setContentOffset:CGPointMake(self.scrollViewToManage.contentOffset.x, -self.scrollViewToManage.contentInset.top) animated:YES];
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
@end
|
|
739
|
+
|
|
740
|
+
@implementation RCTConvert (KeyboardTrackingScrollBehavior)
|
|
741
|
+
RCT_ENUM_CONVERTER(KeyboardTrackingScrollBehavior, (@{ @"KeyboardTrackingScrollBehaviorNone": @(KeyboardTrackingScrollBehaviorNone),
|
|
742
|
+
@"KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly": @(KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly),
|
|
743
|
+
@"KeyboardTrackingScrollBehaviorFixedOffset": @(KeyboardTrackingScrollBehaviorFixedOffset)}),
|
|
744
|
+
KeyboardTrackingScrollBehaviorNone, unsignedIntegerValue)
|
|
745
|
+
@end
|
|
746
|
+
|
|
747
|
+
@implementation KeyboardTrackingViewTempManager
|
|
748
|
+
|
|
749
|
+
@synthesize bridge = _bridge;
|
|
750
|
+
|
|
751
|
+
RCT_EXPORT_MODULE()
|
|
752
|
+
|
|
753
|
+
RCT_REMAP_VIEW_PROPERTY(scrollBehavior, scrollBehavior, KeyboardTrackingScrollBehavior)
|
|
754
|
+
RCT_REMAP_VIEW_PROPERTY(revealKeyboardInteractive, revealKeyboardInteractive, BOOL)
|
|
755
|
+
RCT_REMAP_VIEW_PROPERTY(manageScrollView, manageScrollView, BOOL)
|
|
756
|
+
RCT_REMAP_VIEW_PROPERTY(requiresSameParentToManageScrollView, requiresSameParentToManageScrollView, BOOL)
|
|
757
|
+
RCT_REMAP_VIEW_PROPERTY(addBottomView, addBottomView, BOOL)
|
|
758
|
+
RCT_REMAP_VIEW_PROPERTY(bottomViewColor, bottomViewColor, UIColor)
|
|
759
|
+
RCT_REMAP_VIEW_PROPERTY(useSafeArea, useSafeArea, BOOL)
|
|
760
|
+
RCT_REMAP_VIEW_PROPERTY(usesBottomTabs, usesBottomTabs, BOOL)
|
|
761
|
+
RCT_REMAP_VIEW_PROPERTY(scrollToFocusedInput, scrollToFocusedInput, BOOL)
|
|
762
|
+
RCT_REMAP_VIEW_PROPERTY(allowHitsOutsideBounds, allowHitsOutsideBounds, BOOL)
|
|
763
|
+
|
|
764
|
+
+ (BOOL)requiresMainQueueSetup
|
|
765
|
+
{
|
|
766
|
+
return YES;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
- (NSDictionary<NSString *, id> *)constantsToExport
|
|
770
|
+
{
|
|
771
|
+
return @{
|
|
772
|
+
@"KeyboardTrackingScrollBehaviorNone": @(KeyboardTrackingScrollBehaviorNone),
|
|
773
|
+
@"KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly": @(KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly),
|
|
774
|
+
@"KeyboardTrackingScrollBehaviorFixedOffset": @(KeyboardTrackingScrollBehaviorFixedOffset),
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
- (UIView *)view
|
|
779
|
+
{
|
|
780
|
+
return [[KeyboardTrackingViewTemp alloc] init];
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
RCT_EXPORT_METHOD(getNativeProps:(nonnull NSNumber *)reactTag resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
784
|
+
{
|
|
785
|
+
[self.bridge.uiManager addUIBlock:
|
|
786
|
+
^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, KeyboardTrackingViewTemp *> *viewRegistry) {
|
|
787
|
+
|
|
788
|
+
KeyboardTrackingViewTemp *view = viewRegistry[reactTag];
|
|
789
|
+
if (!view || ![view isKindOfClass:[KeyboardTrackingViewTemp class]]) {
|
|
790
|
+
NSString *errorMessage = [NSString stringWithFormat:@"Error: cannot find KeyboardTrackingViewTemp with tag #%@", reactTag];
|
|
791
|
+
RCTLogError(@"%@", errorMessage);
|
|
792
|
+
[self rejectPromise:reject withErrorMessage:errorMessage errorCode:kTrackingViewNotFoundErrorCodeTemp];
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
resolve(@{@"trackingViewHeight": @(view.bounds.size.height),
|
|
797
|
+
@"keyboardHeight": @([view getKeyboardHeight]),
|
|
798
|
+
@"contentTopInset": @([view getScrollViewTopContentInset])});
|
|
799
|
+
}];
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
RCT_EXPORT_METHOD(scrollToStart:(nonnull NSNumber *)reactTag)
|
|
803
|
+
{
|
|
804
|
+
[self.bridge.uiManager addUIBlock:
|
|
805
|
+
^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, KeyboardTrackingViewTemp *> *viewRegistry) {
|
|
806
|
+
|
|
807
|
+
KeyboardTrackingViewTemp *view = viewRegistry[reactTag];
|
|
808
|
+
if (!view || ![view isKindOfClass:[KeyboardTrackingViewTemp class]]) {
|
|
809
|
+
RCTLogError(@"Error: cannot find KeyboardTrackingViewTemp with tag #%@", reactTag);
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
[view scrollToStart];
|
|
814
|
+
}];
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
#pragma mark - helper methods
|
|
818
|
+
|
|
819
|
+
-(void)rejectPromise:(RCTPromiseRejectBlock)reject withErrorMessage:(NSString*)errorMessage errorCode:(NSInteger)errorCode
|
|
820
|
+
{
|
|
821
|
+
NSString *errorDescription = NSLocalizedString(errorMessage, nil);
|
|
822
|
+
NSError *error = [NSError errorWithDomain:@"com.KeyboardTrackingViewTemp" code:errorCode userInfo:@{NSLocalizedFailureReasonErrorKey: errorDescription}];
|
|
823
|
+
reject([NSString stringWithFormat:@"%ld", (long)errorCode], errorDescription, error);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
@end
|
|
827
|
+
|