yeet
This commit is contained in:
99
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/BUCK
generated
vendored
Normal file
99
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/BUCK
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_preprocessor_flags_for_build_mode")
|
||||
load(
|
||||
"//tools/build_defs/oss:rn_defs.bzl",
|
||||
"ANDROID",
|
||||
"APPLE",
|
||||
"CXX",
|
||||
"YOGA_CXX_TARGET",
|
||||
"fb_xplat_cxx_test",
|
||||
"get_apple_compiler_flags",
|
||||
"get_apple_inspector_flags",
|
||||
"react_native_xplat_target",
|
||||
"rn_xplat_cxx_library",
|
||||
"subdir_glob",
|
||||
)
|
||||
|
||||
APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
|
||||
|
||||
rn_xplat_cxx_library(
|
||||
name = "iostextinput",
|
||||
srcs = glob(
|
||||
["**/*.cpp"],
|
||||
exclude = glob(["tests/**/*.cpp"]),
|
||||
),
|
||||
headers = glob(
|
||||
["**/*.h"],
|
||||
exclude = glob(["tests/**/*.h"]),
|
||||
),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
[
|
||||
("", "*.h"),
|
||||
],
|
||||
# TODO(shergin) T26519801 Figure out better directories structure
|
||||
prefix = "react/components/iostextinput",
|
||||
),
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-std=c++14",
|
||||
"-Wall",
|
||||
],
|
||||
cxx_tests = [":tests"],
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
|
||||
fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
|
||||
force_static = True,
|
||||
platforms = (ANDROID, APPLE, CXX),
|
||||
preprocessor_flags = [
|
||||
"-DLOG_TAG=\"ReactNative\"",
|
||||
"-DWITH_FBSYSTRACE=1",
|
||||
],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
"//xplat/fbsystrace:fbsystrace",
|
||||
"//xplat/folly:container_evicting_cache_map",
|
||||
"//xplat/folly:headers_only",
|
||||
"//xplat/folly:memory",
|
||||
"//xplat/folly:molly",
|
||||
"//xplat/third-party/glog:glog",
|
||||
YOGA_CXX_TARGET,
|
||||
react_native_xplat_target("utils:utils"),
|
||||
react_native_xplat_target("fabric/attributedstring:attributedstring"),
|
||||
react_native_xplat_target("fabric/core:core"),
|
||||
react_native_xplat_target("fabric/debug:debug"),
|
||||
react_native_xplat_target("fabric/graphics:graphics"),
|
||||
react_native_xplat_target("fabric/textlayoutmanager:textlayoutmanager"),
|
||||
react_native_xplat_target("fabric/components/text:text"),
|
||||
react_native_xplat_target("fabric/components/view:view"),
|
||||
react_native_xplat_target("fabric/components/image:image"),
|
||||
react_native_xplat_target("fabric/uimanager:uimanager"),
|
||||
react_native_xplat_target("fabric/imagemanager:imagemanager"),
|
||||
],
|
||||
)
|
||||
|
||||
fb_xplat_cxx_test(
|
||||
name = "tests",
|
||||
srcs = glob(["tests/**/*.cpp"]),
|
||||
headers = glob(["tests/**/*.h"]),
|
||||
compiler_flags = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-std=c++14",
|
||||
"-Wall",
|
||||
],
|
||||
contacts = ["oncall+react_native@xmail.facebook.com"],
|
||||
platforms = (
|
||||
# `Apple` and `Android` flavors are disabled because the module depends on `textlayoutmanager` which requires real an Emulator/Simulator to run.
|
||||
# At the same time, the code of tests does not rely on the simulator capabilities and it would be wasteful to add `fbandroid_use_instrumentation_test = True`.
|
||||
# (Beware of this option though.)
|
||||
# ANDROID,
|
||||
# APPLE,
|
||||
CXX
|
||||
),
|
||||
deps = [
|
||||
":iostextinput",
|
||||
"//xplat/folly:molly",
|
||||
"//xplat/third-party/gmock:gtest",
|
||||
],
|
||||
)
|
46
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputComponentDescriptor.h
generated
vendored
Normal file
46
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputComponentDescriptor.h
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/iostextinput/TextInputShadowNode.h>
|
||||
#include <react/core/ConcreteComponentDescriptor.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/*
|
||||
* Descriptor for <TextInput> component.
|
||||
*/
|
||||
class TextInputComponentDescriptor final
|
||||
: public ConcreteComponentDescriptor<TextInputShadowNode> {
|
||||
public:
|
||||
TextInputComponentDescriptor(ComponentDescriptorParameters const ¶meters)
|
||||
: ConcreteComponentDescriptor<TextInputShadowNode>(parameters) {
|
||||
textLayoutManager_ =
|
||||
std::make_shared<TextLayoutManager const>(contextContainer_);
|
||||
}
|
||||
|
||||
protected:
|
||||
void adopt(UnsharedShadowNode shadowNode) const override {
|
||||
ConcreteComponentDescriptor::adopt(shadowNode);
|
||||
|
||||
assert(std::dynamic_pointer_cast<TextInputShadowNode>(shadowNode));
|
||||
auto concreteShadowNode =
|
||||
std::static_pointer_cast<TextInputShadowNode>(shadowNode);
|
||||
|
||||
concreteShadowNode->setTextLayoutManager(textLayoutManager_);
|
||||
concreteShadowNode->dirtyLayout();
|
||||
concreteShadowNode->enableMeasurement();
|
||||
}
|
||||
|
||||
private:
|
||||
TextLayoutManager::Shared textLayoutManager_;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
126
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.cpp
generated
vendored
Normal file
126
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.cpp
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "TextInputEventEmitter.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
static jsi::Value textInputMetricsPayload(
|
||||
jsi::Runtime &runtime,
|
||||
TextInputMetrics const &textInputMetrics) {
|
||||
auto payload = jsi::Object(runtime);
|
||||
|
||||
payload.setProperty(
|
||||
runtime,
|
||||
"text",
|
||||
jsi::String::createFromUtf8(runtime, textInputMetrics.text));
|
||||
|
||||
payload.setProperty(runtime, "eventCount", textInputMetrics.eventCount);
|
||||
|
||||
{
|
||||
auto selection = jsi::Object(runtime);
|
||||
selection.setProperty(
|
||||
runtime, "start", textInputMetrics.selectionRange.location);
|
||||
selection.setProperty(
|
||||
runtime,
|
||||
"end",
|
||||
textInputMetrics.selectionRange.location +
|
||||
textInputMetrics.selectionRange.length);
|
||||
payload.setProperty(runtime, "selection", selection);
|
||||
}
|
||||
|
||||
return payload;
|
||||
};
|
||||
|
||||
static jsi::Value keyPressMetricsPayload(
|
||||
jsi::Runtime &runtime,
|
||||
KeyPressMetrics const &keyPressMetrics) {
|
||||
auto payload = jsi::Object(runtime);
|
||||
payload.setProperty(runtime, "eventCount", keyPressMetrics.eventCount);
|
||||
|
||||
std::string key;
|
||||
if (keyPressMetrics.text.empty()) {
|
||||
key = "Backspace";
|
||||
} else {
|
||||
if (keyPressMetrics.text.front() == '\n') {
|
||||
key = "Enter";
|
||||
} else if (keyPressMetrics.text.front() == '\t') {
|
||||
key = "Tab";
|
||||
} else {
|
||||
key = keyPressMetrics.text.front();
|
||||
}
|
||||
}
|
||||
payload.setProperty(
|
||||
runtime, "key", jsi::String::createFromUtf8(runtime, key));
|
||||
return payload;
|
||||
};
|
||||
|
||||
void TextInputEventEmitter::onFocus(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("focus", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onBlur(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("blur", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onChange(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("change", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onChangeText(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("changeText", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onContentSizeChange(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("contentSizeChange", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onSelectionChange(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("selectionChange", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onEndEditing(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("endEditing", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onSubmitEditing(
|
||||
TextInputMetrics const &textInputMetrics) const {
|
||||
dispatchTextInputEvent("submitEditing", textInputMetrics);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::onKeyPress(
|
||||
KeyPressMetrics const &keyPressMetrics) const {
|
||||
dispatchEvent(
|
||||
"keyPress",
|
||||
[keyPressMetrics](jsi::Runtime &runtime) {
|
||||
return keyPressMetricsPayload(runtime, keyPressMetrics);
|
||||
},
|
||||
EventPriority::AsynchronousBatched);
|
||||
}
|
||||
|
||||
void TextInputEventEmitter::dispatchTextInputEvent(
|
||||
std::string const &name,
|
||||
TextInputMetrics const &textInputMetrics,
|
||||
EventPriority priority) const {
|
||||
dispatchEvent(
|
||||
name,
|
||||
[textInputMetrics](jsi::Runtime &runtime) {
|
||||
return textInputMetricsPayload(runtime, textInputMetrics);
|
||||
},
|
||||
priority);
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
56
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.h
generated
vendored
Normal file
56
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.h
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/attributedstring/AttributedString.h>
|
||||
#include <react/components/view/ViewEventEmitter.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class TextInputMetrics {
|
||||
public:
|
||||
std::string text;
|
||||
AttributedString::Range selectionRange;
|
||||
// ScrollView-like metrics
|
||||
Size contentSize;
|
||||
Point contentOffset;
|
||||
EdgeInsets contentInset;
|
||||
Size containerSize;
|
||||
int eventCount;
|
||||
};
|
||||
|
||||
class KeyPressMetrics {
|
||||
public:
|
||||
std::string text;
|
||||
int eventCount;
|
||||
};
|
||||
|
||||
class TextInputEventEmitter : public ViewEventEmitter {
|
||||
public:
|
||||
using ViewEventEmitter::ViewEventEmitter;
|
||||
|
||||
void onFocus(TextInputMetrics const &textInputMetrics) const;
|
||||
void onBlur(TextInputMetrics const &textInputMetrics) const;
|
||||
void onChange(TextInputMetrics const &textInputMetrics) const;
|
||||
void onChangeText(TextInputMetrics const &textInputMetrics) const;
|
||||
void onContentSizeChange(TextInputMetrics const &textInputMetrics) const;
|
||||
void onSelectionChange(TextInputMetrics const &textInputMetrics) const;
|
||||
void onEndEditing(TextInputMetrics const &textInputMetrics) const;
|
||||
void onSubmitEditing(TextInputMetrics const &textInputMetrics) const;
|
||||
void onKeyPress(KeyPressMetrics const &textInputMetrics) const;
|
||||
|
||||
private:
|
||||
void dispatchTextInputEvent(
|
||||
std::string const &name,
|
||||
TextInputMetrics const &textInputMetrics,
|
||||
EventPriority priority = EventPriority::AsynchronousBatched) const;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
92
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.cpp
generated
vendored
Normal file
92
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.cpp
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "TextInputProps.h"
|
||||
|
||||
#include <react/attributedstring/conversions.h>
|
||||
#include <react/components/iostextinput/propsConversions.h>
|
||||
#include <react/core/propsConversions.h>
|
||||
#include <react/graphics/conversions.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
TextInputProps::TextInputProps(
|
||||
TextInputProps const &sourceProps,
|
||||
RawProps const &rawProps)
|
||||
: ViewProps(sourceProps, rawProps),
|
||||
BaseTextProps(sourceProps, rawProps),
|
||||
traits(convertRawProp(rawProps, sourceProps.traits, {})),
|
||||
paragraphAttributes(
|
||||
convertRawProp(rawProps, sourceProps.paragraphAttributes, {})),
|
||||
defaultValue(convertRawProp(
|
||||
rawProps,
|
||||
"defaultValue",
|
||||
sourceProps.defaultValue,
|
||||
{})),
|
||||
placeholder(
|
||||
convertRawProp(rawProps, "placeholder", sourceProps.placeholder, {})),
|
||||
placeholderTextColor(convertRawProp(
|
||||
rawProps,
|
||||
"placeholderTextColor",
|
||||
sourceProps.placeholderTextColor,
|
||||
{})),
|
||||
maxLength(
|
||||
convertRawProp(rawProps, "maxLength", sourceProps.maxLength, {})),
|
||||
cursorColor(
|
||||
convertRawProp(rawProps, "cursorColor", sourceProps.cursorColor, {})),
|
||||
selectionColor(convertRawProp(
|
||||
rawProps,
|
||||
"selectionColor",
|
||||
sourceProps.selectionColor,
|
||||
{})),
|
||||
underlineColorAndroid(convertRawProp(
|
||||
rawProps,
|
||||
"underlineColorAndroid",
|
||||
sourceProps.underlineColorAndroid,
|
||||
{})),
|
||||
text(convertRawProp(rawProps, "text", sourceProps.text, {})),
|
||||
mostRecentEventCount(convertRawProp(
|
||||
rawProps,
|
||||
"mostRecentEventCount",
|
||||
sourceProps.mostRecentEventCount,
|
||||
{})){};
|
||||
|
||||
TextAttributes TextInputProps::getEffectiveTextAttributes() const {
|
||||
auto result = TextAttributes::defaultTextAttributes();
|
||||
result.apply(textAttributes);
|
||||
|
||||
/*
|
||||
* These props are applied to `View`, therefore they must not be a part of
|
||||
* base text attributes.
|
||||
*/
|
||||
result.backgroundColor = clearColor();
|
||||
result.opacity = 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ParagraphAttributes TextInputProps::getEffectiveParagraphAttributes() const {
|
||||
auto result = paragraphAttributes;
|
||||
|
||||
if (!traits.multiline) {
|
||||
result.maximumNumberOfLines = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
folly::dynamic TextInputProps::getDynamic() const {
|
||||
folly::dynamic props = folly::dynamic::object();
|
||||
props["value"] = value;
|
||||
return props;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
68
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.h
generated
vendored
Normal file
68
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.h
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/attributedstring/ParagraphAttributes.h>
|
||||
#include <react/attributedstring/TextAttributes.h>
|
||||
#include <react/components/iostextinput/conversions.h>
|
||||
#include <react/components/iostextinput/primitives.h>
|
||||
#include <react/components/text/BaseTextProps.h>
|
||||
#include <react/components/view/ViewProps.h>
|
||||
#include <react/core/Props.h>
|
||||
#include <react/core/propsConversions.h>
|
||||
#include <react/graphics/Color.h>
|
||||
#include <react/imagemanager/primitives.h>
|
||||
#include <vector>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class TextInputProps final : public ViewProps, public BaseTextProps {
|
||||
public:
|
||||
TextInputProps() = default;
|
||||
TextInputProps(TextInputProps const &sourceProps, RawProps const &rawProps);
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
TextInputTraits const traits{};
|
||||
ParagraphAttributes const paragraphAttributes{};
|
||||
|
||||
std::string const defaultValue{};
|
||||
|
||||
std::string const placeholder{};
|
||||
SharedColor const placeholderTextColor{};
|
||||
|
||||
int maxLength{};
|
||||
|
||||
/*
|
||||
* Tint colors
|
||||
*/
|
||||
SharedColor const cursorColor{};
|
||||
SharedColor const selectionColor{};
|
||||
// TODO: Rename to `tintColor` and make universal.
|
||||
SharedColor const underlineColorAndroid{};
|
||||
|
||||
/*
|
||||
* "Private" (only used by TextInput.js) props
|
||||
*/
|
||||
std::string const text{};
|
||||
int const mostRecentEventCount{0};
|
||||
|
||||
/*
|
||||
* Accessors
|
||||
*/
|
||||
TextAttributes getEffectiveTextAttributes() const;
|
||||
ParagraphAttributes getEffectiveParagraphAttributes() const;
|
||||
|
||||
#ifdef ANDROID
|
||||
folly::dynamic getDynamic() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
111
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.cpp
generated
vendored
Normal file
111
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.cpp
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "TextInputShadowNode.h"
|
||||
|
||||
#include <react/attributedstring/AttributedStringBox.h>
|
||||
#include <react/attributedstring/TextAttributes.h>
|
||||
#include <react/core/LayoutConstraints.h>
|
||||
#include <react/core/LayoutContext.h>
|
||||
#include <react/core/conversions.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
extern char const TextInputComponentName[] = "TextInput";
|
||||
|
||||
AttributedStringBox TextInputShadowNode::attributedStringBoxToMeasure() const {
|
||||
bool hasMeaningfulState =
|
||||
getState() && getState()->getRevision() != State::initialRevisionValue;
|
||||
|
||||
if (hasMeaningfulState) {
|
||||
auto attributedStringBox = getStateData().attributedStringBox;
|
||||
if (attributedStringBox.getMode() ==
|
||||
AttributedStringBox::Mode::OpaquePointer ||
|
||||
!attributedStringBox.getValue().isEmpty()) {
|
||||
return getStateData().attributedStringBox;
|
||||
}
|
||||
}
|
||||
|
||||
auto attributedString =
|
||||
hasMeaningfulState ? AttributedString{} : getAttributedString();
|
||||
|
||||
if (attributedString.isEmpty()) {
|
||||
auto placeholder = getConcreteProps().placeholder;
|
||||
// Note: `zero-width space` is insufficient in some cases (e.g. when we need
|
||||
// to measure the "hight" of the font).
|
||||
auto string = !placeholder.empty() ? placeholder : "I";
|
||||
auto textAttributes = getConcreteProps().getEffectiveTextAttributes();
|
||||
attributedString.appendFragment({string, textAttributes, {}});
|
||||
}
|
||||
|
||||
return AttributedStringBox{attributedString};
|
||||
}
|
||||
|
||||
AttributedString TextInputShadowNode::getAttributedString() const {
|
||||
auto textAttributes = getConcreteProps().getEffectiveTextAttributes();
|
||||
auto attributedString = AttributedString{};
|
||||
|
||||
attributedString.appendFragment(
|
||||
AttributedString::Fragment{getConcreteProps().text, textAttributes});
|
||||
|
||||
auto attachments = Attachments{};
|
||||
BaseTextShadowNode::buildAttributedString(
|
||||
textAttributes, *this, attributedString, attachments);
|
||||
|
||||
return attributedString;
|
||||
}
|
||||
|
||||
void TextInputShadowNode::setTextLayoutManager(
|
||||
TextLayoutManager::Shared const &textLayoutManager) {
|
||||
ensureUnsealed();
|
||||
textLayoutManager_ = textLayoutManager;
|
||||
}
|
||||
|
||||
void TextInputShadowNode::updateStateIfNeeded() {
|
||||
ensureUnsealed();
|
||||
|
||||
auto reactTreeAttributedString = getAttributedString();
|
||||
auto const &state = getStateData();
|
||||
|
||||
assert(textLayoutManager_);
|
||||
assert(
|
||||
(!state.layoutManager || state.layoutManager == textLayoutManager_) &&
|
||||
"`StateData` refers to a different `TextLayoutManager`");
|
||||
|
||||
if (state.reactTreeAttributedString == reactTreeAttributedString &&
|
||||
state.layoutManager == textLayoutManager_) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto newState = TextInputState{};
|
||||
newState.attributedStringBox = AttributedStringBox{reactTreeAttributedString};
|
||||
newState.paragraphAttributes = getConcreteProps().paragraphAttributes;
|
||||
newState.reactTreeAttributedString = reactTreeAttributedString;
|
||||
newState.layoutManager = textLayoutManager_;
|
||||
newState.mostRecentEventCount = getConcreteProps().mostRecentEventCount;
|
||||
setStateData(std::move(newState));
|
||||
}
|
||||
|
||||
#pragma mark - LayoutableShadowNode
|
||||
|
||||
Size TextInputShadowNode::measure(LayoutConstraints layoutConstraints) const {
|
||||
return textLayoutManager_
|
||||
->measure(
|
||||
attributedStringBoxToMeasure(),
|
||||
getConcreteProps().getEffectiveParagraphAttributes(),
|
||||
layoutConstraints)
|
||||
.size;
|
||||
}
|
||||
|
||||
void TextInputShadowNode::layout(LayoutContext layoutContext) {
|
||||
updateStateIfNeeded();
|
||||
ConcreteViewShadowNode::layout(layoutContext);
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
76
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.h
generated
vendored
Normal file
76
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.h
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/attributedstring/AttributedString.h>
|
||||
#include <react/components/iostextinput/TextInputEventEmitter.h>
|
||||
#include <react/components/iostextinput/TextInputProps.h>
|
||||
#include <react/components/iostextinput/TextInputState.h>
|
||||
#include <react/components/text/BaseTextShadowNode.h>
|
||||
#include <react/components/view/ConcreteViewShadowNode.h>
|
||||
#include <react/textlayoutmanager/TextLayoutManager.h>
|
||||
#include <react/utils/ContextContainer.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
extern const char TextInputComponentName[];
|
||||
|
||||
/*
|
||||
* `ShadowNode` for <TextInput> component.
|
||||
*/
|
||||
class TextInputShadowNode : public ConcreteViewShadowNode<
|
||||
TextInputComponentName,
|
||||
TextInputProps,
|
||||
TextInputEventEmitter,
|
||||
TextInputState>,
|
||||
public BaseTextShadowNode {
|
||||
public:
|
||||
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
||||
|
||||
static ShadowNodeTraits BaseTraits() {
|
||||
auto traits = ConcreteViewShadowNode::BaseTraits();
|
||||
traits.set(ShadowNodeTraits::Trait::TextKind);
|
||||
return traits;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a `AttributedString` which represents text content of the node.
|
||||
*/
|
||||
AttributedString getAttributedString() const;
|
||||
|
||||
/*
|
||||
* Associates a shared `TextLayoutManager` with the node.
|
||||
* `TextInputShadowNode` uses the manager to measure text content
|
||||
* and construct `TextInputState` objects.
|
||||
*/
|
||||
void setTextLayoutManager(TextLayoutManager::Shared const &textLayoutManager);
|
||||
|
||||
#pragma mark - LayoutableShadowNode
|
||||
|
||||
Size measure(LayoutConstraints layoutConstraints) const override;
|
||||
void layout(LayoutContext layoutContext) override;
|
||||
|
||||
private:
|
||||
/*
|
||||
* Creates a `State` object if needed.
|
||||
*/
|
||||
void updateStateIfNeeded();
|
||||
|
||||
/*
|
||||
* Returns an `AttributedStringBox` which represents text content that should
|
||||
* be used for measuring purposes. It might contain actual text value,
|
||||
* placeholder value or some character that represents the size of the font.
|
||||
*/
|
||||
AttributedStringBox attributedStringBoxToMeasure() const;
|
||||
|
||||
TextLayoutManager::Shared textLayoutManager_;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
12
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.cpp
generated
vendored
Normal file
12
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.cpp
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "TextInputState.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {} // namespace react
|
||||
} // namespace facebook
|
57
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.h
generated
vendored
Normal file
57
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.h
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/attributedstring/AttributedStringBox.h>
|
||||
#include <react/attributedstring/ParagraphAttributes.h>
|
||||
#include <react/textlayoutmanager/TextLayoutManager.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/*
|
||||
* State for <TextInput> component.
|
||||
*/
|
||||
class TextInputState final {
|
||||
public:
|
||||
/*
|
||||
* All content of <TextInput> component.
|
||||
*/
|
||||
AttributedStringBox attributedStringBox;
|
||||
|
||||
/*
|
||||
* All content of <TextInput> component represented as an `AttributedString`.
|
||||
* This stores the previous computed *from the React tree*. This usually
|
||||
* doesn't change as the TextInput contents are being updated. If it does
|
||||
* change, we need to wipe out current contents of the TextInput and replace
|
||||
* with the new value from the tree.
|
||||
*/
|
||||
AttributedString reactTreeAttributedString{};
|
||||
|
||||
/*
|
||||
* Represents all visual attributes of a paragraph of text represented as
|
||||
* a ParagraphAttributes.
|
||||
*/
|
||||
ParagraphAttributes paragraphAttributes;
|
||||
|
||||
/*
|
||||
* `TextLayoutManager` provides a connection to platform-specific
|
||||
* text rendering infrastructure which is capable to render the
|
||||
* `AttributedString`.
|
||||
*/
|
||||
SharedTextLayoutManager layoutManager;
|
||||
|
||||
size_t mostRecentEventCount{0};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
210
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/conversions.h
generated
vendored
Normal file
210
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/conversions.h
generated
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/iostextinput/primitives.h>
|
||||
#include <react/core/propsConversions.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
inline void fromRawValue(
|
||||
const RawValue &value,
|
||||
AutocapitalizationType &result) {
|
||||
auto string = (std::string)value;
|
||||
if (string == "none") {
|
||||
result = AutocapitalizationType::None;
|
||||
return;
|
||||
}
|
||||
if (string == "words") {
|
||||
result = AutocapitalizationType::Words;
|
||||
return;
|
||||
}
|
||||
if (string == "sentences") {
|
||||
result = AutocapitalizationType::Sentences;
|
||||
return;
|
||||
}
|
||||
if (string == "characters") {
|
||||
result = AutocapitalizationType::Characters;
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromRawValue(const RawValue &value, KeyboardAppearance &result) {
|
||||
auto string = (std::string)value;
|
||||
if (string == "default") {
|
||||
result = KeyboardAppearance::Default;
|
||||
return;
|
||||
}
|
||||
if (string == "light") {
|
||||
result = KeyboardAppearance::Light;
|
||||
return;
|
||||
}
|
||||
if (string == "dark") {
|
||||
result = KeyboardAppearance::Dark;
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromRawValue(const RawValue &value, ReturnKeyType &result) {
|
||||
auto string = (std::string)value;
|
||||
if (string == "default") {
|
||||
result = ReturnKeyType::Default;
|
||||
return;
|
||||
}
|
||||
if (string == "done") {
|
||||
result = ReturnKeyType::Done;
|
||||
return;
|
||||
}
|
||||
if (string == "go") {
|
||||
result = ReturnKeyType::Go;
|
||||
return;
|
||||
}
|
||||
if (string == "next") {
|
||||
result = ReturnKeyType::Next;
|
||||
return;
|
||||
}
|
||||
if (string == "search") {
|
||||
result = ReturnKeyType::Search;
|
||||
return;
|
||||
}
|
||||
if (string == "send") {
|
||||
result = ReturnKeyType::Send;
|
||||
return;
|
||||
}
|
||||
|
||||
// Android-only
|
||||
if (string == "none") {
|
||||
result = ReturnKeyType::None;
|
||||
return;
|
||||
}
|
||||
if (string == "previous") {
|
||||
result = ReturnKeyType::Previous;
|
||||
return;
|
||||
}
|
||||
|
||||
// iOS-only
|
||||
if (string == "emergency-call") {
|
||||
result = ReturnKeyType::EmergencyCall;
|
||||
return;
|
||||
}
|
||||
if (string == "google") {
|
||||
result = ReturnKeyType::Google;
|
||||
return;
|
||||
}
|
||||
if (string == "join") {
|
||||
result = ReturnKeyType::Join;
|
||||
return;
|
||||
}
|
||||
if (string == "route") {
|
||||
result = ReturnKeyType::Route;
|
||||
return;
|
||||
}
|
||||
if (string == "yahoo") {
|
||||
result = ReturnKeyType::Yahoo;
|
||||
return;
|
||||
}
|
||||
if (string == "continue") {
|
||||
result = ReturnKeyType::Continue;
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromRawValue(
|
||||
const RawValue &value,
|
||||
TextInputAccessoryVisibilityMode &result) {
|
||||
auto string = (std::string)value;
|
||||
if (string == "never") {
|
||||
result = TextInputAccessoryVisibilityMode::Never;
|
||||
return;
|
||||
}
|
||||
if (string == "while-editing") {
|
||||
result = TextInputAccessoryVisibilityMode::WhileEditing;
|
||||
return;
|
||||
}
|
||||
if (string == "unless-editing") {
|
||||
result = TextInputAccessoryVisibilityMode::UnlessEditing;
|
||||
return;
|
||||
}
|
||||
if (string == "always") {
|
||||
result = TextInputAccessoryVisibilityMode::Always;
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
inline void fromRawValue(const RawValue &value, KeyboardType &result) {
|
||||
auto string = (std::string)value;
|
||||
if (string == "default") {
|
||||
result = KeyboardType::Default;
|
||||
return;
|
||||
}
|
||||
if (string == "email-address") {
|
||||
result = KeyboardType::EmailAddress;
|
||||
return;
|
||||
}
|
||||
if (string == "numeric") {
|
||||
result = KeyboardType::Numeric;
|
||||
return;
|
||||
}
|
||||
if (string == "phone-pad") {
|
||||
result = KeyboardType::PhonePad;
|
||||
return;
|
||||
}
|
||||
if (string == "number-pad") {
|
||||
result = KeyboardType::NumberPad;
|
||||
return;
|
||||
}
|
||||
if (string == "decimal-pad") {
|
||||
result = KeyboardType::DecimalPad;
|
||||
return;
|
||||
}
|
||||
|
||||
// iOS-only
|
||||
if (string == "ascii-capable") {
|
||||
result = KeyboardType::ASCIICapable;
|
||||
return;
|
||||
}
|
||||
if (string == "numbers-and-punctuation") {
|
||||
result = KeyboardType::NumbersAndPunctuation;
|
||||
return;
|
||||
}
|
||||
if (string == "url") {
|
||||
result = KeyboardType::URL;
|
||||
return;
|
||||
}
|
||||
if (string == "name-phone-pad") {
|
||||
result = KeyboardType::NamePhonePad;
|
||||
return;
|
||||
}
|
||||
if (string == "twitter") {
|
||||
result = KeyboardType::Twitter;
|
||||
return;
|
||||
}
|
||||
if (string == "web-search") {
|
||||
result = KeyboardType::WebSearch;
|
||||
return;
|
||||
}
|
||||
if (string == "ascii-capable-number-pad") {
|
||||
result = KeyboardType::ASCIICapableNumberPad;
|
||||
return;
|
||||
}
|
||||
|
||||
// Android-only
|
||||
if (string == "visible-password") {
|
||||
result = KeyboardType::VisiblePassword;
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
209
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/primitives.h
generated
vendored
Normal file
209
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/primitives.h
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <better/optional.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
// iOS & Android.
|
||||
enum class AutocapitalizationType {
|
||||
None,
|
||||
Words,
|
||||
Sentences,
|
||||
Characters,
|
||||
};
|
||||
|
||||
// iOS-only
|
||||
enum class KeyboardAppearance {
|
||||
Default,
|
||||
Light,
|
||||
Dark,
|
||||
};
|
||||
|
||||
enum class ReturnKeyType {
|
||||
// Universal
|
||||
Default,
|
||||
Done,
|
||||
Go,
|
||||
Next,
|
||||
Search,
|
||||
Send,
|
||||
// Android-only
|
||||
None,
|
||||
Previous,
|
||||
// iOS-only
|
||||
EmergencyCall,
|
||||
Google,
|
||||
Join,
|
||||
Route,
|
||||
Yahoo,
|
||||
Continue,
|
||||
};
|
||||
|
||||
// iOS-only
|
||||
enum class TextInputAccessoryVisibilityMode {
|
||||
Never,
|
||||
WhileEditing,
|
||||
UnlessEditing,
|
||||
Always,
|
||||
};
|
||||
|
||||
enum class KeyboardType {
|
||||
// Universal
|
||||
Default,
|
||||
EmailAddress,
|
||||
Numeric,
|
||||
PhonePad,
|
||||
NumberPad,
|
||||
DecimalPad,
|
||||
// iOS-only
|
||||
ASCIICapable,
|
||||
NumbersAndPunctuation,
|
||||
URL,
|
||||
NamePhonePad,
|
||||
Twitter,
|
||||
WebSearch,
|
||||
ASCIICapableNumberPad,
|
||||
// Android-only
|
||||
VisiblePassword,
|
||||
};
|
||||
|
||||
/*
|
||||
* Controls features of text inputs.
|
||||
*/
|
||||
class TextInputTraits final {
|
||||
public:
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool multiline{false};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `None`.
|
||||
*/
|
||||
AutocapitalizationType autocapitalizationType{AutocapitalizationType::None};
|
||||
|
||||
/*
|
||||
* Can be empty (`null` in JavaScript) which means `default`.
|
||||
* iOS & Android
|
||||
* Default value: `empty` (`null`).
|
||||
*/
|
||||
better::optional<bool> autoCorrect{};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool contextMenuHidden{false};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `true`.
|
||||
*/
|
||||
bool editable{true};
|
||||
|
||||
/*
|
||||
* iOS-only (implemented only on iOS for now)
|
||||
* If `true`, will automatically disable return key when text widget has
|
||||
* zero-length contents, and will automatically enable when text widget has
|
||||
* non-zero-length contents.
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool enablesReturnKeyAutomatically{false};
|
||||
|
||||
/*
|
||||
* Some values iOS- or Android-only (inherently particular-OS-specific)
|
||||
* Default value: `Default`.
|
||||
*/
|
||||
KeyboardAppearance keyboardAppearance{KeyboardAppearance::Default};
|
||||
|
||||
/*
|
||||
* Controls the annotation of misspelled words for a text input.
|
||||
* iOS-only (implemented only on iOS for now)
|
||||
* Can be empty (`null` in JavaScript) which means `default`.
|
||||
* Default value: `empty` (`null`).
|
||||
*/
|
||||
better::optional<bool> spellCheck{};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool caretHidden{false};
|
||||
|
||||
/*
|
||||
* Controls the visibility of a `Clean` button.
|
||||
* iOS-only (implemented only on iOS for now)
|
||||
* Default value: `Never`.
|
||||
*/
|
||||
TextInputAccessoryVisibilityMode clearButtonMode{
|
||||
TextInputAccessoryVisibilityMode::Never};
|
||||
|
||||
/*
|
||||
* iOS-only (implemented only on iOS for now)
|
||||
* Default value: `true`.
|
||||
*/
|
||||
bool scrollEnabled{true};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool secureTextEntry{false};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool blurOnSubmit{false};
|
||||
|
||||
/*
|
||||
* iOS-only (implemented only on iOS for now)
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool clearTextOnFocus{false};
|
||||
|
||||
/*
|
||||
* Some values iOS- or Android-only (inherently particular-OS-specific)
|
||||
* Default value: `Default`.
|
||||
*/
|
||||
KeyboardType keyboardType{KeyboardType::Default};
|
||||
|
||||
/*
|
||||
* Some values iOS- or Android-only (inherently particular-OS-specific)
|
||||
* Default value: `Default`.
|
||||
*/
|
||||
ReturnKeyType returnKeyType{ReturnKeyType::Default};
|
||||
|
||||
/*
|
||||
* iOS & Android
|
||||
* Default value: `false`.
|
||||
*/
|
||||
bool selectTextOnFocus{false};
|
||||
|
||||
/*
|
||||
* iOS-only (inherently iOS-specific)
|
||||
* Default value: `<empty string>` (default content type).
|
||||
*/
|
||||
std::string textContentType{};
|
||||
|
||||
/*
|
||||
* iOS-only (inherently iOS-specific)
|
||||
* Default value: `<empty string>` (no rules).
|
||||
*/
|
||||
std::string passwordRules{};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
116
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/propsConversions.h
generated
vendored
Normal file
116
node_modules/react-native/ReactCommon/fabric/components/textinput/iostextinput/propsConversions.h
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/iostextinput/primitives.h>
|
||||
#include <react/core/propsConversions.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
static TextInputTraits convertRawProp(
|
||||
RawProps const &rawProps,
|
||||
TextInputTraits const &sourceTraits,
|
||||
TextInputTraits const &defaultTraits) {
|
||||
auto traits = TextInputTraits{};
|
||||
|
||||
traits.multiline = convertRawProp(
|
||||
rawProps, "multiline", sourceTraits.multiline, defaultTraits.multiline);
|
||||
traits.autocapitalizationType = convertRawProp(
|
||||
rawProps,
|
||||
"autoCapitalize",
|
||||
sourceTraits.autocapitalizationType,
|
||||
defaultTraits.autocapitalizationType);
|
||||
traits.autoCorrect = convertRawProp(
|
||||
rawProps,
|
||||
"autoCorrect",
|
||||
sourceTraits.autoCorrect,
|
||||
defaultTraits.autoCorrect);
|
||||
traits.contextMenuHidden = convertRawProp(
|
||||
rawProps,
|
||||
"contextMenuHidden",
|
||||
sourceTraits.contextMenuHidden,
|
||||
defaultTraits.contextMenuHidden);
|
||||
traits.editable = convertRawProp(
|
||||
rawProps, "editable", sourceTraits.editable, defaultTraits.editable);
|
||||
traits.enablesReturnKeyAutomatically = convertRawProp(
|
||||
rawProps,
|
||||
"enablesReturnKeyAutomatically",
|
||||
sourceTraits.enablesReturnKeyAutomatically,
|
||||
defaultTraits.enablesReturnKeyAutomatically);
|
||||
traits.keyboardAppearance = convertRawProp(
|
||||
rawProps,
|
||||
"keyboardAppearance",
|
||||
sourceTraits.keyboardAppearance,
|
||||
defaultTraits.keyboardAppearance);
|
||||
traits.spellCheck = convertRawProp(
|
||||
rawProps,
|
||||
"spellCheck",
|
||||
sourceTraits.spellCheck,
|
||||
defaultTraits.spellCheck);
|
||||
traits.caretHidden = convertRawProp(
|
||||
rawProps,
|
||||
"caretHidden",
|
||||
sourceTraits.caretHidden,
|
||||
defaultTraits.caretHidden);
|
||||
traits.clearButtonMode = convertRawProp(
|
||||
rawProps,
|
||||
"clearButtonMode",
|
||||
sourceTraits.clearButtonMode,
|
||||
defaultTraits.clearButtonMode);
|
||||
traits.scrollEnabled = convertRawProp(
|
||||
rawProps,
|
||||
"scrollEnabled",
|
||||
sourceTraits.scrollEnabled,
|
||||
defaultTraits.scrollEnabled);
|
||||
traits.secureTextEntry = convertRawProp(
|
||||
rawProps,
|
||||
"secureTextEntry",
|
||||
sourceTraits.secureTextEntry,
|
||||
defaultTraits.secureTextEntry);
|
||||
traits.blurOnSubmit = convertRawProp(
|
||||
rawProps,
|
||||
"blurOnSubmit",
|
||||
sourceTraits.blurOnSubmit,
|
||||
defaultTraits.blurOnSubmit);
|
||||
traits.clearTextOnFocus = convertRawProp(
|
||||
rawProps,
|
||||
"clearTextOnFocus",
|
||||
sourceTraits.clearTextOnFocus,
|
||||
defaultTraits.clearTextOnFocus);
|
||||
traits.keyboardType = convertRawProp(
|
||||
rawProps,
|
||||
"keyboardType",
|
||||
sourceTraits.keyboardType,
|
||||
defaultTraits.keyboardType);
|
||||
traits.returnKeyType = convertRawProp(
|
||||
rawProps,
|
||||
"returnKeyType",
|
||||
sourceTraits.returnKeyType,
|
||||
defaultTraits.returnKeyType);
|
||||
traits.selectTextOnFocus = convertRawProp(
|
||||
rawProps,
|
||||
"selectTextOnFocus",
|
||||
sourceTraits.selectTextOnFocus,
|
||||
defaultTraits.selectTextOnFocus);
|
||||
traits.textContentType = convertRawProp(
|
||||
rawProps,
|
||||
"textContentType",
|
||||
sourceTraits.textContentType,
|
||||
defaultTraits.textContentType);
|
||||
traits.passwordRules = convertRawProp(
|
||||
rawProps,
|
||||
"passwordRules",
|
||||
sourceTraits.passwordRules,
|
||||
defaultTraits.passwordRules);
|
||||
|
||||
return traits;
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
Reference in New Issue
Block a user