Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ public static ReactFontManager getInstance() {
public void addCustomFont(@NonNull Context context, @NonNull String fontFamily, int fontId) {
Typeface font = ResourcesCompat.getFont(context, fontId);
if (font != null) {
mCustomTypefaceCache.put(fontFamily, font);
addCustomFont(fontFamily, font);
}
}

public void addCustomFont(@NonNull String fontFamily, @NonNull Typeface font) {
mCustomTypefaceCache.put(fontFamily, font);
}

/**
* Add additional font family, or replace the exist one in the font memory cache.
* @param style
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ public void setBorderStyle(ReactEditText view, @Nullable String borderStyle) {
view.setBorderStyle(borderStyle);
}

@ReactProp(name = "showSoftInputOnFocus", defaultBoolean = true)
public void showKeyboardOnFocus(ReactEditText view, boolean showKeyboardOnFocus) {
view.setShowSoftInputOnFocus(showKeyboardOnFocus);
}

@ReactPropGroup(names = {
ViewProps.BORDER_WIDTH,
ViewProps.BORDER_LEFT_WIDTH,
Expand Down Expand Up @@ -852,11 +857,7 @@ public void onFocusChange(View v, boolean hasFocus) {
eventDispatcher.dispatchEvent(
new ReactTextInputFocusEvent(
editText.getId()));
// Show keyboard when a EditText view gains focus
editText.showSoftKeyboard();
} else {
// Hide keyboard when a EditText view looses focus
editText.hideSoftKeyboard();
eventDispatcher.dispatchEvent(
new ReactTextInputBlurEvent(
editText.getId()));
Expand Down Expand Up @@ -909,8 +910,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent) {
return false;
}

// If its not an action we handle, perform default behavior
return false;
return true;
}
});
}
Expand Down
6 changes: 5 additions & 1 deletion ReactCommon/cxxreact/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Instance::initializeBridge(

jsQueue->runOnQueueSync([this, delegate, &jsef, jsQueue]() mutable {
nativeToJsBridge_ = folly::make_unique<NativeToJsBridge>(
jsef.get(), delegate, moduleRegistry_, jsQueue, callback_);
jsef.get(), delegate, moduleRegistry_, jsQueue, callback_, jseConfigParams_);

std::lock_guard<std::mutex> lock(m_syncMutex);
m_syncReady = true;
Expand Down Expand Up @@ -201,6 +201,10 @@ void Instance::callJSCallback(uint64_t callbackId, folly::dynamic &&params) {
nativeToJsBridge_->invokeCallback((double)callbackId, std::move(params));
}

void Instance::setJSEConfigParams(std::shared_ptr<JSEConfigParams>&& jseConfigParams) {
jseConfigParams_ = std::move(jseConfigParams);
}

void Instance::registerBundle(uint32_t bundleId, const std::string& bundlePath) {
nativeToJsBridge_->registerBundle(bundleId, bundlePath);
}
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/cxxreact/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class RN_EXPORT Instance {
void callJSFunction(std::string &&module, std::string &&method,
folly::dynamic &&params);
void callJSCallback(uint64_t callbackId, folly::dynamic &&params);
virtual void setJSEConfigParams(std::shared_ptr<JSEConfigParams>&& jseConfigParams);

// This method is experimental, and may be modified or removed.
void registerBundle(uint32_t bundleId, const std::string& bundlePath);
Expand Down Expand Up @@ -117,6 +118,7 @@ class RN_EXPORT Instance {
std::shared_ptr<InstanceCallback> callback_;
std::unique_ptr<NativeToJsBridge> nativeToJsBridge_;
std::shared_ptr<ModuleRegistry> moduleRegistry_;
std::shared_ptr<JSEConfigParams> jseConfigParams_;

std::mutex m_syncMutex;
std::condition_variable m_syncCV;
Expand Down
5 changes: 3 additions & 2 deletions ReactCommon/cxxreact/NativeToJsBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ NativeToJsBridge::NativeToJsBridge(
std::shared_ptr<ExecutorDelegate> delegate, // TODO(OSS Candidate ISS#2710739)
std::shared_ptr<ModuleRegistry> registry,
std::shared_ptr<MessageQueueThread> jsQueue,
std::shared_ptr<InstanceCallback> callback)
std::shared_ptr<InstanceCallback> callback,
std::shared_ptr<JSEConfigParams> jseConfigParams)
: m_destroyed(std::make_shared<bool>(false)),
m_delegate(delegate ? delegate : (std::make_shared<JsToNativeBridge>(registry, callback))),
m_executor(jsExecutorFactory->createJSExecutor(m_delegate, jsQueue)),
m_executor(jsExecutorFactory->createJSExecutor(m_delegate, jsQueue, std::move(jseConfigParams))),
m_executorMessageQueueThread(std::move(jsQueue)),
m_inspectable(m_executor->isInspectable()) {}

Expand Down
3 changes: 2 additions & 1 deletion ReactCommon/cxxreact/NativeToJsBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class NativeToJsBridge {
std::shared_ptr<ExecutorDelegate> delegate, // TODO(OSS Candidate ISS#2710739)
std::shared_ptr<ModuleRegistry> registry,
std::shared_ptr<MessageQueueThread> jsQueue,
std::shared_ptr<InstanceCallback> callback);
std::shared_ptr<InstanceCallback> callback,
std::shared_ptr<JSEConfigParams> jseConfigParams);
virtual ~NativeToJsBridge();

/**
Expand Down