react-native-controlled-input 0.13.0 → 0.15.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.
|
@@ -26,10 +26,6 @@ import com.facebook.react.uimanager.UIManagerHelper
|
|
|
26
26
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Keep this class in package `com.controlledinput` with simple name `ControlledInputView`:
|
|
30
|
-
* apps that patch `react-native-keyboard-controller` locate the host via
|
|
31
|
-
* `Class.name == "com.controlledinput.ControlledInputView"` for Compose (non-EditText) focus.
|
|
32
|
-
*
|
|
33
29
|
* RN + Jetpack Compose hosting view aligned with Expo UI / [ExpoComposeView] + [ExpoView]:
|
|
34
30
|
* - [shouldUseAndroidLayout]: requestLayout posts measureAndLayout (RN #17968)
|
|
35
31
|
* - onMeasure skips child [ComposeView] until attached (window + WindowRecomposer)
|
|
@@ -28,15 +28,6 @@ using namespace facebook::react;
|
|
|
28
28
|
return concreteComponentDescriptorProvider<ControlledInputViewComponentDescriptor>();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/// `react-native-keyboard-controller` resolves `UIResponder.reactViewTag` as
|
|
32
|
-
/// `(firstResponder as UIView).superview.tag`. The field's superview is this content view,
|
|
33
|
-
/// so its `tag` must match the Fabric component's react tag or keyboard events disagree
|
|
34
|
-
/// on `target` and `KeyboardAwareScrollView` mis-animates (iOS hide jumps).
|
|
35
|
-
- (void)syncContentViewReactTagFromContainer
|
|
36
|
-
{
|
|
37
|
-
_inputView.tag = self.tag;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
31
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
41
32
|
{
|
|
42
33
|
if (self = [super initWithFrame:frame]) {
|
|
@@ -47,18 +38,11 @@ using namespace facebook::react;
|
|
|
47
38
|
_inputView.delegate = self;
|
|
48
39
|
|
|
49
40
|
self.contentView = _inputView;
|
|
50
|
-
[self syncContentViewReactTagFromContainer];
|
|
51
41
|
}
|
|
52
42
|
|
|
53
43
|
return self;
|
|
54
44
|
}
|
|
55
45
|
|
|
56
|
-
- (void)layoutSubviews
|
|
57
|
-
{
|
|
58
|
-
[super layoutSubviews];
|
|
59
|
-
[self syncContentViewReactTagFromContainer];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
46
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
63
47
|
{
|
|
64
48
|
const auto &oldViewProps = *std::static_pointer_cast<ControlledInputViewProps const>(_props);
|
|
@@ -144,11 +144,23 @@ public class RNControlledInput: UIView, UITextFieldDelegate {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
private func applyFont() {
|
|
147
|
-
|
|
148
|
-
textField.font = font
|
|
149
|
-
} else {
|
|
147
|
+
guard let family = fontFamily else {
|
|
150
148
|
textField.font = UIFont.systemFont(ofSize: fontSize)
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
// UIFont(name:size:) needs the PostScript name. Expo's useFonts keys are aliased via a
|
|
152
|
+
// swizzled UIFont.fontNames(forFamilyName:) — RN Text resolves aliases that way, so we must too.
|
|
153
|
+
if let font = UIFont(name: family, size: fontSize) {
|
|
154
|
+
textField.font = font
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
for face in UIFont.fontNames(forFamilyName: family) {
|
|
158
|
+
if let font = UIFont(name: face, size: fontSize) {
|
|
159
|
+
textField.font = font
|
|
160
|
+
return
|
|
161
|
+
}
|
|
151
162
|
}
|
|
163
|
+
textField.font = UIFont.systemFont(ofSize: fontSize)
|
|
152
164
|
}
|
|
153
165
|
|
|
154
166
|
private func applyAutoComplete() {
|
package/package.json
CHANGED