Skip to content

Commit

Permalink
Merge branch 'main' into @tomekzaw/worklets
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Sep 16, 2024
2 parents 14064d3 + b2cd218 commit 769e7a3
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 88 deletions.
22 changes: 12 additions & 10 deletions android/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ find_package(fbjni REQUIRED CONFIG)
find_package(ReactAndroid REQUIRED CONFIG)
find_package(react-native-reanimated REQUIRED CONFIG)

target_link_libraries(
${CMAKE_PROJECT_NAME}
fbjni::fbjni
ReactAndroid::jsi
react-native-reanimated::worklets
)

if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
target_link_libraries(${CMAKE_PROJECT_NAME}
fbjni::fbjni
ReactAndroid::jsi
ReactAndroid::reactnative
react-native-reanimated::worklets)
target_link_libraries(${CMAKE_PROJECT_NAME} ReactAndroid::reactnative)
elseif (ReactAndroid_VERSION_MINOR GREATER_EQUAL 75)
target_link_libraries(${CMAKE_PROJECT_NAME}
fbjni::fbjni
ReactAndroid::jsi
target_link_libraries(
${CMAKE_PROJECT_NAME}
ReactAndroid::react_nativemodule_core
ReactAndroid::reactnativejni
ReactAndroid::runtimeexecutor
ReactAndroid::react_nativemodule_core
react-native-reanimated::worklets)
)
else ()
message(FATAL_ERROR "react-native-live-markdown requires react-native 0.75 or newer.")
endif ()
110 changes: 51 additions & 59 deletions android/src/main/new_arch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,84 +18,76 @@ file(GLOB LIB_CODEGEN_SRCS CONFIGURE_DEPENDS ${LIB_ANDROID_GENERATED_COMPONENTS_
set(RN_DIR ${LIB_ANDROID_DIR}/../example/node_modules/react-native)

add_library(
${LIB_TARGET_NAME}
SHARED
${LIB_MODULE_SRCS}
${LIB_CUSTOM_SRCS}
${LIB_CODEGEN_SRCS}
${LIB_TARGET_NAME}
SHARED
${LIB_MODULE_SRCS}
${LIB_CUSTOM_SRCS}
${LIB_CODEGEN_SRCS}
)

target_include_directories(
${LIB_TARGET_NAME}
PUBLIC
.
${LIB_ANDROID_GENERATED_JNI_DIR}
${LIB_ANDROID_GENERATED_COMPONENTS_DIR}
${LIB_CPP_DIR}
${LIB_TARGET_NAME}
PUBLIC
.
${LIB_ANDROID_GENERATED_JNI_DIR}
${LIB_ANDROID_GENERATED_COMPONENTS_DIR}
${LIB_CPP_DIR}
)

find_package(fbjni REQUIRED CONFIG)
find_package(ReactAndroid REQUIRED CONFIG)

target_link_libraries(
${LIB_TARGET_NAME}
fbjni::fbjni
ReactAndroid::jsi
)

if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
target_link_libraries(
${LIB_TARGET_NAME}
ReactAndroid::reactnative
ReactAndroid::jsi
fbjni::fbjni
${LIB_TARGET_NAME}
ReactAndroid::reactnative
)
elseif (ReactAndroid_VERSION_MINOR GREATER_EQUAL 75)
target_link_libraries(
${LIB_TARGET_NAME}
ReactAndroid::rrc_text
ReactAndroid::rrc_textinput
ReactAndroid::react_render_textlayoutmanager
ReactAndroid::react_render_imagemanager
ReactAndroid::reactnativejni
ReactAndroid::mapbufferjni
fabricjni
fbjni
folly_runtime
glog
jsi
react_codegen_rncore
react_debug
react_nativemodule_core
react_render_core
react_render_debug
react_render_graphics
react_render_mapbuffer
ReactAndroid::react_render_uimanager
ReactAndroid::react_render_scheduler
react_utils
runtimeexecutor
rrc_view
turbomodulejsijni
yoga
android
log
mapbufferjni
reactnativejni
react_render_consistency
react_performance_timeline
react_render_observers_events
react_featureflags
${LIB_TARGET_NAME}
ReactAndroid::fabricjni
ReactAndroid::folly_runtime
ReactAndroid::glog
ReactAndroid::react_debug
ReactAndroid::react_nativemodule_core
ReactAndroid::react_performance_timeline
ReactAndroid::react_render_consistency
ReactAndroid::react_render_core
ReactAndroid::react_render_debug
ReactAndroid::react_render_graphics
ReactAndroid::react_render_imagemanager
ReactAndroid::react_render_mapbuffer
ReactAndroid::react_render_observers_events
ReactAndroid::react_render_textlayoutmanager
ReactAndroid::reactnativejni
ReactAndroid::rrc_text
ReactAndroid::rrc_textinput
ReactAndroid::rrc_view
ReactAndroid::runtimeexecutor
ReactAndroid::yoga
)
else ()
message(FATAL_ERROR "react-native-live-markdown requires react-native 0.75 or newer.")
endif ()

target_compile_options(
${LIB_TARGET_NAME}
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
-frtti
-Wall
-std=c++20
${LIB_TARGET_NAME}
PRIVATE
-DLOG_TAG=\"ReactNative\"
-fexceptions
-frtti
-Wall
-std=c++20
)

target_include_directories(
${CMAKE_PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#if defined(RCT_NEW_ARCH_ENABLED) || defined(ANDROID)

#include <react/renderer/core/LayoutContext.h>

#include "MarkdownShadowFamilyRegistry.h"
#include "MarkdownTextInputDecoratorShadowNode.h"

using namespace expensify::livemarkdown;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "MarkdownShadowFamilyRegistry.h"
#include "MarkdownTextInputDecoratorState.h"
#include <jsi/jsi.h>
#include "OwningShadowNodeFragment.h"
#include <react/renderer/components/RNLiveMarkdownSpec/EventEmitters.h>
#include <react/renderer/components/RNLiveMarkdownSpec/Props.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
Expand All @@ -13,20 +13,6 @@ using namespace expensify::livemarkdown;
namespace facebook {
namespace react {

struct OwningShadowNodeFragment {
Props::Shared props;
ShadowNode::SharedListOfShared children;
State::Shared state;

operator ShadowNodeFragment() const {
return ShadowNodeFragment {
.props = props,
.children = children,
.state = state
};
}
};

JSI_EXPORT extern const char MarkdownTextInputDecoratorViewComponentName[];

class JSI_EXPORT MarkdownTextInputDecoratorShadowNode final
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once
#if defined(RCT_NEW_ARCH_ENABLED) || defined(ANDROID)

#include <react/renderer/core/Props.h>
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/core/ShadowNodeFragment.h>
#include <react/renderer/core/State.h>

using namespace facebook::react;

namespace expensify {
namespace livemarkdown {

struct OwningShadowNodeFragment {
Props::Shared props;
ShadowNode::SharedListOfShared children;
State::Shared state;

operator ShadowNodeFragment() const {
return ShadowNodeFragment {
.props = props,
.children = children,
.state = state
};
}
};

} // namespace livemarkdown
} // namespace expensify

#endif
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expensify/react-native-live-markdown",
"version": "0.1.145",
"version": "0.1.150",
"description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
4 changes: 4 additions & 0 deletions src/web/MarkdownTextInput.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
display: none;
}

.react-native-live-markdown-input-singleline span[data-type="text"] {
vertical-align: middle;
}

.react-native-live-markdown-input-singleline:empty::before,
.react-native-live-markdown-input-multiline:empty::before {
pointer-events: none;
Expand Down

0 comments on commit 769e7a3

Please sign in to comment.