-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use yoga::StyleLength instead of yoga::value on 77+ (#2582)
# Summary With [email protected] `yoga::value` is no longer available and we should use `yoga::StyleLength`. ## Test Plan App should build again on 0.77.rc-3
- Loading branch information
Showing
8 changed files
with
86 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,13 +52,12 @@ def resolveReactNativeDirectory() { | |
throw new GradleException("[react-native-svg] Unable to resolve react-native location in node_modules. Your app should define `REACT_NATIVE_NODE_MODULES_DIR` extension property in `app/build.gradle` with a path to react-native in node_modules.") | ||
} | ||
|
||
def getReactNativeMinorVersion() { | ||
def reactNativeRootDir = resolveReactNativeDirectory() | ||
def reactNativeProperties = new Properties() | ||
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactNativeProperties.load(it) } | ||
def reactNativeVersion = reactNativeProperties.getProperty("VERSION_NAME") | ||
return reactNativeVersion.split("\\.")[1].toInteger() | ||
} | ||
def reactNativeRootDir = resolveReactNativeDirectory() | ||
def reactNativeProperties = new Properties() | ||
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactNativeProperties.load(it) } | ||
|
||
def REACT_NATIVE_VERSION = reactNativeProperties.getProperty("VERSION_NAME") | ||
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger() | ||
|
||
def getFrescoVersion() { | ||
def reactNativeRootDir = resolveReactNativeDirectory() | ||
|
@@ -78,6 +77,7 @@ def getFrescoVersion() { | |
} | ||
return frescoVersion | ||
} | ||
def FRESCO_VERSION = getFrescoVersion() | ||
|
||
android { | ||
compileSdkVersion safeExtGet('compileSdkVersion', 28) | ||
|
@@ -106,6 +106,13 @@ android { | |
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
|
||
consumerProguardFiles 'proguard-rules.pro' | ||
|
||
buildConfigField("String", "REACT_NATIVE_MINOR_VERSION", "\"${REACT_NATIVE_MINOR_VERSION}\"") | ||
externalNativeBuild { | ||
cmake { | ||
arguments "-DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}" | ||
} | ||
} | ||
} | ||
lintOptions { | ||
abortOnError false | ||
|
@@ -119,7 +126,7 @@ android { | |
] | ||
} | ||
|
||
if (getReactNativeMinorVersion() >= 75) { // Use for [email protected] and above | ||
if (REACT_NATIVE_MINOR_VERSION >= 75) { // Use for [email protected] and above | ||
// borderRadius fix https://github.com/software-mansion/react-native-svg/pull/2415 | ||
srcDirs += "src/SvgViewManager75/java" | ||
// processTransform replacement https://github.com/software-mansion/react-native-svg/pull/2554 | ||
|
@@ -129,7 +136,7 @@ android { | |
srcDirs += "src/RenderableViewManager73/java" | ||
} | ||
|
||
if (getReactNativeMinorVersion() >= 74) { // Use for [email protected] and above | ||
if (REACT_NATIVE_MINOR_VERSION >= 74) { // Use for [email protected] and above | ||
// new API https://github.com/software-mansion/react-native-svg/pull/2541 | ||
srcDirs += "src/SvgPackage74/java" | ||
} else { | ||
|
@@ -152,14 +159,13 @@ repositories { | |
|
||
dependencies { | ||
implementation 'com.facebook.react:react-native:+' | ||
if (getReactNativeMinorVersion() >= 76) { | ||
def frescoVersion = getFrescoVersion() | ||
implementation("com.facebook.fresco:fresco:${frescoVersion}") { | ||
if (REACT_NATIVE_MINOR_VERSION >= 76) { | ||
implementation("com.facebook.fresco:fresco:${FRESCO_VERSION}") { | ||
exclude group: 'com.facebook.soloader' | ||
} | ||
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}") { | ||
implementation("com.facebook.fresco:imagepipeline-okhttp3:${FRESCO_VERSION}") { | ||
exclude group: 'com.facebook.soloader' | ||
} | ||
implementation("com.facebook.fresco:middleware:${frescoVersion}") | ||
implementation("com.facebook.fresco:middleware:${FRESCO_VERSION}") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copied from Reanimated https://github.com/software-mansion/react-native-reanimated/blob/c6d68151644056476518241b0087b1ed900b39b6/packages/react-native-reanimated/scripts/reanimated_utils.rb | ||
def rnsvg_try_to_parse_react_native_package_json(node_modules_dir) | ||
react_native_package_json_path = File.join(node_modules_dir, 'react-native/package.json') | ||
if !File.exist?(react_native_package_json_path) | ||
return nil | ||
end | ||
return JSON.parse(File.read(react_native_package_json_path)) | ||
end | ||
|
||
def rnsvg_find_config() | ||
result = { | ||
:react_native_version => nil, | ||
:react_native_minor_version => nil, | ||
:react_native_node_modules_dir => nil, | ||
} | ||
|
||
react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..') | ||
react_native_json = rnsvg_try_to_parse_react_native_package_json(react_native_node_modules_dir) | ||
|
||
if react_native_json == nil | ||
# user configuration, just in case | ||
node_modules_dir = ENV["REACT_NATIVE_NODE_MODULES_DIR"] | ||
react_native_json = rnsvg_try_to_parse_react_native_package_json(node_modules_dir) | ||
end | ||
|
||
if react_native_json == nil | ||
raise '[RNSVG] Unable to recognize your `react-native` version. Please set environmental variable with `react-native` location: `export REACT_NATIVE_NODE_MODULES_DIR="<path to react-native>" && pod install`.' | ||
end | ||
|
||
result[:react_native_version] = react_native_json['version'] | ||
result[:react_native_minor_version] = react_native_json['version'].split('.')[1].to_i | ||
if result[:react_native_minor_version] == 0 # nightly | ||
result[:react_native_minor_version] = 1000 | ||
end | ||
result[:react_native_node_modules_dir] = File.expand_path(react_native_node_modules_dir) | ||
|
||
return result | ||
end |