feat: support Fabric on Android (#1804)

Most of Android changes for Fabric and bump of FabricExample to RN 0.69.2. iOS and JS changes are available in #1821.
The most notable change on Android is adding methods to components that accept String values of each NumberProp instead of Dynamic. Another change is changed structure of RenderableViewManager.java since we needed to abstract methods that belong only to components inheriting from VirtualView in order to be able to properly override them in their children.
This commit is contained in:
Wojciech Lewicki
2022-08-12 11:42:44 +02:00
committed by GitHub
parent 8f1bda4856
commit 77267be5fc
91 changed files with 7554 additions and 2731 deletions

View File

@@ -1,34 +1,80 @@
name: Test Android build name: Test Android build
on: on:
pull_request: pull_request:
branches:
- main
paths: paths:
- '.github/workflows/android-build-test.yml'
- 'android/**' - 'android/**'
- 'common/**'
- 'Example/android/**'
- 'FabricExample/android/**'
push: push:
branches: branches:
- main - main
workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: strategy:
WORKING_DIRECTORY: Example matrix:
working-directory: [Example, FabricExample]
concurrency: concurrency:
group: android-${{ github.ref }} group: android-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
steps: steps:
- name: checkout - name: Check out Git repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2 - name: Set up JDK 11
uses: actions/setup-java@v1
with: with:
node-version: 14 java-version: '11'
cache: 'yarn'
cache-dependency-path: 'Example/yarn.lock' - name: Accept licenses
- name: Install node dependencies run: /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
working-directory: ${{ env.WORKING_DIRECTORY }}
run: yarn - name: Restore svg node_modules from cache
uses: actions/cache@v2
id: cache-node-modules-svg
with:
path: |
node_modules
key: ${{ runner.os }}-node-modules-svg-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-svg
- name: Install svg node_modules
run: yarn install --frozen-lockfile
- name: Restore app node_modules from cache
uses: actions/cache@v2
id: cache-node-modules-app
with:
path: |
${{ matrix.working-directory }}/node_modules
key: ${{ runner.os }}-node-modules-${{ matrix.working-directory }}-${{ hashFiles(format('{0}/yarn.lock', matrix.working-directory)) }}
restore-keys: |
${{ runner.os }}-node-modules-${{ matrix.working-directory }}-
- name: Install app node_modules
working-directory: ${{ matrix.working-directory }}
run: yarn install --frozen-lockfile
- name: Restore build from cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
android/build
android/.cxx
${{ matrix.working-directory }}/android/build
${{ matrix.working-directory }}/android/.cxx
${{ matrix.working-directory }}/android/.gradle
${{ matrix.working-directory }}/android/app/build
${{ matrix.working-directory }}/android/app/.cxx
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/build
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/hermes-engine/build
${{ matrix.working-directory }}/node_modules/react-native/ReactAndroid/hermes-engine/.cxx
key: ${{ runner.os }}-build5-${{ matrix.working-directory }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'android/build.gradle', format('{0}/node_modules/react-native/sdks/.hermesversion', matrix.working-directory)) }}
- name: Build app - name: Build app
working-directory: ${{ env.WORKING_DIRECTORY }}/android working-directory: ${{ matrix.working-directory }}/android
run: ./gradlew assembleDebug --console=plain run: ./gradlew assembleDebug --build-cache --console=plain -PreactNativeArchitectures=arm64-v8a

View File

@@ -52,7 +52,6 @@ nonstrict-import=warn
deprecated-type=warn deprecated-type=warn
unsafe-getters-setters=warn unsafe-getters-setters=warn
unnecessary-invariant=warn unnecessary-invariant=warn
signature-verification-failure=warn
[strict] [strict]
deprecated-type deprecated-type
@@ -64,4 +63,4 @@ untyped-import
untyped-type-import untyped-type-import
[version] [version]
^0.170.0 ^0.176.3

View File

@@ -20,6 +20,7 @@ DerivedData
*.hmap *.hmap
*.ipa *.ipa
*.xcuserstate *.xcuserstate
ios/.xcode.env.local
# Android/IntelliJ # Android/IntelliJ
# #
@@ -49,9 +50,10 @@ buck-out/
# For more information about the recommended setup visit: # For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/ # https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml **/fastlane/report.xml
*/fastlane/Preview.html **/fastlane/Preview.html
*/fastlane/screenshots **/fastlane/screenshots
**/fastlane/test_output
# Bundle artifact # Bundle artifact
*.jsbundle *.jsbundle

View File

@@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4' ruby '2.7.5'
gem 'cocoapods', '~> 1.11', '>= 1.11.2' gem 'cocoapods', '~> 1.11', '>= 1.11.2'

View File

@@ -1 +1 @@
2.7.4 2.7.5

View File

@@ -1,7 +1,6 @@
apply plugin: "com.android.application" apply plugin: "com.android.application"
import com.android.build.OutputFile import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os
/** /**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -79,7 +78,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
*/ */
project.ext.react = [ project.ext.react = [
enableHermes: false, // clean and rebuild if changing enableHermes: true, // clean and rebuild if changing
] ]
apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native/react.gradle"
@@ -152,18 +151,13 @@ android {
"GENERATED_SRC_DIR=$buildDir/generated/source", "GENERATED_SRC_DIR=$buildDir/generated/source",
"PROJECT_BUILD_DIR=$buildDir", "PROJECT_BUILD_DIR=$buildDir",
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build" "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"NODE_MODULES_DIR=$rootDir/../node_modules"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1" cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17" cppFlags "-std=c++17"
// Make sure this target name is the same you specify inside the // Make sure this target name is the same you specify inside the
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable. // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
targets "fabricexample_appmodules" targets "fabricexample_appmodules"
// Fix for windows limit on number of character in file paths and in command lines
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
arguments "NDK_OUT=${rootProject.projectDir.getParent()}\\.cxx",
"NDK_APP_SHORT_COMMANDS=true"
}
} }
} }
if (!enableSeparateBuildPerCPUArchitecture) { if (!enableSeparateBuildPerCPUArchitecture) {
@@ -283,9 +277,10 @@ dependencies {
} }
if (enableHermes) { if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/"; //noinspection GradleDynamicVersion
debugImplementation files(hermesPath + "hermes-debug.aar") implementation("com.facebook.react:hermes-engine:+") { // From node_modules
releaseImplementation files(hermesPath + "hermes-release.aar") exclude group:'com.facebook.fbjni'
}
} else { } else {
implementation jscFlavor implementation jscFlavor
} }
@@ -298,7 +293,11 @@ if (isNewArchitectureEnabled()) {
configurations.all { configurations.all {
resolutionStrategy.dependencySubstitution { resolutionStrategy.dependencySubstitution {
substitute(module("com.facebook.react:react-native")) substitute(module("com.facebook.react:react-native"))
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source") .using(project(":ReactAndroid"))
.because("On New Architecture we're building React Native from source")
substitute(module("com.facebook.react:hermes-engine"))
.using(project(":ReactAndroid:hermes-engine"))
.because("On New Architecture we're building Hermes from source")
} }
} }
} }
@@ -318,4 +317,4 @@ def isNewArchitectureEnabled() {
// - Invoke gradle with `-newArchEnabled=true` // - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
} }

View File

@@ -17,7 +17,8 @@ public class MainActivity extends ReactActivity {
/** /**
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
* you can specify the rendered you wish to use (Fabric or the older renderer). * you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
* (Paper).
*/ */
@Override @Override
protected ReactActivityDelegate createReactActivityDelegate() { protected ReactActivityDelegate createReactActivityDelegate() {
@@ -36,5 +37,12 @@ public class MainActivity extends ReactActivity {
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView; return reactRootView;
} }
@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
} }
} }

View File

@@ -16,8 +16,8 @@ import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.UIManager; import com.facebook.react.bridge.UIManager;
import com.facebook.react.fabric.ComponentFactory; import com.facebook.react.fabric.ComponentFactory;
import com.facebook.react.fabric.CoreComponentsRegistry; import com.facebook.react.fabric.CoreComponentsRegistry;
import com.facebook.react.fabric.EmptyReactNativeConfig;
import com.facebook.react.fabric.FabricJSIModuleProvider; import com.facebook.react.fabric.FabricJSIModuleProvider;
import com.facebook.react.fabric.ReactNativeConfig;
import com.facebook.react.uimanager.ViewManagerRegistry; import com.facebook.react.uimanager.ViewManagerRegistry;
import com.fabricexample.BuildConfig; import com.fabricexample.BuildConfig;
import com.fabricexample.newarchitecture.components.MainComponentsRegistry; import com.fabricexample.newarchitecture.components.MainComponentsRegistry;
@@ -105,7 +105,7 @@ public class MainApplicationReactNativeHost extends ReactNativeHost {
return new FabricJSIModuleProvider( return new FabricJSIModuleProvider(
reactApplicationContext, reactApplicationContext,
componentFactory, componentFactory,
new EmptyReactNativeConfig(), ReactNativeConfig.DEFAULT_CONFIG,
viewManagerRegistry); viewManagerRegistry);
} }
}); });

View File

@@ -17,7 +17,7 @@ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
# If you wish to add a custom TurboModule or Fabric component in your app you # If you wish to add a custom TurboModule or Fabric component in your app you
# will have to uncomment those lines to include the generated source # will have to uncomment those lines to include the generated source
# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni) # files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni)
# #
# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni # LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
@@ -28,8 +28,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \
libfabricjni \ libfabricjni \
libfbjni \ libfbjni \
libfolly_futures \ libfolly_runtime \
libfolly_json \
libglog \ libglog \
libjsi \ libjsi \
libreact_codegen_rncore \ libreact_codegen_rncore \

View File

@@ -12,10 +12,6 @@ buildscript {
if (System.properties['os.arch'] == "aarch64") { if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64 // For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888" ndkVersion = "24.0.8215888"
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// For Android Users, we need to use NDK 23, otherwise the build will
// fail due to paths longer than the OS limit
ndkVersion = "23.1.7779620"
} else { } else {
// Otherwise we default to the side-by-side NDK version from AGP. // Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529" ndkVersion = "21.4.7075529"
@@ -26,9 +22,9 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:7.0.4") classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin") classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2") classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
@@ -54,4 +50,4 @@ allprojects {
google() google()
maven { url 'https://www.jitpack.io' } maven { url 'https://www.jitpack.io' }
} }
} }

View File

@@ -6,4 +6,6 @@ includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid") include(":ReactAndroid")
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid') project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
include(":ReactAndroid:hermes-engine")
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
} }

View File

@@ -256,13 +256,15 @@
files = ( files = (
); );
inputPaths = ( inputPaths = (
"$(SRCROOT)/.xcode.env.local",
"$(SRCROOT)/.xcode.env",
); );
name = "Bundle React Native code and images"; name = "Bundle React Native code and images";
outputPaths = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
}; };
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@@ -436,7 +438,7 @@
"$(inherited)", "$(inherited)",
); );
INFOPLIST_FILE = FabricExampleTests/Info.plist; INFOPLIST_FILE = FabricExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@@ -460,7 +462,7 @@
BUNDLE_LOADER = "$(TEST_HOST)"; BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = FabricExampleTests/Info.plist; INFOPLIST_FILE = FabricExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@@ -576,7 +578,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift, /usr/lib/swift,
"$(inherited)", "$(inherited)",
@@ -594,6 +596,7 @@
"-DFOLLY_MOBILE=1", "-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1", "-DFOLLY_USE_LIBCPP=1",
); );
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos; SDKROOT = iphoneos;
}; };
name = Debug; name = Debug;
@@ -640,7 +643,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift, /usr/lib/swift,
"$(inherited)", "$(inherited)",
@@ -657,6 +660,7 @@
"-DFOLLY_MOBILE=1", "-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1", "-DFOLLY_USE_LIBCPP=1",
); );
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos; SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };

View File

@@ -16,6 +16,8 @@
#import <react/config/ReactNativeConfig.h> #import <react/config/ReactNativeConfig.h>
static NSString *const kRNConcurrentRoot = @"concurrentRoot";
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> { @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
RCTTurboModuleManager *_turboModuleManager; RCTTurboModuleManager *_turboModuleManager;
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
@@ -41,7 +43,8 @@
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
#endif #endif
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"FabricExample", nil); NSDictionary *initProps = [self prepareInitialProps];
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"FabricExample", initProps);
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor]; rootView.backgroundColor = [UIColor systemBackgroundColor];
@@ -57,6 +60,28 @@
return YES; return YES;
} }
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
// Switch this bool to turn on and off the concurrent root
return true;
}
- (NSDictionary *)prepareInitialProps
{
NSMutableDictionary *initProps = [NSMutableDictionary new];
#ifdef RCT_NEW_ARCH_ENABLED
initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
#endif
return initProps;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{ {
#if DEBUG #if DEBUG

View File

@@ -1,9 +1,11 @@
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0' platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false install! 'cocoapods', :deterministic_uuids => false
production = ENV["PRODUCTION"] == "1"
ENV['RCT_NEW_ARCH_ENABLED'] = '1' ENV['RCT_NEW_ARCH_ENABLED'] = '1'
target 'FabricExample' do target 'FabricExample' do
@@ -15,8 +17,10 @@ target 'FabricExample' do
use_react_native!( use_react_native!(
:path => config[:reactNativePath], :path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods # to enable hermes on iOS, change `false` to `true` and then install pods
:production => production,
:hermes_enabled => flags[:hermes_enabled], :hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled], :fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.enabled,
# An absolute path to your application root. # An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.." :app_path => "#{Pod::Config.instance.installation_root}/.."
) )
@@ -26,12 +30,6 @@ target 'FabricExample' do
# Pods for testing # Pods for testing
end end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer| post_install do |installer|
react_native_post_install(installer) react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)

View File

@@ -10,8 +10,8 @@
"lint": "eslint ." "lint": "eslint ."
}, },
"dependencies": { "dependencies": {
"react": "17.0.2", "react": "18.0.0",
"react-native": "^0.68.1", "react-native": "0.69.2",
"react-native-svg": "link:../" "react-native-svg": "link:../"
}, },
"devDependencies": { "devDependencies": {
@@ -21,8 +21,8 @@
"babel-jest": "^26.6.3", "babel-jest": "^26.6.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"jest": "^26.6.3", "jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.67.0", "metro-react-native-babel-preset": "^0.70.3",
"react-test-renderer": "17.0.2" "react-test-renderer": "18.0.0"
}, },
"jest": { "jest": {
"preset": "react-native" "preset": "react-native"

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,6 @@ Pod::Spec.new do |s|
if fabric_enabled if fabric_enabled
# folly_version must match the version used in React Native # folly_version must match the version used in React Native
# See folly_version in react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec # See folly_version in react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec
folly_version = '2021.06.28.00-v2'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
s.pod_target_xcconfig = { s.pod_target_xcconfig = {
@@ -35,7 +34,7 @@ Pod::Spec.new do |s|
s.dependency "React" s.dependency "React"
s.dependency "React-RCTFabric" s.dependency "React-RCTFabric"
s.dependency "React-Codegen" s.dependency "React-Codegen"
s.dependency "RCT-Folly", folly_version s.dependency "RCT-Folly"
s.dependency "RCTRequired" s.dependency "RCTRequired"
s.dependency "RCTTypeSafety" s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core" s.dependency "ReactCommon/turbomodule/core"

View File

@@ -14,6 +14,18 @@ buildscript {
} }
} }
def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either:
// - Set `newArchEnabled` to true inside the `gradle.properties` file
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) { def safeExtGet(prop, fallback) {
@@ -23,14 +35,71 @@ def safeExtGet(prop, fallback) {
android { android {
compileSdkVersion safeExtGet('compileSdkVersion', 28) compileSdkVersion safeExtGet('compileSdkVersion', 28)
// Used to override the NDK path/version on internal CI or by allowing
// users to customize the NDK path/version from their root project (e.g. for M1 support)
if (rootProject.hasProperty("ndkPath")) {
ndkPath rootProject.ext.ndkPath
}
if (rootProject.hasProperty("ndkVersion")) {
ndkVersion rootProject.ext.ndkVersion
}
defaultConfig { defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16) minSdkVersion safeExtGet('minSdkVersion', 16)
//noinspection OldTargetApi //noinspection OldTargetApi
targetSdkVersion safeExtGet('targetSdkVersion', 28) targetSdkVersion safeExtGet('targetSdkVersion', 28)
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {
var appProject = rootProject.allprojects.find {it.plugins.hasPlugin('com.android.application')}
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21",
"APP_STL=c++_shared",
"NDK_TOOLCHAIN_VERSION=clang",
"GENERATED_SRC_DIR=${appProject.buildDir}/generated/source",
"PROJECT_BUILD_DIR=${appProject.buildDir}",
"REACT_ANDROID_DIR=${appProject.rootDir}/../node_modules/react-native/ReactAndroid",
"REACT_ANDROID_BUILD_DIR=${appProject.rootDir}/../node_modules/react-native/ReactAndroid/build"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17"
targets "rnsvg_modules"
}
}
}
} }
lintOptions { lintOptions {
abortOnError false abortOnError false
} }
if (isNewArchitectureEnabled()) {
externalNativeBuild {
ndkBuild {
path "src/main/jni/Android.mk"
}
}
}
packagingOptions {
// For some reason gradle only complains about the duplicated version of libreact_render libraries
// while there are more libraries copied in intermediates folder of the lib build directory, we exlude
// only the ones that make the build fail (ideally we should only include librnscreens_modules but we
// are only allowed to specify exlude patterns)
exclude "**/libreact_render*.so"
}
sourceSets.main {
java {
if (isNewArchitectureEnabled()) {
srcDirs += [
"src/fabric/java",
]
} else {
srcDirs += [
"src/paper/java",
"build/generated/source/codegen/java"
]
}
}
}
} }
repositories { repositories {
@@ -44,6 +113,19 @@ repositories {
} }
dependencies { dependencies {
//noinspection GradleDynamicVersion if (isNewArchitectureEnabled()) {
implementation "com.facebook.react:react-native:+" implementation project(":ReactAndroid")
} else {
implementation 'com.facebook.react:react-native:+'
}
} }
if (isNewArchitectureEnabled()) {
react {
reactRoot = rootProject.file("../node_modules/react-native/")
jsRootDir = file("../src/fabric/")
codegenDir = rootProject.file("../node_modules/react-native-codegen/")
libraryName = "rnsvg"
codegenJavaPackageName = "com.horcrux.rnsvg"
}
}

View File

@@ -0,0 +1,59 @@
package com.horcrux.svg;
import android.content.Context;
import android.view.ViewGroup;
import androidx.annotation.UiThread;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.uimanager.FabricViewStateManager;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.FabricViewStateManager.HasFabricViewStateManager;
import com.facebook.react.uimanager.FabricViewStateManager.StateUpdateCallback;
import com.facebook.react.views.view.ReactViewGroup;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class FabricEnabledViewGroup extends ReactViewGroup implements HasFabricViewStateManager {
private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager();
@NotNull
public FabricViewStateManager getFabricViewStateManager() {
return this.mFabricViewStateManager;
}
protected final void updateScreenSizeFabric(int width, int height) {
this.updateState(width, height);
}
@UiThread
public final void updateState(int width, int height) {
final float realWidth = PixelUtil.toDIPFromPixel((float)width);
final float realHeight = PixelUtil.toDIPFromPixel((float)height);
ReadableMap currentState = this.mFabricViewStateManager.getStateData();
if (currentState != null) {
float delta = 0.9F;
float stateFrameHeight = currentState.hasKey("frameHeight") ? (float)currentState.getDouble("frameHeight") : 0.0F;
float stateFrameWidth = currentState.hasKey("frameWidth") ? (float)currentState.getDouble("frameWidth") : 0.0F;
if (Math.abs(stateFrameWidth - realWidth) < delta &&
Math.abs(stateFrameHeight - realHeight) < delta) {
return;
}
}
this.mFabricViewStateManager.setState((StateUpdateCallback)(new StateUpdateCallback() {
public final WritableMap getStateUpdate() {
WritableMap map = (WritableMap)(new WritableNativeMap());
map.putDouble("frameWidth", (double)realWidth);
map.putDouble("frameHeight", (double)realHeight);
return map;
}
}));
}
public FabricEnabledViewGroup(@Nullable ReactContext context) {
super((Context)context);
}
}

View File

@@ -0,0 +1,28 @@
package com.horcrux.svg;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.fabric.ComponentFactory;
import com.facebook.soloader.SoLoader;
@DoNotStrip
public class RNSvgComponentsRegistry {
static {
SoLoader.loadLibrary("rnsvg_modules");
}
@DoNotStrip private final HybridData mHybridData;
@DoNotStrip
private native HybridData initHybrid(ComponentFactory componentFactory);
@DoNotStrip
private RNSvgComponentsRegistry(ComponentFactory componentFactory) {
mHybridData = initHybrid(componentFactory);
}
@DoNotStrip
public static RNSvgComponentsRegistry register(ComponentFactory componentFactory) {
return new RNSvgComponentsRegistry(componentFactory);
}
}

View File

@@ -35,18 +35,33 @@ class CircleView extends RenderableView {
invalidate(); invalidate();
} }
public void setCx(String cx) {
mCx = SVGLength.from(cx);
invalidate();
}
@ReactProp(name = "cy") @ReactProp(name = "cy")
public void setCy(Dynamic cy) { public void setCy(Dynamic cy) {
mCy = SVGLength.from(cy); mCy = SVGLength.from(cy);
invalidate(); invalidate();
} }
public void setCy(String cy) {
mCy = SVGLength.from(cy);
invalidate();
}
@ReactProp(name = "r") @ReactProp(name = "r")
public void setR(Dynamic r) { public void setR(Dynamic r) {
mR = SVGLength.from(r); mR = SVGLength.from(r);
invalidate(); invalidate();
} }
public void setR(String r) {
mR = SVGLength.from(r);
invalidate();
}
@Override @Override
Path getPath(Canvas canvas, Paint paint) { Path getPath(Canvas canvas, Paint paint) {
Path path = new Path(); Path path = new Path();

View File

@@ -36,24 +36,44 @@ class EllipseView extends RenderableView {
invalidate(); invalidate();
} }
public void setCx(String cx) {
mCx = SVGLength.from(cx);
invalidate();
}
@ReactProp(name = "cy") @ReactProp(name = "cy")
public void setCy(Dynamic cy) { public void setCy(Dynamic cy) {
mCy = SVGLength.from(cy); mCy = SVGLength.from(cy);
invalidate(); invalidate();
} }
public void setCy(String cy) {
mCy = SVGLength.from(cy);
invalidate();
}
@ReactProp(name = "rx") @ReactProp(name = "rx")
public void setRx(Dynamic rx) { public void setRx(Dynamic rx) {
mRx = SVGLength.from(rx); mRx = SVGLength.from(rx);
invalidate(); invalidate();
} }
public void setRx(String rx) {
mRx = SVGLength.from(rx);
invalidate();
}
@ReactProp(name = "ry") @ReactProp(name = "ry")
public void setRy(Dynamic ry) { public void setRy(Dynamic ry) {
mRy = SVGLength.from(ry); mRy = SVGLength.from(ry);
invalidate(); invalidate();
} }
public void setRy(String ry) {
mRy = SVGLength.from(ry);
invalidate();
}
@Override @Override
Path getPath(Canvas canvas, Paint paint) { Path getPath(Canvas canvas, Paint paint) {
Path path = new Path(); Path path = new Path();

View File

@@ -57,24 +57,44 @@ class ForeignObjectView extends GroupView {
invalidate(); invalidate();
} }
public void setX(String x) {
mX = SVGLength.from(x);
invalidate();
}
@ReactProp(name = "y") @ReactProp(name = "y")
public void setY(Dynamic y) { public void setY(Dynamic y) {
mY = SVGLength.from(y); mY = SVGLength.from(y);
invalidate(); invalidate();
} }
public void setY(String y) {
mY = SVGLength.from(y);
invalidate();
}
@ReactProp(name = "width") @ReactProp(name = "width")
public void setWidth(Dynamic width) { public void setWidth(Dynamic width) {
mW = SVGLength.from(width); mW = SVGLength.from(width);
invalidate(); invalidate();
} }
public void setWidth(String width) {
mW = SVGLength.from(width);
invalidate();
}
@ReactProp(name = "height") @ReactProp(name = "height")
public void setHeight(Dynamic height) { public void setHeight(Dynamic height) {
mH = SVGLength.from(height); mH = SVGLength.from(height);
invalidate(); invalidate();
} }
public void setHeight(String height) {
mH = SVGLength.from(height);
invalidate();
}
void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { void drawGroup(final Canvas canvas, final Paint paint, final float opacity) {
pushGlyphContext(); pushGlyphContext();
final SvgView svg = getSvgView(); final SvgView svg = getSvgView();

View File

@@ -64,24 +64,45 @@ class ImageView extends RenderableView {
invalidate(); invalidate();
} }
public void setX(String x) {
mX = SVGLength.from(x);
invalidate();
}
@ReactProp(name = "y") @ReactProp(name = "y")
public void setY(Dynamic y) { public void setY(Dynamic y) {
mY = SVGLength.from(y); mY = SVGLength.from(y);
invalidate(); invalidate();
} }
public void setY(String y) {
mY = SVGLength.from(y);
invalidate();
}
@ReactProp(name = "width") @ReactProp(name = "width")
public void setWidth(Dynamic width) { public void setWidth(Dynamic width) {
mW = SVGLength.from(width); mW = SVGLength.from(width);
invalidate(); invalidate();
} }
public void setWidth(String width) {
mW = SVGLength.from(width);
invalidate();
}
@ReactProp(name = "height") @ReactProp(name = "height")
public void setHeight(Dynamic height) { public void setHeight(Dynamic height) {
mH = SVGLength.from(height); mH = SVGLength.from(height);
invalidate(); invalidate();
} }
public void setHeight(String height) {
mH = SVGLength.from(height);
invalidate();
}
@ReactProp(name = "src") @ReactProp(name = "src")
public void setSrc(@Nullable ReadableMap src) { public void setSrc(@Nullable ReadableMap src) {
if (src != null) { if (src != null) {

View File

@@ -35,24 +35,44 @@ class LineView extends RenderableView {
invalidate(); invalidate();
} }
public void setX1(String x1) {
mX1 = SVGLength.from(x1);
invalidate();
}
@ReactProp(name = "y1") @ReactProp(name = "y1")
public void setY1(Dynamic y1) { public void setY1(Dynamic y1) {
mY1 = SVGLength.from(y1); mY1 = SVGLength.from(y1);
invalidate(); invalidate();
} }
public void setY1(String y1) {
mY1 = SVGLength.from(y1);
invalidate();
}
@ReactProp(name = "x2") @ReactProp(name = "x2")
public void setX2(Dynamic x2) { public void setX2(Dynamic x2) {
mX2 = SVGLength.from(x2); mX2 = SVGLength.from(x2);
invalidate(); invalidate();
} }
public void setX2(String x2) {
mX2 = SVGLength.from(x2);
invalidate();
}
@ReactProp(name = "y2") @ReactProp(name = "y2")
public void setY2(Dynamic y2) { public void setY2(Dynamic y2) {
mY2 = SVGLength.from(y2); mY2 = SVGLength.from(y2);
invalidate(); invalidate();
} }
public void setY2(String y2) {
mY2 = SVGLength.from(y2);
invalidate();
}
@Override @Override
Path getPath(Canvas canvas, Paint paint) { Path getPath(Canvas canvas, Paint paint) {
Path path = new Path(); Path path = new Path();

View File

@@ -48,24 +48,44 @@ class LinearGradientView extends DefinitionView {
invalidate(); invalidate();
} }
public void setX1(String x1) {
mX1 = SVGLength.from(x1);
invalidate();
}
@ReactProp(name = "y1") @ReactProp(name = "y1")
public void setY1(Dynamic y1) { public void setY1(Dynamic y1) {
mY1 = SVGLength.from(y1); mY1 = SVGLength.from(y1);
invalidate(); invalidate();
} }
public void setY1(String y1) {
mY1 = SVGLength.from(y1);
invalidate();
}
@ReactProp(name = "x2") @ReactProp(name = "x2")
public void setX2(Dynamic x2) { public void setX2(Dynamic x2) {
mX2 = SVGLength.from(x2); mX2 = SVGLength.from(x2);
invalidate(); invalidate();
} }
public void setX2(String x2) {
mX2 = SVGLength.from(x2);
invalidate();
}
@ReactProp(name = "y2") @ReactProp(name = "y2")
public void setY2(Dynamic y2) { public void setY2(Dynamic y2) {
mY2 = SVGLength.from(y2); mY2 = SVGLength.from(y2);
invalidate(); invalidate();
} }
public void setY2(String y2) {
mY2 = SVGLength.from(y2);
invalidate();
}
@ReactProp(name = "gradient") @ReactProp(name = "gradient")
public void setGradient(ReadableArray gradient) { public void setGradient(ReadableArray gradient) {
mGradient = gradient; mGradient = gradient;

View File

@@ -49,24 +49,44 @@ class MarkerView extends GroupView {
invalidate(); invalidate();
} }
public void setRefX(String refX) {
mRefX = SVGLength.from(refX);
invalidate();
}
@ReactProp(name = "refY") @ReactProp(name = "refY")
public void setRefY(Dynamic refY) { public void setRefY(Dynamic refY) {
mRefY = SVGLength.from(refY); mRefY = SVGLength.from(refY);
invalidate(); invalidate();
} }
public void setRefY(String refY) {
mRefY = SVGLength.from(refY);
invalidate();
}
@ReactProp(name = "markerWidth") @ReactProp(name = "markerWidth")
public void setMarkerWidth(Dynamic markerWidth) { public void setMarkerWidth(Dynamic markerWidth) {
mMarkerWidth = SVGLength.from(markerWidth); mMarkerWidth = SVGLength.from(markerWidth);
invalidate(); invalidate();
} }
public void setMarkerWidth(String markerWidth) {
mMarkerWidth = SVGLength.from(markerWidth);
invalidate();
}
@ReactProp(name = "markerHeight") @ReactProp(name = "markerHeight")
public void setMarkerHeight(Dynamic markerHeight) { public void setMarkerHeight(Dynamic markerHeight) {
mMarkerHeight = SVGLength.from(markerHeight); mMarkerHeight = SVGLength.from(markerHeight);
invalidate(); invalidate();
} }
public void setMarkerHeight(String markerHeight) {
mMarkerHeight = SVGLength.from(markerHeight);
invalidate();
}
@ReactProp(name = "markerUnits") @ReactProp(name = "markerUnits")
public void setMarkerUnits(String markerUnits) { public void setMarkerUnits(String markerUnits) {
mMarkerUnits = markerUnits; mMarkerUnits = markerUnits;

View File

@@ -52,24 +52,44 @@ class MaskView extends GroupView {
invalidate(); invalidate();
} }
public void setX(String x) {
mX = SVGLength.from(x);
invalidate();
}
@ReactProp(name = "y") @ReactProp(name = "y")
public void setY(Dynamic y) { public void setY(Dynamic y) {
mY = SVGLength.from(y); mY = SVGLength.from(y);
invalidate(); invalidate();
} }
public void setY(String y) {
mY = SVGLength.from(y);
invalidate();
}
@ReactProp(name = "width") @ReactProp(name = "width")
public void setWidth(Dynamic width) { public void setWidth(Dynamic width) {
mW = SVGLength.from(width); mW = SVGLength.from(width);
invalidate(); invalidate();
} }
public void setWidth(String width) {
mW = SVGLength.from(width);
invalidate();
}
@ReactProp(name = "height") @ReactProp(name = "height")
public void setHeight(Dynamic height) { public void setHeight(Dynamic height) {
mH = SVGLength.from(height); mH = SVGLength.from(height);
invalidate(); invalidate();
} }
public void setHeight(String height) {
mH = SVGLength.from(height);
invalidate();
}
@ReactProp(name = "maskUnits") @ReactProp(name = "maskUnits")
public void setMaskUnits(int maskUnits) { public void setMaskUnits(int maskUnits) {
switch (maskUnits) { switch (maskUnits) {

View File

@@ -56,24 +56,43 @@ class PatternView extends GroupView {
invalidate(); invalidate();
} }
public void setX(String x) {
mX = SVGLength.from(x);
invalidate();
}
@ReactProp(name = "y") @ReactProp(name = "y")
public void setY(Dynamic y) { public void setY(Dynamic y) {
mY = SVGLength.from(y); mY = SVGLength.from(y);
invalidate(); invalidate();
} }
public void setY(String y) {
mY = SVGLength.from(y);
invalidate();
}
@ReactProp(name = "width") @ReactProp(name = "width")
public void setWidth(Dynamic width) { public void setWidth(Dynamic width) {
mW = SVGLength.from(width); mW = SVGLength.from(width);
invalidate(); invalidate();
} }
public void setWidth(String width) {
mW = SVGLength.from(width);
invalidate();
}
@ReactProp(name = "height") @ReactProp(name = "height")
public void setHeight(Dynamic height) { public void setHeight(Dynamic height) {
mH = SVGLength.from(height); mH = SVGLength.from(height);
invalidate(); invalidate();
} }
public void setHeight(String height) {
mH = SVGLength.from(height);
invalidate();
}
@ReactProp(name = "patternUnits") @ReactProp(name = "patternUnits")
public void setPatternUnits(int patternUnits) { public void setPatternUnits(int patternUnits) {
switch (patternUnits) { switch (patternUnits) {

View File

@@ -49,36 +49,66 @@ class RadialGradientView extends DefinitionView {
invalidate(); invalidate();
} }
public void setFx(String fx) {
mFx = SVGLength.from(fx);
invalidate();
}
@ReactProp(name = "fy") @ReactProp(name = "fy")
public void setFy(Dynamic fy) { public void setFy(Dynamic fy) {
mFy = SVGLength.from(fy); mFy = SVGLength.from(fy);
invalidate(); invalidate();
} }
public void setFy(String fy) {
mFy = SVGLength.from(fy);
invalidate();
}
@ReactProp(name = "rx") @ReactProp(name = "rx")
public void setRx(Dynamic rx) { public void setRx(Dynamic rx) {
mRx = SVGLength.from(rx); mRx = SVGLength.from(rx);
invalidate(); invalidate();
} }
public void setRx(String rx) {
mRx = SVGLength.from(rx);
invalidate();
}
@ReactProp(name = "ry") @ReactProp(name = "ry")
public void setRy(Dynamic ry) { public void setRy(Dynamic ry) {
mRy = SVGLength.from(ry); mRy = SVGLength.from(ry);
invalidate(); invalidate();
} }
public void setRy(String ry) {
mRy = SVGLength.from(ry);
invalidate();
}
@ReactProp(name = "cx") @ReactProp(name = "cx")
public void setCx(Dynamic cx) { public void setCx(Dynamic cx) {
mCx = SVGLength.from(cx); mCx = SVGLength.from(cx);
invalidate(); invalidate();
} }
public void setCx(String cx) {
mCx = SVGLength.from(cx);
invalidate();
}
@ReactProp(name = "cy") @ReactProp(name = "cy")
public void setCy(Dynamic cy) { public void setCy(Dynamic cy) {
mCy = SVGLength.from(cy); mCy = SVGLength.from(cy);
invalidate(); invalidate();
} }
public void setCy(String cy) {
mCy = SVGLength.from(cy);
invalidate();
}
@ReactProp(name = "gradient") @ReactProp(name = "gradient")
public void setGradient(ReadableArray gradient) { public void setGradient(ReadableArray gradient) {
mGradient = gradient; mGradient = gradient;

View File

@@ -39,36 +39,66 @@ class RectView extends RenderableView {
invalidate(); invalidate();
} }
public void setX(String x) {
mX = SVGLength.from(x);
invalidate();
}
@ReactProp(name = "y") @ReactProp(name = "y")
public void setY(Dynamic y) { public void setY(Dynamic y) {
mY = SVGLength.from(y); mY = SVGLength.from(y);
invalidate(); invalidate();
} }
public void setY(String y) {
mY = SVGLength.from(y);
invalidate();
}
@ReactProp(name = "width") @ReactProp(name = "width")
public void setWidth(Dynamic width) { public void setWidth(Dynamic width) {
mW = SVGLength.from(width); mW = SVGLength.from(width);
invalidate(); invalidate();
} }
public void setWidth(String width) {
mW = SVGLength.from(width);
invalidate();
}
@ReactProp(name = "height") @ReactProp(name = "height")
public void setHeight(Dynamic height) { public void setHeight(Dynamic height) {
mH = SVGLength.from(height); mH = SVGLength.from(height);
invalidate(); invalidate();
} }
public void setHeight(String height) {
mH = SVGLength.from(height);
invalidate();
}
@ReactProp(name = "rx") @ReactProp(name = "rx")
public void setRx(Dynamic rx) { public void setRx(Dynamic rx) {
mRx = SVGLength.from(rx); mRx = SVGLength.from(rx);
invalidate(); invalidate();
} }
public void setRx(String rx) {
mRx = SVGLength.from(rx);
invalidate();
}
@ReactProp(name = "ry") @ReactProp(name = "ry")
public void setRy(Dynamic ry) { public void setRy(Dynamic ry) {
mRy = SVGLength.from(ry); mRy = SVGLength.from(ry);
invalidate(); invalidate();
} }
public void setRy(String ry) {
mRy = SVGLength.from(ry);
invalidate();
}
@Override @Override
Path getPath(Canvas canvas, Paint paint) { Path getPath(Canvas canvas, Paint paint) {
Path path = new Path(); Path path = new Path();

View File

@@ -26,6 +26,7 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.JavaOnlyArray; import com.facebook.react.bridge.JavaOnlyArray;
import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableType; import com.facebook.react.bridge.ReadableType;
import com.facebook.react.bridge.ColorPropConverter; import com.facebook.react.bridge.ColorPropConverter;
import com.facebook.react.uimanager.PointerEvents; import com.facebook.react.uimanager.PointerEvents;
@@ -117,10 +118,18 @@ abstract public class RenderableView extends VirtualView {
invalidate(); invalidate();
return; return;
} }
ReadableType type = fill.getType();
if (type.equals(ReadableType.Number)) { ReadableType fillType = fill.getType();
if (fillType.equals(ReadableType.Map)) {
ReadableMap fillMap = fill.asMap();
setFill(fillMap);
}
// This code will probably never be reached with current changes
if (fillType.equals(ReadableType.Number)) {
this.fill = JavaOnlyArray.of(0, fill.asInt()); this.fill = JavaOnlyArray.of(0, fill.asInt());
} else if (type.equals(ReadableType.Array)) { } else if (fillType.equals(ReadableType.Array)) {
this.fill = fill.asArray(); this.fill = fill.asArray();
} else { } else {
JavaOnlyArray arr = new JavaOnlyArray(); JavaOnlyArray arr = new JavaOnlyArray();
@@ -136,6 +145,28 @@ abstract public class RenderableView extends VirtualView {
invalidate(); invalidate();
} }
public void setFill(ReadableMap fill) {
if (fill == null) {
this.fill = null;
invalidate();
return;
}
int type = fill.getInt("type");
if (type == 0) {
ReadableType valueType = fill.getType("value");
if (valueType.equals(ReadableType.Number)) {
this.fill = JavaOnlyArray.of(0, fill.getInt("value"));
} else if (valueType.equals(ReadableType.Map)) {
this.fill = JavaOnlyArray.of(0, fill.getMap("value"));
}
} else if (type == 1) {
this.fill = JavaOnlyArray.of(1, fill.getString("brushRef"));
} else {
this.fill = JavaOnlyArray.of(type);
}
invalidate();
}
@ReactProp(name = "fillOpacity", defaultFloat = 1f) @ReactProp(name = "fillOpacity", defaultFloat = 1f)
public void setFillOpacity(float fillOpacity) { public void setFillOpacity(float fillOpacity) {
this.fillOpacity = fillOpacity; this.fillOpacity = fillOpacity;
@@ -184,6 +215,28 @@ abstract public class RenderableView extends VirtualView {
invalidate(); invalidate();
} }
public void setStroke(@Nullable ReadableMap stroke) {
if (stroke == null) {
this.stroke = null;
invalidate();
return;
}
int type = stroke.getInt("type");
if (type == 0) {
ReadableType valueType = stroke.getType("value");
if (valueType.equals(ReadableType.Number)) {
this.stroke = JavaOnlyArray.of(0, stroke.getInt("value"));
} else if (valueType.equals(ReadableType.Map)) {
this.stroke = JavaOnlyArray.of(0, stroke.getMap("value"));
}
} else if (type == 1) {
this.stroke = JavaOnlyArray.of(1, stroke.getString("brushRef"));
} else {
this.stroke = JavaOnlyArray.of(type);
}
invalidate();
}
@ReactProp(name = "strokeOpacity", defaultFloat = 1f) @ReactProp(name = "strokeOpacity", defaultFloat = 1f)
public void setStrokeOpacity(float strokeOpacity) { public void setStrokeOpacity(float strokeOpacity) {
this.strokeOpacity = strokeOpacity; this.strokeOpacity = strokeOpacity;
@@ -216,6 +269,11 @@ abstract public class RenderableView extends VirtualView {
invalidate(); invalidate();
} }
public void setStrokeWidth(String strokeWidth) {
this.strokeWidth = SVGLength.from(strokeWidth);
invalidate();
}
@ReactProp(name = "strokeMiterlimit", defaultFloat = 4f) @ReactProp(name = "strokeMiterlimit", defaultFloat = 4f)
public void setStrokeMiterlimit(float strokeMiterlimit) { public void setStrokeMiterlimit(float strokeMiterlimit) {
this.strokeMiterlimit = strokeMiterlimit; this.strokeMiterlimit = strokeMiterlimit;

View File

@@ -6,136 +6,153 @@ import com.facebook.react.bridge.ReadableArray;
import java.util.ArrayList; import java.util.ArrayList;
class SVGLength { class SVGLength {
// https://www.w3.org/TR/SVG/types.html#InterfaceSVGLength // https://www.w3.org/TR/SVG/types.html#InterfaceSVGLength
public enum UnitType { public enum UnitType {
UNKNOWN, UNKNOWN,
NUMBER, NUMBER,
PERCENTAGE, PERCENTAGE,
EMS, EMS,
EXS, EXS,
PX, PX,
CM, CM,
MM, MM,
IN, IN,
PT, PT,
PC, PC,
} }
final double value; final double value;
final UnitType unit; final UnitType unit;
private SVGLength() {
value = 0; private SVGLength() {
unit = UnitType.UNKNOWN; value = 0;
} unit = UnitType.UNKNOWN;
SVGLength(double number) { }
value = number;
SVGLength(double number) {
value = number;
unit = UnitType.NUMBER;
}
private SVGLength(String length) {
length = length.trim();
int stringLength = length.length();
int percentIndex = stringLength - 1;
if (stringLength == 0 || length.equals("normal")) {
unit = UnitType.UNKNOWN;
value = 0;
} else if (length.codePointAt(percentIndex) == '%') {
unit = UnitType.PERCENTAGE;
value = Double.valueOf(length.substring(0, percentIndex));
} else {
int twoLetterUnitIndex = stringLength - 2;
if (twoLetterUnitIndex > 0) {
String lastTwo = length.substring(twoLetterUnitIndex);
int end = twoLetterUnitIndex;
switch (lastTwo) {
case "px":
unit = UnitType.NUMBER;
break;
case "em":
unit = UnitType.EMS;
break;
case "ex":
unit = UnitType.EXS;
break;
case "pt":
unit = UnitType.PT;
break;
case "pc":
unit = UnitType.PC;
break;
case "mm":
unit = UnitType.MM;
break;
case "cm":
unit = UnitType.CM;
break;
case "in":
unit = UnitType.IN;
break;
default:
unit = UnitType.NUMBER;
end = stringLength;
}
value = Double.valueOf(length.substring(0, end));
} else {
unit = UnitType.NUMBER; unit = UnitType.NUMBER;
value = Double.valueOf(length);
}
} }
private SVGLength(String length) { }
length = length.trim();
int stringLength = length.length();
int percentIndex = stringLength - 1;
if (stringLength == 0 || length.equals("normal")) {
unit = UnitType.UNKNOWN;
value = 0;
} else if (length.codePointAt(percentIndex) == '%') {
unit = UnitType.PERCENTAGE;
value = Double.valueOf(length.substring(0, percentIndex));
} else {
int twoLetterUnitIndex = stringLength - 2;
if (twoLetterUnitIndex > 0) {
String lastTwo = length.substring(twoLetterUnitIndex);
int end = twoLetterUnitIndex;
switch (lastTwo) {
case "px":
unit = UnitType.NUMBER;
break;
case "em": static SVGLength from(Dynamic dynamic) {
unit = UnitType.EMS; switch (dynamic.getType()) {
break; case Number:
case "ex": return new SVGLength(dynamic.asDouble());
unit = UnitType.EXS; case String:
break; return new SVGLength(dynamic.asString());
default:
return new SVGLength();
}
}
case "pt": static SVGLength from(String string) {
unit = UnitType.PT; return new SVGLength(string);
break; }
case "pc": static String toString(Dynamic dynamic) {
unit = UnitType.PC; switch (dynamic.getType()) {
break; case Number:
return String.valueOf(dynamic.asDouble());
case String:
return dynamic.asString();
default:
return null;
}
}
case "mm": static ArrayList<SVGLength> arrayFrom(Dynamic dynamic) {
unit = UnitType.MM; switch (dynamic.getType()) {
break; case Number: {
ArrayList<SVGLength> list = new ArrayList<>(1);
case "cm": list.add(new SVGLength(dynamic.asDouble()));
unit = UnitType.CM; return list;
break; }
case Array: {
case "in": ReadableArray arr = dynamic.asArray();
unit = UnitType.IN; int size = arr.size();
break; ArrayList<SVGLength> list = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
default: Dynamic val = arr.getDynamic(i);
unit = UnitType.NUMBER; list.add(from(val));
end = stringLength;
}
value = Double.valueOf(length.substring(0, end));
} else {
unit = UnitType.NUMBER;
value = Double.valueOf(length);
}
} }
return list;
}
case String: {
ArrayList<SVGLength> list = new ArrayList<>(1);
list.add(new SVGLength(dynamic.asString()));
return list;
}
default:
return null;
} }
}
static SVGLength from(Dynamic dynamic) { static ArrayList<SVGLength> arrayFrom(ReadableArray arr) {
switch (dynamic.getType()) { int size = arr.size();
case Number: ArrayList<SVGLength> list = new ArrayList<>(size);
return new SVGLength(dynamic.asDouble()); for (int i = 0; i < size; i++) {
case String: Dynamic val = arr.getDynamic(i);
return new SVGLength(dynamic.asString()); list.add(from(val));
default:
return new SVGLength();
}
}
static String toString(Dynamic dynamic) {
switch (dynamic.getType()) {
case Number:
return String.valueOf(dynamic.asDouble());
case String:
return dynamic.asString();
default:
return null;
}
}
static ArrayList<SVGLength> arrayFrom(Dynamic dynamic) {
switch (dynamic.getType()) {
case Number: {
ArrayList<SVGLength> list = new ArrayList<>(1);
list.add(new SVGLength(dynamic.asDouble()));
return list;
}
case Array: {
ReadableArray arr = dynamic.asArray();
int size = arr.size();
ArrayList<SVGLength> list = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
Dynamic val = arr.getDynamic(i);
list.add(from(val));
}
return list;
}
case String: {
ArrayList<SVGLength> list = new ArrayList<>(1);
list.add(new SVGLength(dynamic.asString()));
return list;
}
default:
return null;
}
} }
return list;
}
} }

View File

@@ -14,6 +14,7 @@ import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager; import com.facebook.react.uimanager.ViewManager;
import com.facebook.soloader.SoLoader;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@@ -55,6 +56,13 @@ public class SvgPackage implements ReactPackage {
@Nonnull @Nonnull
@Override @Override
public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) { public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// For Fabric, we load c++ native library here, this triggers svg's Fabric
// component registration which is necessary in order to avoid asking users
// to manually add init calls in their application code.
// This should no longer be needed if RN's autolink mechanism has Fabric support
SoLoader.loadLibrary("rnsvg_modules");
}
return Arrays.<NativeModule>asList( return Arrays.<NativeModule>asList(
new SvgViewModule(reactContext), new SvgViewModule(reactContext),
new RNSVGRenderableManager(reactContext) new RNSVGRenderableManager(reactContext)

View File

@@ -43,7 +43,7 @@ import javax.annotation.Nullable;
* Custom {@link View} implementation that draws an RNSVGSvg React view and its children. * Custom {@link View} implementation that draws an RNSVGSvg React view and its children.
*/ */
@SuppressLint("ViewConstructor") @SuppressLint("ViewConstructor")
public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactCompoundViewGroup { public class SvgView extends FabricEnabledViewGroup implements ReactCompoundView, ReactCompoundViewGroup {
@Override @Override
public boolean interceptsTouchEvent(float touchX, float touchY) { public boolean interceptsTouchEvent(float touchX, float touchY) {
@@ -71,6 +71,8 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
public SvgView(ReactContext reactContext) { public SvgView(ReactContext reactContext) {
super(reactContext); super(reactContext);
mScale = DisplayMetricsHolder.getScreenDisplayMetrics().density; mScale = DisplayMetricsHolder.getScreenDisplayMetrics().density;
// for some reason on Fabric the `onDraw` won't be called without it
setWillNotDraw(false);
} }
@Override @Override
@@ -189,6 +191,12 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
clearChildCache(); clearChildCache();
} }
public void setTintColor(@Nullable Integer tintColor) {
mTintColor = tintColor;
invalidate();
clearChildCache();
}
@ReactProp(name = "minX") @ReactProp(name = "minX")
public void setMinX(float minX) { public void setMinX(float minX) {
mMinX = minX; mMinX = minX;
@@ -224,6 +232,12 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
clearChildCache(); clearChildCache();
} }
public void setBbWidth(String bbWidth) {
mbbWidth = SVGLength.from(bbWidth);
invalidate();
clearChildCache();
}
@ReactProp(name = "bbHeight") @ReactProp(name = "bbHeight")
public void setBbHeight(Dynamic bbHeight) { public void setBbHeight(Dynamic bbHeight) {
mbbHeight = SVGLength.from(bbHeight); mbbHeight = SVGLength.from(bbHeight);
@@ -231,6 +245,12 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
clearChildCache(); clearChildCache();
} }
public void setBbHeight(String bbHeight) {
mbbHeight = SVGLength.from(bbHeight);
invalidate();
clearChildCache();
}
@ReactProp(name = "align") @ReactProp(name = "align")
public void setAlign(String align) { public void setAlign(String align) {
mAlign = align; mAlign = align;

View File

@@ -13,9 +13,12 @@ import android.util.SparseArray;
import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.Dynamic;
import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewManagerDelegate;
import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.views.view.ReactViewGroup; import com.facebook.react.views.view.ReactViewGroup;
import com.facebook.react.views.view.ReactViewManager; import com.facebook.react.views.view.ReactViewManager;
import com.facebook.react.viewmanagers.RNSVGSvgViewManagerDelegate;
import com.facebook.react.viewmanagers.RNSVGSvgViewManagerInterface;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -24,13 +27,23 @@ import javax.annotation.Nullable;
* ViewManager for RNSVGSvgView React views. Renders as a {@link SvgView} and handles * ViewManager for RNSVGSvgView React views. Renders as a {@link SvgView} and handles
* invalidating the native view on view updates happening in the underlying tree. * invalidating the native view on view updates happening in the underlying tree.
*/ */
class SvgViewManager extends ReactViewManager { class SvgViewManager extends ReactViewManager implements RNSVGSvgViewManagerInterface<SvgView> {
private static final String REACT_CLASS = "RNSVGSvgView"; private static final String REACT_CLASS = "RNSVGSvgView";
private static final SparseArray<SvgView> mTagToSvgView = new SparseArray<>(); private static final SparseArray<SvgView> mTagToSvgView = new SparseArray<>();
private static final SparseArray<Runnable> mTagToRunnable = new SparseArray<>(); private static final SparseArray<Runnable> mTagToRunnable = new SparseArray<>();
private final ViewManagerDelegate<SvgView> mDelegate;
protected ViewManagerDelegate getDelegate(){
return mDelegate;
}
public SvgViewManager() {
mDelegate = new RNSVGSvgViewManagerDelegate(this);
}
static void setSvgView(int tag, SvgView svg) { static void setSvgView(int tag, SvgView svg) {
mTagToSvgView.put(tag, svg); mTagToSvgView.put(tag, svg);
Runnable task = mTagToRunnable.get(tag); Runnable task = mTagToRunnable.get(tag);
@@ -56,7 +69,7 @@ class SvgViewManager extends ReactViewManager {
@Nonnull @Nonnull
@Override @Override
public SvgView createViewInstance(ThemedReactContext reactContext) { public ReactViewGroup createViewInstance(ThemedReactContext reactContext) {
return new SvgView(reactContext); return new SvgView(reactContext);
} }
@@ -88,21 +101,25 @@ class SvgViewManager extends ReactViewManager {
} }
@ReactProp(name = "minX") @ReactProp(name = "minX")
@Override
public void setMinX(SvgView node, float minX) { public void setMinX(SvgView node, float minX) {
node.setMinX(minX); node.setMinX(minX);
} }
@ReactProp(name = "minY") @ReactProp(name = "minY")
@Override
public void setMinY(SvgView node, float minY) { public void setMinY(SvgView node, float minY) {
node.setMinY(minY); node.setMinY(minY);
} }
@ReactProp(name = "vbWidth") @ReactProp(name = "vbWidth")
@Override
public void setVbWidth(SvgView node, float vbWidth) { public void setVbWidth(SvgView node, float vbWidth) {
node.setVbWidth(vbWidth); node.setVbWidth(vbWidth);
} }
@ReactProp(name = "vbHeight") @ReactProp(name = "vbHeight")
@Override
public void setVbHeight(SvgView node, float vbHeight) { public void setVbHeight(SvgView node, float vbHeight) {
node.setVbHeight(vbHeight); node.setVbHeight(vbHeight);
} }
@@ -118,12 +135,35 @@ class SvgViewManager extends ReactViewManager {
} }
@ReactProp(name = "align") @ReactProp(name = "align")
@Override
public void setAlign(SvgView node, String align) { public void setAlign(SvgView node, String align) {
node.setAlign(align); node.setAlign(align);
} }
@ReactProp(name = "meetOrSlice") @ReactProp(name = "meetOrSlice")
@Override
public void setMeetOrSlice(SvgView node, int meetOrSlice) { public void setMeetOrSlice(SvgView node, int meetOrSlice) {
node.setMeetOrSlice(meetOrSlice); node.setMeetOrSlice(meetOrSlice);
} }
@Override
public void setTintColor(SvgView view, @Nullable Integer value) {
view.setTintColor(value);
}
@Override
public void setColor(SvgView view, @Nullable Integer value) {
view.setTintColor(value);
}
@Override
public void setBbWidth(SvgView view, @Nullable String value) {
view.setBbWidth(value);
}
@Override
public void setBbHeight(SvgView view, @Nullable String value) {
view.setBbHeight(value);
}
} }

View File

@@ -48,6 +48,11 @@ class TextPathView extends TextView {
invalidate(); invalidate();
} }
public void setStartOffset(String startOffset) {
mStartOffset = SVGLength.from(startOffset);
invalidate();
}
@ReactProp(name = "method") @ReactProp(name = "method")
public void setMethod(@Nullable String method) { public void setMethod(@Nullable String method) {
mMethod = TextPathMethod.valueOf(method); mMethod = TextPathMethod.valueOf(method);

View File

@@ -19,6 +19,7 @@ import android.view.ViewParent;
import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.annotations.ReactProp;
import java.util.ArrayList; import java.util.ArrayList;
@@ -66,12 +67,22 @@ class TextView extends GroupView {
invalidate(); invalidate();
} }
public void setInlineSize(String inlineSize) {
mInlineSize = SVGLength.from(inlineSize);
invalidate();
}
@ReactProp(name = "textLength") @ReactProp(name = "textLength")
public void setTextLength(Dynamic length) { public void setTextLength(Dynamic length) {
mTextLength = SVGLength.from(length); mTextLength = SVGLength.from(length);
invalidate(); invalidate();
} }
public void setTextLength(String length) {
mTextLength = SVGLength.from(length);
invalidate();
}
@ReactProp(name = "lengthAdjust") @ReactProp(name = "lengthAdjust")
public void setLengthAdjust(@Nullable String adjustment) { public void setLengthAdjust(@Nullable String adjustment) {
mLengthAdjust = TextLengthAdjust.valueOf(adjustment); mLengthAdjust = TextLengthAdjust.valueOf(adjustment);
@@ -90,6 +101,11 @@ class TextView extends GroupView {
invalidate(); invalidate();
} }
public void setBaselineShift(String baselineShift) {
mBaselineShift = baselineShift;
invalidate();
}
@ReactProp(name = "verticalAlign") @ReactProp(name = "verticalAlign")
public void setVerticalAlign(@Nullable String verticalAlign) { public void setVerticalAlign(@Nullable String verticalAlign) {
if (verticalAlign != null) { if (verticalAlign != null) {
@@ -118,30 +134,56 @@ class TextView extends GroupView {
invalidate(); invalidate();
} }
public void setRotate(ReadableArray rotate) {
mRotate = SVGLength.arrayFrom(rotate);
invalidate();
}
@ReactProp(name = "dx") @ReactProp(name = "dx")
public void setDeltaX(Dynamic deltaX) { public void setDeltaX(Dynamic deltaX) {
mDeltaX = SVGLength.arrayFrom(deltaX); mDeltaX = SVGLength.arrayFrom(deltaX);
invalidate(); invalidate();
} }
public void setDeltaX(ReadableArray deltaX) {
mDeltaX = SVGLength.arrayFrom(deltaX);
invalidate();
}
@ReactProp(name = "dy") @ReactProp(name = "dy")
public void setDeltaY(Dynamic deltaY) { public void setDeltaY(Dynamic deltaY) {
mDeltaY = SVGLength.arrayFrom(deltaY); mDeltaY = SVGLength.arrayFrom(deltaY);
invalidate(); invalidate();
} }
public void setDeltaY(ReadableArray deltaY) {
mDeltaY = SVGLength.arrayFrom(deltaY);
invalidate();
}
@ReactProp(name = "x") @ReactProp(name = "x")
public void setPositionX(Dynamic positionX) { public void setPositionX(Dynamic positionX) {
mPositionX = SVGLength.arrayFrom(positionX); mPositionX = SVGLength.arrayFrom(positionX);
invalidate(); invalidate();
} }
@ReactProp(name = "y") public void setPositionX(ReadableArray positionX) {
mPositionX = SVGLength.arrayFrom(positionX);
invalidate();
}
@ReactProp(name = "y")
public void setPositionY(Dynamic positionY) { public void setPositionY(Dynamic positionY) {
mPositionY = SVGLength.arrayFrom(positionY); mPositionY = SVGLength.arrayFrom(positionY);
invalidate(); invalidate();
} }
public void setPositionY(ReadableArray positionY) {
mPositionY = SVGLength.arrayFrom(positionY);
invalidate();
}
@Override @Override
void draw(Canvas canvas, Paint paint, float opacity) { void draw(Canvas canvas, Paint paint, float opacity) {
setupGlyphContext(canvas); setupGlyphContext(canvas);

View File

@@ -45,24 +45,44 @@ class UseView extends RenderableView {
invalidate(); invalidate();
} }
public void setX(String x) {
mX = SVGLength.from(x);
invalidate();
}
@ReactProp(name = "y") @ReactProp(name = "y")
public void setY(Dynamic y) { public void setY(Dynamic y) {
mY = SVGLength.from(y); mY = SVGLength.from(y);
invalidate(); invalidate();
} }
public void setY(String y) {
mY = SVGLength.from(y);
invalidate();
}
@ReactProp(name = "width") @ReactProp(name = "width")
public void setWidth(Dynamic width) { public void setWidth(Dynamic width) {
mW = SVGLength.from(width); mW = SVGLength.from(width);
invalidate(); invalidate();
} }
public void setWidth(String width) {
mW = SVGLength.from(width);
invalidate();
}
@ReactProp(name = "height") @ReactProp(name = "height")
public void setHeight(Dynamic height) { public void setHeight(Dynamic height) {
mH = SVGLength.from(height); mH = SVGLength.from(height);
invalidate(); invalidate();
} }
public void setHeight(String height) {
mH = SVGLength.from(height);
invalidate();
}
@Override @Override
void draw(Canvas canvas, Paint paint, float opacity) { void draw(Canvas canvas, Paint paint, float opacity) {
VirtualView template = getSvgView().getDefinedTemplate(mHref); VirtualView template = getSvgView().getDefinedTemplate(mHref);

View File

@@ -13,6 +13,7 @@ import android.view.ViewParent;
import com.facebook.common.logging.FLog; import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableType; import com.facebook.react.bridge.ReadableType;
import com.facebook.react.common.ReactConstants; import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.DisplayMetricsHolder; import com.facebook.react.uimanager.DisplayMetricsHolder;
@@ -306,27 +307,32 @@ abstract public class VirtualView extends ReactViewGroup {
public void setMatrix(Dynamic matrixArray) { public void setMatrix(Dynamic matrixArray) {
ReadableType type = matrixArray.getType(); ReadableType type = matrixArray.getType();
if (!matrixArray.isNull() && type.equals(ReadableType.Array)) { if (!matrixArray.isNull() && type.equals(ReadableType.Array)) {
int matrixSize = PropHelper.toMatrixData(matrixArray.asArray(), sRawMatrix, mScale); setMatrix((ReadableArray) matrixArray);
if (matrixSize == 6) {
if (mMatrix == null) {
mMatrix = new Matrix();
mInvMatrix = new Matrix();
}
mMatrix.setValues(sRawMatrix);
mInvertible = mMatrix.invert(mInvMatrix);
} else if (matrixSize != -1) {
FLog.w(ReactConstants.TAG, "RNSVG: Transform matrices must be of size 6");
}
} else { } else {
mMatrix.reset(); mMatrix.reset();
mInvMatrix.reset(); mInvMatrix.reset();
mInvertible = true; mInvertible = true;
super.invalidate();
clearParentCache();
} }
super.invalidate();
clearParentCache();
} }
public void setMatrix(ReadableArray matrixArray) {
int matrixSize = PropHelper.toMatrixData(matrixArray, sRawMatrix, mScale);
if (matrixSize == 6) {
if (mMatrix == null) {
mMatrix = new Matrix();
mInvMatrix = new Matrix();
}
mMatrix.setValues(sRawMatrix);
mInvertible = mMatrix.invert(mInvMatrix);
} else if (matrixSize != -1) {
FLog.w(ReactConstants.TAG, "RNSVG: Transform matrices must be of size 6");
}
super.invalidate();
clearParentCache();
}
@ReactProp(name = "responsible") @ReactProp(name = "responsible")
public void setResponsible(boolean responsible) { public void setResponsible(boolean responsible) {
mResponsible = responsible; mResponsible = responsible;

View File

@@ -0,0 +1,43 @@
SVG_MAIN_THIS_DIR := $(call my-dir)
include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
include $(SVG_MAIN_THIS_DIR)/../../../build/generated/source/codegen/jni/Android.mk
include $(SVG_MAIN_THIS_DIR)/../../../../common/cpp/Android.mk
include $(CLEAR_VARS)
LOCAL_PATH := $(SVG_MAIN_THIS_DIR)
LOCAL_MODULE := rnsvg_modules
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
# Please note as one of the library listed is libreact_codegen_samplelibrary
# This name will be generated as libreact_codegen_<library-name>
# where <library-name> is the one you specified in the Gradle configuration
LOCAL_SHARED_LIBRARIES := libjsi \
libfbjni \
libglog \
libfolly_runtime \
libyoga \
libreact_nativemodule_core \
libturbomodulejsijni \
librrc_view \
libreact_render_core \
libreact_render_graphics \
libfabricjni \
libreact_debug \
libreact_render_componentregistry \
libreact_render_debug \
libruntimeexecutor \
libreact_render_mapbuffer \
libreact_codegen_rncore \
libreact_codegen_rnsvg
LOCAL_CFLAGS := \
-DLOG_TAG=\"ReactNative\"
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,9 @@
#include <fbjni/fbjni.h>
#include "RNSvgComponentsRegistry.h"
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
return facebook::jni::initialize(vm, [] {
facebook::react::RNSvgComponentsRegistry::registerNatives();
});
}

View File

@@ -0,0 +1,83 @@
#include "RNSvgComponentsRegistry.h"
#include <CoreComponentsRegistry.h>
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <react/renderer/components/rnsvg/ComponentDescriptors.h>
#include <react/renderer/mapbuffer/MapBuffer.h>
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
namespace facebook {
namespace react {
RNSvgComponentsRegistry::RNSvgComponentsRegistry(
ComponentFactory *delegate)
: delegate_(delegate) {}
std::shared_ptr<ComponentDescriptorProviderRegistry const>
RNSvgComponentsRegistry::sharedProviderRegistry() {
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
// Svg
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGCircleComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGClipPathComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGDefsComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGEllipseComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGForeignObjectComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGGroupComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGImageComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGLinearGradientComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGLineComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGMarkerComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGMaskComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGPathComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGPatternComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGRadialGradientComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGRectComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGSvgViewComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGSymbolComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGTextComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGTextPathComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGTSpanComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<RNSVGUseComponentDescriptor>());
return providerRegistry;
}
jni::local_ref<RNSvgComponentsRegistry::jhybriddata>
RNSvgComponentsRegistry::initHybrid(
jni::alias_ref<jclass>,
ComponentFactory *delegate) {
auto instance = makeCxxInstance(delegate);
auto buildRegistryFunction =
[](EventDispatcher::Weak const &eventDispatcher,
ContextContainer::Shared const &contextContainer)
-> ComponentDescriptorRegistry::Shared {
auto registry = RNSvgComponentsRegistry::sharedProviderRegistry()
->createComponentDescriptorRegistry(
{eventDispatcher, contextContainer});
return registry;
};
delegate->buildRegistryFunction = buildRegistryFunction;
return instance;
}
void RNSvgComponentsRegistry::registerNatives() {
registerHybrid({
makeNativeMethod("initHybrid", RNSvgComponentsRegistry::initHybrid),
});
// This is a temporary solution that allows components exported by the svg
// library to be added to the main component registry. This code is triggered
// when c++ svg library is initialized and is needed because RN's autolinking
// does not currently support Fabric components. As a consequence, users would need
// to manually put library initialization calls in their ReactNativeHost implementation
// which is undesirable.
sharedProviderRegistry();
}
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,34 @@
#pragma once
#include <ComponentFactory.h>
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
namespace facebook {
namespace react {
class RNSvgComponentsRegistry
: public facebook::jni::HybridClass<RNSvgComponentsRegistry> {
public:
constexpr static auto kJavaDescriptor =
"Lcom/horcrux/svg/RNSvgComponentsRegistry;";
static void registerNatives();
RNSvgComponentsRegistry(ComponentFactory *delegate);
private:
friend HybridBase;
static std::shared_ptr<ComponentDescriptorProviderRegistry const> sharedProviderRegistry();
const ComponentFactory *delegate_;
static jni::local_ref<jhybriddata> initHybrid(
jni::alias_ref<jclass>,
ComponentFactory *delegate);
};
} // namespace react
} // namespace facebook

View File

@@ -0,0 +1,111 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGCircleManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGCircleManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGCircleManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "cx":
mViewManager.setCx(view, value == null ? null : (String) value);
break;
case "cy":
mViewManager.setCy(view, value == null ? null : (String) value);
break;
case "r":
mViewManager.setR(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,45 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGCircleManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setCx(T view, @Nullable String value);
void setCy(T view, @Nullable String value);
void setR(T view, @Nullable String value);
}

View File

@@ -0,0 +1,62 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGClipPathManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGClipPathManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGClipPathManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,28 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
public interface RNSVGClipPathManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
}

View File

@@ -0,0 +1,25 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGDefsManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGDefsManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGDefsManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
super.setProperty(view, propName, value);
}
}

View File

@@ -0,0 +1,16 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
public interface RNSVGDefsManagerInterface<T extends View> {
// No props
}

View File

@@ -0,0 +1,114 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGEllipseManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGEllipseManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGEllipseManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "cx":
mViewManager.setCx(view, value == null ? null : (String) value);
break;
case "cy":
mViewManager.setCy(view, value == null ? null : (String) value);
break;
case "rx":
mViewManager.setRx(view, value == null ? null : (String) value);
break;
case "ry":
mViewManager.setRy(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,46 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGEllipseManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setCx(T view, @Nullable String value);
void setCy(T view, @Nullable String value);
void setRx(T view, @Nullable String value);
void setRy(T view, @Nullable String value);
}

View File

@@ -0,0 +1,129 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGForeignObjectManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGForeignObjectManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGForeignObjectManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "x":
mViewManager.setX(view, value == null ? null : (String) value);
break;
case "y":
mViewManager.setY(view, value == null ? null : (String) value);
break;
case "foreignObjectheight":
mViewManager.setForeignObjectheight(view, value == null ? null : (String) value);
break;
case "foreignObjectwidth":
mViewManager.setForeignObjectwidth(view, value == null ? null : (String) value);
break;
case "height":
mViewManager.setHeight(view, value == null ? null : (String) value);
break;
case "width":
mViewManager.setWidth(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,51 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGForeignObjectManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setX(T view, @Nullable String value);
void setY(T view, @Nullable String value);
void setForeignObjectheight(T view, @Nullable String value);
void setForeignObjectwidth(T view, @Nullable String value);
void setHeight(T view, @Nullable String value);
void setWidth(T view, @Nullable String value);
}

View File

@@ -0,0 +1,111 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGGroupManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGGroupManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGGroupManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,45 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGGroupManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
}

View File

@@ -0,0 +1,129 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGImageManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGImageManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGImageManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "x":
mViewManager.setX(view, value == null ? null : (String) value);
break;
case "y":
mViewManager.setY(view, value == null ? null : (String) value);
break;
case "imagewidth":
mViewManager.setImagewidth(view, value == null ? null : (String) value);
break;
case "imageheight":
mViewManager.setImageheight(view, value == null ? null : (String) value);
break;
case "width":
mViewManager.setWidth(view, value == null ? null : (String) value);
break;
case "height":
mViewManager.setHeight(view, value == null ? null : (String) value);
break;
case "src":
mViewManager.setSrc(view, (ReadableMap) value);
break;
case "align":
mViewManager.setAlign(view, value == null ? null : (String) value);
break;
case "meetOrSlice":
mViewManager.setMeetOrSlice(view, value == null ? 0 : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,51 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGImageManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setX(T view, @Nullable String value);
void setY(T view, @Nullable String value);
void setImagewidth(T view, @Nullable String value);
void setImageheight(T view, @Nullable String value);
void setWidth(T view, @Nullable String value);
void setHeight(T view, @Nullable String value);
void setSrc(T view, @Nullable ReadableMap value);
void setAlign(T view, @Nullable String value);
void setMeetOrSlice(T view, int value);
}

View File

@@ -0,0 +1,114 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGLineManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGLineManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGLineManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "x1":
mViewManager.setX1(view, value == null ? null : (String) value);
break;
case "y1":
mViewManager.setY1(view, value == null ? null : (String) value);
break;
case "x2":
mViewManager.setX2(view, value == null ? null : (String) value);
break;
case "y2":
mViewManager.setY2(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,46 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGLineManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setX1(T view, @Nullable String value);
void setY1(T view, @Nullable String value);
void setX2(T view, @Nullable String value);
void setY2(T view, @Nullable String value);
}

View File

@@ -0,0 +1,83 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGLinearGradientManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGLinearGradientManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGLinearGradientManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "x1":
mViewManager.setX1(view, value == null ? null : (String) value);
break;
case "y1":
mViewManager.setY1(view, value == null ? null : (String) value);
break;
case "x2":
mViewManager.setX2(view, value == null ? null : (String) value);
break;
case "y2":
mViewManager.setY2(view, value == null ? null : (String) value);
break;
case "gradient":
mViewManager.setGradient(view, (ReadableArray) value);
break;
case "gradientUnits":
mViewManager.setGradientUnits(view, value == null ? 0 : ((Double) value).intValue());
break;
case "gradientTransform":
mViewManager.setGradientTransform(view, (ReadableArray) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,35 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
public interface RNSVGLinearGradientManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setX1(T view, @Nullable String value);
void setY1(T view, @Nullable String value);
void setX2(T view, @Nullable String value);
void setY2(T view, @Nullable String value);
void setGradient(T view, @Nullable ReadableArray value);
void setGradientUnits(T view, int value);
void setGradientTransform(T view, @Nullable ReadableArray value);
}

View File

@@ -0,0 +1,147 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGMarkerManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGMarkerManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGMarkerManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "refX":
mViewManager.setRefX(view, value == null ? null : (String) value);
break;
case "refY":
mViewManager.setRefY(view, value == null ? null : (String) value);
break;
case "markerHeight":
mViewManager.setMarkerHeight(view, value == null ? null : (String) value);
break;
case "markerWidth":
mViewManager.setMarkerWidth(view, value == null ? null : (String) value);
break;
case "markerUnits":
mViewManager.setMarkerUnits(view, value == null ? null : (String) value);
break;
case "orient":
mViewManager.setOrient(view, value == null ? null : (String) value);
break;
case "minX":
mViewManager.setMinX(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "minY":
mViewManager.setMinY(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vbWidth":
mViewManager.setVbWidth(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vbHeight":
mViewManager.setVbHeight(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "align":
mViewManager.setAlign(view, value == null ? null : (String) value);
break;
case "meetOrSlice":
mViewManager.setMeetOrSlice(view, value == null ? 0 : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,57 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGMarkerManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setRefX(T view, @Nullable String value);
void setRefY(T view, @Nullable String value);
void setMarkerHeight(T view, @Nullable String value);
void setMarkerWidth(T view, @Nullable String value);
void setMarkerUnits(T view, @Nullable String value);
void setOrient(T view, @Nullable String value);
void setMinX(T view, float value);
void setMinY(T view, float value);
void setVbWidth(T view, float value);
void setVbHeight(T view, float value);
void setAlign(T view, @Nullable String value);
void setMeetOrSlice(T view, int value);
}

View File

@@ -0,0 +1,138 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGMaskManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGMaskManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGMaskManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "x":
mViewManager.setX(view, value == null ? null : (String) value);
break;
case "y":
mViewManager.setY(view, value == null ? null : (String) value);
break;
case "maskheight":
mViewManager.setMaskheight(view, value == null ? null : (String) value);
break;
case "maskwidth":
mViewManager.setMaskwidth(view, value == null ? null : (String) value);
break;
case "height":
mViewManager.setHeight(view, value == null ? null : (String) value);
break;
case "width":
mViewManager.setWidth(view, value == null ? null : (String) value);
break;
case "maskUnits":
mViewManager.setMaskUnits(view, value == null ? 0 : ((Double) value).intValue());
break;
case "maskContentUnits":
mViewManager.setMaskContentUnits(view, value == null ? 0 : ((Double) value).intValue());
break;
case "maskTransform":
mViewManager.setMaskTransform(view, (ReadableArray) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,54 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGMaskManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setX(T view, @Nullable String value);
void setY(T view, @Nullable String value);
void setMaskheight(T view, @Nullable String value);
void setMaskwidth(T view, @Nullable String value);
void setHeight(T view, @Nullable String value);
void setWidth(T view, @Nullable String value);
void setMaskUnits(T view, int value);
void setMaskContentUnits(T view, int value);
void setMaskTransform(T view, @Nullable ReadableArray value);
}

View File

@@ -0,0 +1,105 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGPathManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGPathManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGPathManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "d":
mViewManager.setD(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,43 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGPathManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setD(T view, @Nullable String value);
}

View File

@@ -0,0 +1,156 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGPatternManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGPatternManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGPatternManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "x":
mViewManager.setX(view, value == null ? null : (String) value);
break;
case "y":
mViewManager.setY(view, value == null ? null : (String) value);
break;
case "patternheight":
mViewManager.setPatternheight(view, value == null ? null : (String) value);
break;
case "patternwidth":
mViewManager.setPatternwidth(view, value == null ? null : (String) value);
break;
case "height":
mViewManager.setHeight(view, value == null ? null : (String) value);
break;
case "width":
mViewManager.setWidth(view, value == null ? null : (String) value);
break;
case "patternUnits":
mViewManager.setPatternUnits(view, value == null ? 0 : ((Double) value).intValue());
break;
case "patternContentUnits":
mViewManager.setPatternContentUnits(view, value == null ? 0 : ((Double) value).intValue());
break;
case "patternTransform":
mViewManager.setPatternTransform(view, (ReadableArray) value);
break;
case "minX":
mViewManager.setMinX(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "minY":
mViewManager.setMinY(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vbWidth":
mViewManager.setVbWidth(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vbHeight":
mViewManager.setVbHeight(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "align":
mViewManager.setAlign(view, value == null ? null : (String) value);
break;
case "meetOrSlice":
mViewManager.setMeetOrSlice(view, value == null ? 0 : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,60 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGPatternManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setX(T view, @Nullable String value);
void setY(T view, @Nullable String value);
void setPatternheight(T view, @Nullable String value);
void setPatternwidth(T view, @Nullable String value);
void setHeight(T view, @Nullable String value);
void setWidth(T view, @Nullable String value);
void setPatternUnits(T view, int value);
void setPatternContentUnits(T view, int value);
void setPatternTransform(T view, @Nullable ReadableArray value);
void setMinX(T view, float value);
void setMinY(T view, float value);
void setVbWidth(T view, float value);
void setVbHeight(T view, float value);
void setAlign(T view, @Nullable String value);
void setMeetOrSlice(T view, int value);
}

View File

@@ -0,0 +1,89 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGRadialGradientManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGRadialGradientManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGRadialGradientManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fx":
mViewManager.setFx(view, value == null ? null : (String) value);
break;
case "fy":
mViewManager.setFy(view, value == null ? null : (String) value);
break;
case "cx":
mViewManager.setCx(view, value == null ? null : (String) value);
break;
case "cy":
mViewManager.setCy(view, value == null ? null : (String) value);
break;
case "rx":
mViewManager.setRx(view, value == null ? null : (String) value);
break;
case "ry":
mViewManager.setRy(view, value == null ? null : (String) value);
break;
case "gradient":
mViewManager.setGradient(view, (ReadableArray) value);
break;
case "gradientUnits":
mViewManager.setGradientUnits(view, value == null ? 0 : ((Double) value).intValue());
break;
case "gradientTransform":
mViewManager.setGradientTransform(view, (ReadableArray) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,37 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
public interface RNSVGRadialGradientManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFx(T view, @Nullable String value);
void setFy(T view, @Nullable String value);
void setCx(T view, @Nullable String value);
void setCy(T view, @Nullable String value);
void setRx(T view, @Nullable String value);
void setRy(T view, @Nullable String value);
void setGradient(T view, @Nullable ReadableArray value);
void setGradientUnits(T view, int value);
void setGradientTransform(T view, @Nullable ReadableArray value);
}

View File

@@ -0,0 +1,126 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGRectManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGRectManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGRectManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "x":
mViewManager.setX(view, value == null ? null : (String) value);
break;
case "y":
mViewManager.setY(view, value == null ? null : (String) value);
break;
case "rectheight":
mViewManager.setRectheight(view, value == null ? null : (String) value);
break;
case "rectwidth":
mViewManager.setRectwidth(view, value == null ? null : (String) value);
break;
case "height":
mViewManager.setHeight(view, value == null ? null : (String) value);
break;
case "width":
mViewManager.setWidth(view, value == null ? null : (String) value);
break;
case "rx":
mViewManager.setRx(view, value == null ? null : (String) value);
break;
case "ry":
mViewManager.setRy(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,50 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGRectManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setX(T view, @Nullable String value);
void setY(T view, @Nullable String value);
void setRectheight(T view, @Nullable String value);
void setRectwidth(T view, @Nullable String value);
void setHeight(T view, @Nullable String value);
void setWidth(T view, @Nullable String value);
void setRx(T view, @Nullable String value);
void setRy(T view, @Nullable String value);
}

View File

@@ -0,0 +1,59 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ColorPropConverter;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGSvgViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGSvgViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGSvgViewManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "bbWidth":
mViewManager.setBbWidth(view, value == null ? null : (String) value);
break;
case "bbHeight":
mViewManager.setBbHeight(view, value == null ? null : (String) value);
break;
case "minX":
mViewManager.setMinX(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "minY":
mViewManager.setMinY(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "vbWidth":
mViewManager.setVbWidth(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "vbHeight":
mViewManager.setVbHeight(view, value == null ? Float.NaN : ((Double) value).floatValue());
break;
case "align":
mViewManager.setAlign(view, value == null ? null : (String) value);
break;
case "meetOrSlice":
mViewManager.setMeetOrSlice(view, value == null ? 0 : ((Double) value).intValue());
break;
case "tintColor":
mViewManager.setTintColor(view, ColorPropConverter.getColor(value, view.getContext()));
break;
case "color":
mViewManager.setColor(view, ColorPropConverter.getColor(value, view.getContext()));
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,26 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface RNSVGSvgViewManagerInterface<T extends View> {
void setBbWidth(T view, @Nullable String value);
void setBbHeight(T view, @Nullable String value);
void setMinX(T view, float value);
void setMinY(T view, float value);
void setVbWidth(T view, float value);
void setVbHeight(T view, float value);
void setAlign(T view, @Nullable String value);
void setMeetOrSlice(T view, int value);
void setTintColor(T view, @Nullable Integer value);
void setColor(T view, @Nullable Integer value);
}

View File

@@ -0,0 +1,129 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGSymbolManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGSymbolManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGSymbolManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "minX":
mViewManager.setMinX(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "minY":
mViewManager.setMinY(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vbWidth":
mViewManager.setVbWidth(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vbHeight":
mViewManager.setVbHeight(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "align":
mViewManager.setAlign(view, value == null ? null : (String) value);
break;
case "meetOrSlice":
mViewManager.setMeetOrSlice(view, value == null ? 0 : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,51 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGSymbolManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setMinX(T view, float value);
void setMinY(T view, float value);
void setVbWidth(T view, float value);
void setVbHeight(T view, float value);
void setAlign(T view, @Nullable String value);
void setMeetOrSlice(T view, int value);
}

View File

@@ -0,0 +1,153 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGTSpanManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGTSpanManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGTSpanManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "textAnchor":
mViewManager.setTextAnchor(view, value == null ? null : (String) value);
break;
case "dx":
mViewManager.setDx(view, (ReadableArray) value);
break;
case "dy":
mViewManager.setDy(view, (ReadableArray) value);
break;
case "positionX":
mViewManager.setPositionX(view, (ReadableArray) value);
break;
case "positionY":
mViewManager.setPositionY(view, (ReadableArray) value);
break;
case "x":
mViewManager.setX(view, (ReadableArray) value);
break;
case "y":
mViewManager.setY(view, (ReadableArray) value);
break;
case "rotate":
mViewManager.setRotate(view, (ReadableArray) value);
break;
case "inlineSize":
mViewManager.setInlineSize(view, value == null ? null : (String) value);
break;
case "textLength":
mViewManager.setTextLength(view, value == null ? null : (String) value);
break;
case "baselineShift":
mViewManager.setBaselineShift(view, value == null ? null : (String) value);
break;
case "lengthAdjust":
mViewManager.setLengthAdjust(view, value == null ? null : (String) value);
break;
case "alignmentBaseline":
mViewManager.setAlignmentBaseline(view, value == null ? null : (String) value);
break;
case "content":
mViewManager.setContent(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,59 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGTSpanManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setTextAnchor(T view, @Nullable String value);
void setDx(T view, @Nullable ReadableArray value);
void setDy(T view, @Nullable ReadableArray value);
void setPositionX(T view, @Nullable ReadableArray value);
void setPositionY(T view, @Nullable ReadableArray value);
void setX(T view, @Nullable ReadableArray value);
void setY(T view, @Nullable ReadableArray value);
void setRotate(T view, @Nullable ReadableArray value);
void setInlineSize(T view, @Nullable String value);
void setTextLength(T view, @Nullable String value);
void setBaselineShift(T view, @Nullable String value);
void setLengthAdjust(T view, @Nullable String value);
void setAlignmentBaseline(T view, @Nullable String value);
void setContent(T view, @Nullable String value);
}

View File

@@ -0,0 +1,150 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGTextManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGTextManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGTextManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "fontSize":
mViewManager.setFontSize(view, value == null ? null : (String) value);
break;
case "fontWeight":
mViewManager.setFontWeight(view, value == null ? null : (String) value);
break;
case "font":
mViewManager.setFont(view, (ReadableMap) value);
break;
case "textAnchor":
mViewManager.setTextAnchor(view, value == null ? null : (String) value);
break;
case "dx":
mViewManager.setDx(view, (ReadableArray) value);
break;
case "dy":
mViewManager.setDy(view, (ReadableArray) value);
break;
case "positionX":
mViewManager.setPositionX(view, (ReadableArray) value);
break;
case "positionY":
mViewManager.setPositionY(view, (ReadableArray) value);
break;
case "x":
mViewManager.setX(view, (ReadableArray) value);
break;
case "y":
mViewManager.setY(view, (ReadableArray) value);
break;
case "rotate":
mViewManager.setRotate(view, (ReadableArray) value);
break;
case "inlineSize":
mViewManager.setInlineSize(view, value == null ? null : (String) value);
break;
case "textLength":
mViewManager.setTextLength(view, value == null ? null : (String) value);
break;
case "baselineShift":
mViewManager.setBaselineShift(view, value == null ? null : (String) value);
break;
case "lengthAdjust":
mViewManager.setLengthAdjust(view, value == null ? null : (String) value);
break;
case "alignmentBaseline":
mViewManager.setAlignmentBaseline(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,58 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGTextManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setFontSize(T view, @Nullable String value);
void setFontWeight(T view, @Nullable String value);
void setFont(T view, @Nullable ReadableMap value);
void setTextAnchor(T view, @Nullable String value);
void setDx(T view, @Nullable ReadableArray value);
void setDy(T view, @Nullable ReadableArray value);
void setPositionX(T view, @Nullable ReadableArray value);
void setPositionY(T view, @Nullable ReadableArray value);
void setX(T view, @Nullable ReadableArray value);
void setY(T view, @Nullable ReadableArray value);
void setRotate(T view, @Nullable ReadableArray value);
void setInlineSize(T view, @Nullable String value);
void setTextLength(T view, @Nullable String value);
void setBaselineShift(T view, @Nullable String value);
void setLengthAdjust(T view, @Nullable String value);
void setAlignmentBaseline(T view, @Nullable String value);
}

View File

@@ -0,0 +1,120 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGTextPathManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGTextPathManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGTextPathManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "href":
mViewManager.setHref(view, value == null ? null : (String) value);
break;
case "side":
mViewManager.setSide(view, value == null ? null : (String) value);
break;
case "method":
mViewManager.setMethod(view, value == null ? null : (String) value);
break;
case "midLine":
mViewManager.setMidLine(view, value == null ? null : (String) value);
break;
case "spacing":
mViewManager.setSpacing(view, value == null ? null : (String) value);
break;
case "startOffset":
mViewManager.setStartOffset(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,48 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGTextPathManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setHref(T view, @Nullable String value);
void setSide(T view, @Nullable String value);
void setMethod(T view, @Nullable String value);
void setMidLine(T view, @Nullable String value);
void setSpacing(T view, @Nullable String value);
void setStartOffset(T view, @Nullable String value);
}

View File

@@ -0,0 +1,123 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
public class RNSVGUseManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSVGUseManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public RNSVGUseManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "name":
mViewManager.setName(view, value == null ? null : (String) value);
break;
case "opacity":
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "matrix":
mViewManager.setMatrix(view, (ReadableArray) value);
break;
case "mask":
mViewManager.setMask(view, value == null ? null : (String) value);
break;
case "markerStart":
mViewManager.setMarkerStart(view, value == null ? null : (String) value);
break;
case "markerMid":
mViewManager.setMarkerMid(view, value == null ? null : (String) value);
break;
case "markerEnd":
mViewManager.setMarkerEnd(view, value == null ? null : (String) value);
break;
case "clipPath":
mViewManager.setClipPath(view, value == null ? null : (String) value);
break;
case "clipRule":
mViewManager.setClipRule(view, value == null ? 0 : ((Double) value).intValue());
break;
case "responsible":
mViewManager.setResponsible(view, value == null ? false : (boolean) value);
break;
case "display":
mViewManager.setDisplay(view, value == null ? null : (String) value);
break;
case "fill":
mViewManager.setFill(view, (ReadableMap) value);
break;
case "fillOpacity":
mViewManager.setFillOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "fillRule":
mViewManager.setFillRule(view, value == null ? 1 : ((Double) value).intValue());
break;
case "stroke":
mViewManager.setStroke(view, (ReadableMap) value);
break;
case "strokeOpacity":
mViewManager.setStrokeOpacity(view, value == null ? 1f : ((Double) value).floatValue());
break;
case "strokeWidth":
mViewManager.setStrokeWidth(view, value == null ? "1" : (String) value);
break;
case "strokeLinecap":
mViewManager.setStrokeLinecap(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeLinejoin":
mViewManager.setStrokeLinejoin(view, value == null ? 0 : ((Double) value).intValue());
break;
case "strokeDasharray":
mViewManager.setStrokeDasharray(view, (ReadableArray) value);
break;
case "strokeDashoffset":
mViewManager.setStrokeDashoffset(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "strokeMiterlimit":
mViewManager.setStrokeMiterlimit(view, value == null ? 0f : ((Double) value).floatValue());
break;
case "vectorEffect":
mViewManager.setVectorEffect(view, value == null ? 0 : ((Double) value).intValue());
break;
case "propList":
mViewManager.setPropList(view, (ReadableArray) value);
break;
case "href":
mViewManager.setHref(view, value == null ? null : (String) value);
break;
case "x":
mViewManager.setX(view, value == null ? null : (String) value);
break;
case "y":
mViewManager.setY(view, value == null ? null : (String) value);
break;
case "useheight":
mViewManager.setUseheight(view, value == null ? null : (String) value);
break;
case "usewidth":
mViewManager.setUsewidth(view, value == null ? null : (String) value);
break;
case "height":
mViewManager.setHeight(view, value == null ? null : (String) value);
break;
case "width":
mViewManager.setWidth(view, value == null ? null : (String) value);
break;
default:
super.setProperty(view, propName, value);
}
}
}

View File

@@ -0,0 +1,49 @@
/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
public interface RNSVGUseManagerInterface<T extends View> {
void setName(T view, @Nullable String value);
void setOpacity(T view, float value);
void setMatrix(T view, @Nullable ReadableArray value);
void setMask(T view, @Nullable String value);
void setMarkerStart(T view, @Nullable String value);
void setMarkerMid(T view, @Nullable String value);
void setMarkerEnd(T view, @Nullable String value);
void setClipPath(T view, @Nullable String value);
void setClipRule(T view, int value);
void setResponsible(T view, boolean value);
void setDisplay(T view, @Nullable String value);
void setFill(T view, @Nullable ReadableMap value);
void setFillOpacity(T view, float value);
void setFillRule(T view, int value);
void setStroke(T view, @Nullable ReadableMap value);
void setStrokeOpacity(T view, float value);
void setStrokeWidth(T view, @Nullable String value);
void setStrokeLinecap(T view, int value);
void setStrokeLinejoin(T view, int value);
void setStrokeDasharray(T view, @Nullable ReadableArray value);
void setStrokeDashoffset(T view, float value);
void setStrokeMiterlimit(T view, float value);
void setVectorEffect(T view, int value);
void setPropList(T view, @Nullable ReadableArray value);
void setHref(T view, @Nullable String value);
void setX(T view, @Nullable String value);
void setY(T view, @Nullable String value);
void setUseheight(T view, @Nullable String value);
void setUsewidth(T view, @Nullable String value);
void setHeight(T view, @Nullable String value);
void setWidth(T view, @Nullable String value);
}

View File

@@ -0,0 +1,18 @@
package com.horcrux.svg;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.views.view.ReactViewGroup;
import org.jetbrains.annotations.Nullable;
public abstract class FabricEnabledViewGroup extends ReactViewGroup {
public FabricEnabledViewGroup(@Nullable ReactContext context) {
super(context);
}
protected final void updateScreenSizeFabric(int width, int height) {
// do nothing
}
}

37
common/cpp/Android.mk Normal file
View File

@@ -0,0 +1,37 @@
SVG_COMMON_THIS_DIR := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PATH := $(SVG_COMMON_THIS_DIR)
LOCAL_MODULE := rnsvg_common
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/**/*.cpp)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
# Please note as one of the library listed is libreact_codegen_samplelibrary
# This name will be generated as libreact_codegen_<library-name>
# where <library-name> is the one you specified in the Gradle configuration
LOCAL_SHARED_LIBRARIES := libjsi \
libfbjni \
libglog \
libfolly_runtime \
libyoga \
libreact_nativemodule_core \
libturbomodulejsijni \
librrc_view \
libreact_render_core \
libreact_render_graphics \
libfabricjni \
libreact_debug \
libreact_render_componentregistry \
libreact_render_debug \
libruntimeexecutor \
libreact_codegen_rncore \
libreact_codegen_rnsvg
LOCAL_CFLAGS := \
-DLOG_TAG=\"ReactNative\"
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
include $(BUILD_SHARED_LIBRARY)