docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep replace keep replace keep keep
<mask> }; <mask> DFEA9A646AAC3AA991D090754F659CAE /* Release */ = { <mask> isa = XCBuildConfiguration; <mask> baseConfigurationReference = 779CD56F5BF18E1ADC18904FEE959D4A /* EXRandom.release.xcconfig */; <mask> buildSettings = { <mask> CLANG_ENABLE_OBJC_WEAK = NO; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove A93B1BA1A49DEC799A8BA508D155F0D3 /* Debug */ = { </s> add 8ED9F549BC989B7DDEB5FBA6A4E01B6B /* Debug */ = { </s> remove 0C54F6831DCA3BEC36AF70BA1FE695D8 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 1C7A324C557D5242205C0775EFE3EB37 /* EXRandom.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/EXRandom/EXRandom-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_MODULE_NAME = EXRandom; PRODUCT_NAME = EXRandom; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; </s> add </s> remove AEB1C5A213013ACFB4F142E31875E30F /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5063B1618AB21EA03BA6C0EE5C560E9D /* EXRandom.release.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/EXRandom/EXRandom-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_MODULE_NAME = EXRandom; PRODUCT_NAME = EXRandom; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; </s> add </s> remove 0C54F6831DCA3BEC36AF70BA1FE695D8 /* Debug */, DFEA9A646AAC3AA991D090754F659CAE /* Release */, </s> add 8ED9F549BC989B7DDEB5FBA6A4E01B6B /* Debug */, 7045DB3ABDD227D30A1753624D0021F7 /* Release */, </s> remove 9F9B00B953B16BEFB7A472A49D295319 /* Build configuration list for PBXNativeTarget "EXRandom" */ = { </s> add 36A85DEC73C5B4E48FEB3E2CE2A26F3C /* Build configuration list for PBXNativeTarget "EXRandom" */ = {
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
ios/Pods/EXRandom.xcodeproj/project.pbxproj
keep replace keep replace keep keep
<mask> TARGETED_DEVICE_FAMILY = "1,2"; <mask> VALIDATE_PRODUCT = YES; <mask> }; <mask> name = Release; <mask> }; <mask> /* End XCBuildConfiguration section */ </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove AEB1C5A213013ACFB4F142E31875E30F /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5063B1618AB21EA03BA6C0EE5C560E9D /* EXRandom.release.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/EXRandom/EXRandom-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_MODULE_NAME = EXRandom; PRODUCT_NAME = EXRandom; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; </s> add </s> remove 0C54F6831DCA3BEC36AF70BA1FE695D8 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 1C7A324C557D5242205C0775EFE3EB37 /* EXRandom.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/EXRandom/EXRandom-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_MODULE_NAME = EXRandom; PRODUCT_NAME = EXRandom; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; </s> add </s> remove name = UMCore; targetProxy = 71A467F5311C64AA39D9D6DC6A8E28CE /* PBXContainerItemProxy */; </s> add name = React; targetProxy = C0971CF7C0B74D3E53AF8EF8D1551347 /* PBXContainerItemProxy */; </s> remove name = UMCore; targetProxy = 2BCB86AB2FE88981E79B828B49578FB4 /* PBXContainerItemProxy */; </s> add name = React; targetProxy = C0971CF7C0B74D3E53AF8EF8D1551347 /* PBXContainerItemProxy */; </s> remove A93B1BA1A49DEC799A8BA508D155F0D3 /* Debug */ = { </s> add 8ED9F549BC989B7DDEB5FBA6A4E01B6B /* Debug */ = {
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
ios/Pods/EXRandom.xcodeproj/project.pbxproj
keep keep keep keep replace keep keep replace replace keep keep keep keep
<mask> }; <mask> /* End XCBuildConfiguration section */ <mask> <mask> /* Begin XCConfigurationList section */ <mask> 9F9B00B953B16BEFB7A472A49D295319 /* Build configuration list for PBXNativeTarget "EXRandom" */ = { <mask> isa = XCConfigurationList; <mask> buildConfigurations = ( <mask> 0C54F6831DCA3BEC36AF70BA1FE695D8 /* Debug */, <mask> DFEA9A646AAC3AA991D090754F659CAE /* Release */, <mask> ); <mask> defaultConfigurationIsVisible = 0; <mask> defaultConfigurationName = Release; <mask> }; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove 300933D08555CB7EDD3E961A886E0E71 /* Debug */, 7E3223FFA731463206A0217DA17610E5 /* Release */, </s> add 8ED9F549BC989B7DDEB5FBA6A4E01B6B /* Debug */, 7045DB3ABDD227D30A1753624D0021F7 /* Release */, </s> remove A93B1BA1A49DEC799A8BA508D155F0D3 /* Debug */, AEB1C5A213013ACFB4F142E31875E30F /* Release */, </s> add 300933D08555CB7EDD3E961A886E0E71 /* Debug */, 7E3223FFA731463206A0217DA17610E5 /* Release */, </s> remove DDBF30326786AD4461D96B57BDD17EAE /* Build configuration list for PBXNativeTarget "EXRandom" */ = { </s> add DA6318F3F1C1D240A40D56C5915E8F3F /* Build configuration list for PBXProject "EXRandom" */ = { </s> remove DA6318F3F1C1D240A40D56C5915E8F3F /* Build configuration list for PBXProject "EXRandom" */ = { </s> add 36A85DEC73C5B4E48FEB3E2CE2A26F3C /* Build configuration list for PBXNativeTarget "EXRandom" */ = { </s> remove name = Release; </s> add name = Debug;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
ios/Pods/EXRandom.xcodeproj/project.pbxproj
keep keep replace replace replace replace replace replace replace replace keep replace
<mask> } <mask> <mask> if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) { <mask> apply from: project(":unimodules-core").file("../unimodules-core.gradle") <mask> } else { <mask> throw new GradleException( <mask> "'unimodules-core.gradle' was not found in the usual Flutter or React Native dependency locations. " + <mask> "This package can only be used in such projects. Are you sure you've installed the dependencies properly?") <mask> } <mask> <mask> dependencies { <mask> unimodule "unimodules-core" </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove UM_EXPORT_MODULE(ExpoRandom); UM_EXPORT_METHOD_AS(getRandomBase64StringAsync, getRandomBase64StringAsync:(NSNumber *)count resolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { NSUInteger _length = [count unsignedIntegerValue]; NSMutableData *bytes = [NSMutableData dataWithLength:_length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, _length, [bytes mutableBytes]); if (result == errSecSuccess) { resolve([bytes base64EncodedStringWithOptions:0]); } else { reject(@"ERR_RANDOM", @"Failed to create a secure random number", [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]); } </s> add static NSString * const EXRandomError = @"ERR_RANDOM"; static NSString * const EXRandomRandomBytesFailedError = @"Failed to create secure random number"; RCT_EXPORT_MODULE(ExpoRandom); RCT_EXPORT_METHOD(getRandomBase64StringAsync:(NSUInteger)length resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { resolve(value); } else { reject(EXRandomError, EXRandomRandomBytesFailedError, error); } } RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString*, getRandomBase64String:(NSUInteger)length) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { return value; } else { @throw [NSException exceptionWithName:EXRandomError reason:EXRandomRandomBytesFailedError userInfo:@{@"errorCode": @(error.code)}]; }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/build.gradle
keep replace keep keep keep keep replace replace replace replace
<mask> <mask> import android.content.Context; <mask> import android.util.Base64; <mask> <mask> import java.security.SecureRandom; <mask> <mask> import org.unimodules.core.ExportedModule; <mask> import org.unimodules.core.ModuleRegistry; <mask> import org.unimodules.core.interfaces.ExpoMethod; <mask> import org.unimodules.core.Promise; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove public class RandomModule extends ExportedModule { </s> add public class RandomModule extends ReactContextBaseJavaModule { SecureRandom mSecureRandom; </s> remove import android.content.Context; </s> add import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.uimanager.ViewManager; import com.facebook.react.bridge.ReactApplicationContext; </s> remove import expo.modules.random.RandomPackage; </s> add </s> add import expo.modules.random.RandomPackage; </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomModule.java
keep replace keep replace replace replace keep keep keep
<mask> <mask> public class RandomModule extends ExportedModule { <mask> <mask> SecureRandom mRandom; <mask> <mask> public RandomModule(Context context) { <mask> super(context); <mask> } <mask> </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove import org.unimodules.core.ExportedModule; import org.unimodules.core.ModuleRegistry; import org.unimodules.core.interfaces.ExpoMethod; import org.unimodules.core.Promise; </s> add import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; </s> remove @Override public void onCreate(ModuleRegistry moduleRegistry) { if (moduleRegistry != null) { mRandom = new SecureRandom(); } } </s> add </s> remove public List<ExportedModule> createExportedModules(Context context) { return Collections.singletonList((ExportedModule) new RandomModule(context)); </s> add public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); </s> remove public class RandomPackage extends BasePackage { </s> add </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomModule.java
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> public RandomModule(Context context) { <mask> super(context); <mask> } <mask> <mask> @Override <mask> public void onCreate(ModuleRegistry moduleRegistry) { <mask> if (moduleRegistry != null) { <mask> mRandom = new SecureRandom(); <mask> } <mask> } <mask> <mask> @Override <mask> public String getName() { <mask> return "ExpoRandom"; <mask> } <mask> </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove SecureRandom mRandom; public RandomModule(Context context) { </s> add public RandomModule(ReactApplicationContext context) { </s> remove @ExpoMethod public void getRandomBase64StringAsync(int randomByteCount, final Promise promise) { </s> add @ReactMethod public void getRandomBase64StringAsync(int randomByteCount, Promise promise) { promise.resolve(getRandomBase64String(randomByteCount)); } @ReactMethod(isBlockingSynchronousMethod = true) public String getRandomBase64String(int randomByteCount) { if (mSecureRandom == null) { mSecureRandom = new SecureRandom(); } </s> remove public List<ExportedModule> createExportedModules(Context context) { return Collections.singletonList((ExportedModule) new RandomModule(context)); </s> add public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); </s> remove public class RandomPackage extends BasePackage { </s> add </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); } </s> remove mRandom.nextBytes(output); promise.resolve(Base64.encodeToString(output, Base64.NO_WRAP)); </s> add mSecureRandom.nextBytes(output); return Base64.encodeToString(output, Base64.NO_WRAP);
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomModule.java
keep keep keep keep replace replace keep replace replace
<mask> public String getName() { <mask> return "ExpoRandom"; <mask> } <mask> <mask> @ExpoMethod <mask> public void getRandomBase64StringAsync(int randomByteCount, final Promise promise) { <mask> byte[] output = new byte[randomByteCount]; <mask> mRandom.nextBytes(output); <mask> promise.resolve(Base64.encodeToString(output, Base64.NO_WRAP)); </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove @Override public void onCreate(ModuleRegistry moduleRegistry) { if (moduleRegistry != null) { mRandom = new SecureRandom(); } } </s> add </s> remove public List<ExportedModule> createExportedModules(Context context) { return Collections.singletonList((ExportedModule) new RandomModule(context)); </s> add public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); </s> remove SecureRandom mRandom; public RandomModule(Context context) { </s> add public RandomModule(ReactApplicationContext context) { </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); } </s> remove public class RandomPackage extends BasePackage { </s> add
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomModule.java
keep keep keep replace keep keep keep keep keep
<mask> <mask> package expo.modules.random; <mask> <mask> import android.content.Context; <mask> <mask> import java.util.Collections; <mask> import java.util.List; <mask> <mask> import org.unimodules.core.BasePackage; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove import android.content.Context; </s> add </s> add import java.util.Arrays; </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); } </s> add import expo.modules.random.RandomPackage; </s> remove public class RandomPackage extends BasePackage { </s> add </s> remove import expo.modules.random.RandomPackage; </s> add
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomPackage.java
keep add keep keep keep keep
<mask> import com.facebook.react.bridge.ReactApplicationContext; <mask> <mask> import java.util.Collections; <mask> import java.util.List; <mask> <mask> public class RandomPackage implements ReactPackage { </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); } </s> remove import android.content.Context; </s> add import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.uimanager.ViewManager; import com.facebook.react.bridge.ReactApplicationContext; </s> add // This is an Expo module but not a unimodule import expo.modules.random.RandomModule; </s> remove import org.unimodules.core.ExportedModule; import org.unimodules.core.ModuleRegistry; import org.unimodules.core.interfaces.ExpoMethod; import org.unimodules.core.Promise; </s> add import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; </s> remove public class RandomPackage extends BasePackage { </s> add </s> remove public class RandomModule extends ExportedModule { </s> add public class RandomModule extends ReactContextBaseJavaModule { SecureRandom mSecureRandom;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomPackage.java
keep keep keep keep replace replace replace keep replace keep keep keep keep
<mask> <mask> import java.util.Collections; <mask> import java.util.List; <mask> <mask> import org.unimodules.core.BasePackage; <mask> import org.unimodules.core.ExportedModule; <mask> import org.unimodules.core.ViewManager; <mask> <mask> public class RandomPackage extends BasePackage { <mask> @Override <mask> public List<ExportedModule> createExportedModules(Context context) { <mask> return Collections.singletonList((ExportedModule) new RandomModule(context)); <mask> } </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove public List<ExportedModule> createExportedModules(Context context) { return Collections.singletonList((ExportedModule) new RandomModule(context)); </s> add public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); </s> add import java.util.Arrays; </s> remove public class RandomModule extends ExportedModule { </s> add public class RandomModule extends ReactContextBaseJavaModule { SecureRandom mSecureRandom; </s> remove SecureRandom mRandom; public RandomModule(Context context) { </s> add public RandomModule(ReactApplicationContext context) { </s> remove import org.unimodules.core.ExportedModule; import org.unimodules.core.ModuleRegistry; import org.unimodules.core.interfaces.ExpoMethod; import org.unimodules.core.Promise; </s> add import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomPackage.java
keep keep keep keep replace replace keep keep
<mask> import org.unimodules.core.ViewManager; <mask> <mask> public class RandomPackage extends BasePackage { <mask> @Override <mask> public List<ExportedModule> createExportedModules(Context context) { <mask> return Collections.singletonList((ExportedModule) new RandomModule(context)); <mask> } <mask> } </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove public class RandomPackage extends BasePackage { </s> add </s> remove import org.unimodules.core.BasePackage; import org.unimodules.core.ExportedModule; import org.unimodules.core.ViewManager; </s> add public class RandomPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RandomModule(reactContext)); } </s> remove SecureRandom mRandom; public RandomModule(Context context) { </s> add public RandomModule(ReactApplicationContext context) { </s> remove @Override public void onCreate(ModuleRegistry moduleRegistry) { if (moduleRegistry != null) { mRandom = new SecureRandom(); } } </s> add </s> remove public class RandomModule extends ExportedModule { </s> add public class RandomModule extends ReactContextBaseJavaModule { SecureRandom mSecureRandom; </s> add import java.util.Arrays;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/android/src/main/java/expo/modules/random/RandomPackage.java
keep add keep keep keep
<mask> declare const _default: { <mask> readonly name: string; <mask> getRandomBytesAsync(length: number): Promise<Uint8Array>; <mask> }; <mask> export default _default; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove ExpoRandom: [{ key: 0, argumentsCount: 1, name: 'getRandomBase64StringAsync' }], </s> add </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes');
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/build/ExpoRandom.web.d.ts
keep keep add keep keep keep keep
<mask> get name() { <mask> return 'ExpoRandom'; <mask> }, <mask> async getRandomBytesAsync(length) { <mask> const array = new Uint8Array(length); <mask> // @ts-ignore <mask> return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes');
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/build/ExpoRandom.web.js
keep keep keep keep replace keep keep keep
<mask> return 'ExpoRandom'; <mask> }, <mask> async getRandomBytesAsync(length) { <mask> const array = new Uint8Array(length); <mask> return window.crypto.getRandomValues(array); <mask> }, <mask> }; <mask> //# sourceMappingURL=ExpoRandom.web.js.map </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add getRandomBytes(length) { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes');
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/build/ExpoRandom.web.js
keep replace keep keep keep keep replace keep keep
<mask> import ExpoRandom from './ExpoRandom'; <mask> function assertByteCount(value) { <mask> if (typeof value !== 'number' || <mask> isNaN(value) || <mask> Math.floor(value) < 0 || <mask> Math.floor(value) > 1024) { <mask> throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); <mask> } <mask> } </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove function assertByteCount(value: any): void { </s> add function assertByteCount(value: any, methodName: string): void { </s> remove `expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024` </s> add `expo-random: ${methodName}(${value}) expected a valid number from range 0...1024` </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync');
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/build/Random.js
keep keep keep keep replace keep keep keep keep keep
<mask> throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); <mask> } <mask> } <mask> export async function getRandomBytesAsync(byteCount) { <mask> assertByteCount(byteCount); <mask> const validByteCount = Math.floor(byteCount); <mask> if (ExpoRandom.getRandomBytesAsync) { <mask> return await ExpoRandom.getRandomBytesAsync(validByteCount); <mask> } <mask> else if (ExpoRandom.getRandomBase64StringAsync) { </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove `expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024` </s> add `expo-random: ${methodName}(${value}) expected a valid number from range 0...1024` </s> remove function assertByteCount(value) { </s> add function assertByteCount(value, methodName) { </s> remove UM_EXPORT_MODULE(ExpoRandom); UM_EXPORT_METHOD_AS(getRandomBase64StringAsync, getRandomBase64StringAsync:(NSNumber *)count resolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { NSUInteger _length = [count unsignedIntegerValue]; NSMutableData *bytes = [NSMutableData dataWithLength:_length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, _length, [bytes mutableBytes]); if (result == errSecSuccess) { resolve([bytes base64EncodedStringWithOptions:0]); } else { reject(@"ERR_RANDOM", @"Failed to create a secure random number", [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]); } </s> add static NSString * const EXRandomError = @"ERR_RANDOM"; static NSString * const EXRandomRandomBytesFailedError = @"Failed to create secure random number"; RCT_EXPORT_MODULE(ExpoRandom); RCT_EXPORT_METHOD(getRandomBase64StringAsync:(NSUInteger)length resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { resolve(value); } else { reject(EXRandomError, EXRandomRandomBytesFailedError, error); } } RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString*, getRandomBase64String:(NSUInteger)length) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { return value; } else { @throw [NSException exceptionWithName:EXRandomError reason:EXRandomRandomBytesFailedError userInfo:@{@"errorCode": @(error.code)}]; }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/build/Random.js
keep keep keep keep replace keep keep keep
<mask> s.source_files = 'EXRandom/**/*.{h,m}' <mask> s.preserve_paths = 'EXRandom/**/*.{h,m}' <mask> s.requires_arc = true <mask> <mask> s.dependency 'UMCore' <mask> end <mask> <mask> </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove D6ADFE68665AAE170EAF262C8B848B14 /* UMCore */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UMCore; path = UMCore.xcodeproj; sourceTree = "<group>"; }; </s> add </s> remove D6ADFE68665AAE170EAF262C8B848B14 /* UMCore */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UMCore; path = UMCore.xcodeproj; sourceTree = "<group>"; }; </s> add FDCA8F549D32EB7E5A41359356DA801D /* React */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React; path = React.xcodeproj; sourceTree = "<group>"; }; </s> remove 0C54F6831DCA3BEC36AF70BA1FE695D8 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 1C7A324C557D5242205C0775EFE3EB37 /* EXRandom.debug.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/EXRandom/EXRandom-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_MODULE_NAME = EXRandom; PRODUCT_NAME = EXRandom; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; </s> add </s> add FDCA8F549D32EB7E5A41359356DA801D /* React */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React; path = React.xcodeproj; sourceTree = "<group>"; }; </s> remove AEB1C5A213013ACFB4F142E31875E30F /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5063B1618AB21EA03BA6C0EE5C560E9D /* EXRandom.release.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; GCC_PREFIX_HEADER = "Target Support Files/EXRandom/EXRandom-prefix.pch"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; PRIVATE_HEADERS_FOLDER_PATH = ""; PRODUCT_MODULE_NAME = EXRandom; PRODUCT_NAME = EXRandom; PUBLIC_HEADERS_FOLDER_PATH = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; </s> add </s> remove remoteGlobalIDString = 153171642F5C5CBC05FD3EF6B23A3F36; remoteInfo = UMCore; </s> add remoteGlobalIDString = 94DA87F24FB4B93E5D08FE961D5E5A3E; remoteInfo = React;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/ios/EXRandom.podspec
replace keep replace replace replace replace keep keep
<mask> // Copyright 2019-present 650 Industries. All rights reserved. <mask> <mask> #import <UMCore/UMModuleRegistry.h> <mask> #import <UIKit/UIKit.h> <mask> <mask> @interface EXRandom : UMExportedModule <mask> <mask> @end </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove UM_EXPORT_MODULE(ExpoRandom); UM_EXPORT_METHOD_AS(getRandomBase64StringAsync, getRandomBase64StringAsync:(NSNumber *)count resolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { NSUInteger _length = [count unsignedIntegerValue]; NSMutableData *bytes = [NSMutableData dataWithLength:_length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, _length, [bytes mutableBytes]); if (result == errSecSuccess) { resolve([bytes base64EncodedStringWithOptions:0]); } else { reject(@"ERR_RANDOM", @"Failed to create a secure random number", [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]); } </s> add static NSString * const EXRandomError = @"ERR_RANDOM"; static NSString * const EXRandomRandomBytesFailedError = @"Failed to create secure random number"; RCT_EXPORT_MODULE(ExpoRandom); RCT_EXPORT_METHOD(getRandomBase64StringAsync:(NSUInteger)length resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { resolve(value); } else { reject(EXRandomError, EXRandomRandomBytesFailedError, error); } } RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString*, getRandomBase64String:(NSUInteger)length) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { return value; } else { @throw [NSException exceptionWithName:EXRandomError reason:EXRandomRandomBytesFailedError userInfo:@{@"errorCode": @(error.code)}]; } </s> add // expo-random is no longer a unimodule api project(':expo-random') </s> add implementation project(":expo-random") </s> add compileOnly project(':expo-random') </s> add // Include Expo modules that are not unimodules include(":expo-random") project(":expo-random").projectDir = new File("../packages/expo-random/android")
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/ios/EXRandom/EXRandom.h
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep
<mask> #import <EXRandom/EXRandom.h> <mask> <mask> @implementation EXRandom <mask> <mask> UM_EXPORT_MODULE(ExpoRandom); <mask> <mask> UM_EXPORT_METHOD_AS(getRandomBase64StringAsync, <mask> getRandomBase64StringAsync:(NSNumber *)count <mask> resolver:(UMPromiseResolveBlock)resolve <mask> rejecter:(UMPromiseRejectBlock)reject) <mask> { <mask> NSUInteger _length = [count unsignedIntegerValue]; <mask> NSMutableData *bytes = [NSMutableData dataWithLength:_length]; <mask> <mask> OSStatus result = SecRandomCopyBytes(kSecRandomDefault, _length, [bytes mutableBytes]); <mask> if (result == errSecSuccess) { <mask> resolve([bytes base64EncodedStringWithOptions:0]); <mask> } else { <mask> reject(@"ERR_RANDOM", @"Failed to create a secure random number", [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]); <mask> } <mask> } <mask> <mask> <mask> @end </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add #pragma mark - Internal methods - (NSString *)_getRandomBase64String:(NSUInteger)length error:(NSError **)error { NSMutableData *bytes = [NSMutableData dataWithLength:length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, length, [bytes mutableBytes]); if (result == errSecSuccess) { return [bytes base64EncodedStringWithOptions:0]; } else if (error) { *error = [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]; } return nil; } </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove @ExpoMethod public void getRandomBase64StringAsync(int randomByteCount, final Promise promise) { </s> add @ReactMethod public void getRandomBase64StringAsync(int randomByteCount, Promise promise) { promise.resolve(getRandomBase64String(randomByteCount)); } @ReactMethod(isBlockingSynchronousMethod = true) public String getRandomBase64String(int randomByteCount) { if (mSecureRandom == null) { mSecureRandom = new SecureRandom(); }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/ios/EXRandom/EXRandom.m
keep add keep keep
<mask> } <mask> <mask> <mask> @end </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove #import <UMCore/UMModuleRegistry.h> #import <UIKit/UIKit.h> @interface EXRandom : UMExportedModule </s> add @interface EXRandom : NSObject <RCTBridgeModule> </s> remove UM_EXPORT_MODULE(ExpoRandom); UM_EXPORT_METHOD_AS(getRandomBase64StringAsync, getRandomBase64StringAsync:(NSNumber *)count resolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { NSUInteger _length = [count unsignedIntegerValue]; NSMutableData *bytes = [NSMutableData dataWithLength:_length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, _length, [bytes mutableBytes]); if (result == errSecSuccess) { resolve([bytes base64EncodedStringWithOptions:0]); } else { reject(@"ERR_RANDOM", @"Failed to create a secure random number", [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]); } </s> add static NSString * const EXRandomError = @"ERR_RANDOM"; static NSString * const EXRandomRandomBytesFailedError = @"Failed to create secure random number"; RCT_EXPORT_MODULE(ExpoRandom); RCT_EXPORT_METHOD(getRandomBase64StringAsync:(NSUInteger)length resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { resolve(value); } else { reject(EXRandomError, EXRandomRandomBytesFailedError, error); } } RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString*, getRandomBase64String:(NSUInteger)length) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { return value; } else { @throw [NSException exceptionWithName:EXRandomError reason:EXRandomRandomBytesFailedError userInfo:@{@"errorCode": @(error.code)}]; } </s> remove @Override public void onCreate(ModuleRegistry moduleRegistry) { if (moduleRegistry != null) { mRandom = new SecureRandom(); } } </s> add </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove @ExpoMethod public void getRandomBase64StringAsync(int randomByteCount, final Promise promise) { </s> add @ReactMethod public void getRandomBase64StringAsync(int randomByteCount, Promise promise) { promise.resolve(getRandomBase64String(randomByteCount)); } @ReactMethod(isBlockingSynchronousMethod = true) public String getRandomBase64String(int randomByteCount) { if (mSecureRandom == null) { mSecureRandom = new SecureRandom(); } </s> remove if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) { apply from: project(":unimodules-core").file("../unimodules-core.gradle") } else { throw new GradleException( "'unimodules-core.gradle' was not found in the usual Flutter or React Native dependency locations. " + "This package can only be used in such projects. Are you sure you've installed the dependencies properly?") } </s> add
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/ios/EXRandom/EXRandom.m
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "homepage": "https://github.com/expo/expo/tree/master/packages/expo-random", <mask> "jest": { <mask> "preset": "expo-module-scripts" <mask> }, <mask> "unimodulePeerDependencies": { <mask> "@unimodules/core": "*" <mask> }, <mask> "devDependencies": { <mask> "expo-module-scripts": "~1.2.0" <mask> }, <mask> "dependencies": { <mask> "base64-js": "^1.3.0" </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add ExpoRandom: { getRandomBase64StringAsync: { type: 'function', functionType: 'promise' }, getRandomBase64String: { type: 'function' }, }, </s> remove "uuid": "^3.1.0", </s> add "uuid": "^8.3.0", </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> add getRandomBytes(length) { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove ExpoRandom: [{ key: 0, argumentsCount: 1, name: 'getRandomBase64StringAsync' }], </s> add </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array);
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/package.json
keep keep add keep keep keep keep keep keep
<mask> get name(): string { <mask> return 'ExpoRandom'; <mask> }, <mask> async getRandomBytesAsync(length: number): Promise<Uint8Array> { <mask> const array = new Uint8Array(length); <mask> // @ts-ignore <mask> return (window.crypto ?? window.msCrypto).getRandomValues(array); <mask> }, <mask> }; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> add getRandomBytes(length) { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> add getRandomBytes(length: number): Uint8Array;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/src/ExpoRandom.web.ts
keep keep keep keep replace keep keep
<mask> return 'ExpoRandom'; <mask> }, <mask> async getRandomBytesAsync(length: number): Promise<Uint8Array> { <mask> const array = new Uint8Array(length); <mask> return window.crypto.getRandomValues(array); <mask> }, <mask> }; </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> add getRandomBytes(length) { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> add getRandomBytes(length: number): Uint8Array;
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/src/ExpoRandom.web.ts
keep keep keep keep replace keep keep keep keep keep
<mask> import { toByteArray } from 'base64-js'; <mask> <mask> import ExpoRandom from './ExpoRandom'; <mask> <mask> function assertByteCount(value: any): void { <mask> if ( <mask> typeof value !== 'number' || <mask> isNaN(value) || <mask> Math.floor(value) < 0 || <mask> Math.floor(value) > 1024 </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove function assertByteCount(value) { </s> add function assertByteCount(value, methodName) { </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove `expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024` </s> add `expo-random: ${methodName}(${value}) expected a valid number from range 0...1024` </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove SecureRandom mRandom; public RandomModule(Context context) { </s> add public RandomModule(ReactApplicationContext context) { </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/src/Random.ts
keep keep keep keep replace keep keep keep keep keep
<mask> Math.floor(value) < 0 || <mask> Math.floor(value) > 1024 <mask> ) { <mask> throw new TypeError( <mask> `expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024` <mask> ); <mask> } <mask> } <mask> <mask> export async function getRandomBytesAsync(byteCount: number): Promise<Uint8Array> { </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove function assertByteCount(value) { </s> add function assertByteCount(value, methodName) { </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove function assertByteCount(value: any): void { </s> add function assertByteCount(value: any, methodName: string): void { </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync');
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/src/Random.ts
keep keep add keep keep keep keep
<mask> } <mask> } <mask> <mask> export async function getRandomBytesAsync(byteCount: number): Promise<Uint8Array> { <mask> assertByteCount(byteCount, 'getRandomBytesAsync'); <mask> const validByteCount = Math.floor(byteCount); <mask> if (ExpoRandom.getRandomBytesAsync) { </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove `expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024` </s> add `expo-random: ${methodName}(${value}) expected a valid number from range 0...1024` </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array);
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/src/Random.ts
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> } <mask> <mask> export async function getRandomBytesAsync(byteCount: number): Promise<Uint8Array> { <mask> assertByteCount(byteCount); <mask> const validByteCount = Math.floor(byteCount); <mask> if (ExpoRandom.getRandomBytesAsync) { <mask> return await ExpoRandom.getRandomBytesAsync(validByteCount); <mask> } else if (ExpoRandom.getRandomBase64StringAsync) { <mask> const base64 = await ExpoRandom.getRandomBase64StringAsync(validByteCount); </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove assertByteCount(byteCount); </s> add assertByteCount(byteCount, 'getRandomBytesAsync'); </s> add export function getRandomBytes(byteCount: number): Uint8Array { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); } } </s> remove throw new TypeError(`expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024`); </s> add throw new TypeError(`expo-random: ${methodName}(${value}) expected a valid number from range 0...1024`); } } export function getRandomBytes(byteCount) { assertByteCount(byteCount, 'getRandomBytes'); const validByteCount = Math.floor(byteCount); if (ExpoRandom.getRandomBytes) { return ExpoRandom.getRandomBytes(validByteCount); } else if (ExpoRandom.getRandomBase64String) { const base64 = ExpoRandom.getRandomBase64String(validByteCount); return toByteArray(base64); } else { throw new UnavailabilityError('expo-random', 'getRandomBytes'); </s> remove UM_EXPORT_MODULE(ExpoRandom); UM_EXPORT_METHOD_AS(getRandomBase64StringAsync, getRandomBase64StringAsync:(NSNumber *)count resolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { NSUInteger _length = [count unsignedIntegerValue]; NSMutableData *bytes = [NSMutableData dataWithLength:_length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, _length, [bytes mutableBytes]); if (result == errSecSuccess) { resolve([bytes base64EncodedStringWithOptions:0]); } else { reject(@"ERR_RANDOM", @"Failed to create a secure random number", [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]); } </s> add static NSString * const EXRandomError = @"ERR_RANDOM"; static NSString * const EXRandomRandomBytesFailedError = @"Failed to create secure random number"; RCT_EXPORT_MODULE(ExpoRandom); RCT_EXPORT_METHOD(getRandomBase64StringAsync:(NSUInteger)length resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { resolve(value); } else { reject(EXRandomError, EXRandomRandomBytesFailedError, error); } } RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString*, getRandomBase64String:(NSUInteger)length) { NSError *error; NSString *value = [self _getRandomBase64String:length error:&error]; if (value != nil) { return value; } else { @throw [NSException exceptionWithName:EXRandomError reason:EXRandomRandomBytesFailedError userInfo:@{@"errorCode": @(error.code)}]; } </s> remove `expo-random: getRandomBytesAsync(${value}) expected a valid number from range 0...1024` </s> add `expo-random: ${methodName}(${value}) expected a valid number from range 0...1024` </s> add #pragma mark - Internal methods - (NSString *)_getRandomBase64String:(NSUInteger)length error:(NSError **)error { NSMutableData *bytes = [NSMutableData dataWithLength:length]; OSStatus result = SecRandomCopyBytes(kSecRandomDefault, length, [bytes mutableBytes]); if (result == errSecSuccess) { return [bytes base64EncodedStringWithOptions:0]; } else if (error) { *error = [NSError errorWithDomain:@"expo-random" code:result userInfo:nil]; } return nil; }
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/expo-random/src/Random.ts
keep keep keep add keep keep keep keep keep
<mask> scheduleNotificationWithCalendar: { type: 'function', functionType: 'promise' }, <mask> scheduleNotificationWithTimer: { type: 'function', functionType: 'promise' }, <mask> setBadgeNumberAsync: { type: 'function', functionType: 'promise' }, <mask> }, <mask> ExponentScopedModuleRegistry: {}, <mask> ExponentSplashScreen: { <mask> getConstants: { type: 'function' }, <mask> hide: { type: 'function', functionType: 'async' }, <mask> preventAutoHide: { type: 'function', functionType: 'async' }, </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> remove "unimodulePeerDependencies": { "@unimodules/core": "*" }, </s> add </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove ExpoRandom: [{ key: 0, argumentsCount: 1, name: 'getRandomBase64StringAsync' }], </s> add </s> add getRandomBytes(length) { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array);
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/jest-expo/src/preset/expoModules.js
keep keep keep keep replace keep keep keep keep keep
<mask> { key: 1, argumentsCount: 1, name: 'askAsync' }, <mask> ], <mask> ExpoPublisherBannerView: [], <mask> ExpoPushTokenManager: [{ key: 0, argumentsCount: 0, name: 'getDevicePushTokenAsync' }], <mask> ExpoRandom: [{ key: 0, argumentsCount: 1, name: 'getRandomBase64StringAsync' }], <mask> ExpoSMS: [ <mask> { key: 0, argumentsCount: 0, name: 'isAvailableAsync' }, <mask> { key: 1, argumentsCount: 3, name: 'sendSMSAsync' }, <mask> ], <mask> ExpoScreenCapture: [ </s> [expo-random] Add sync equivalents for expo-random methods (#9750) </s> add getRandomBytes(length: number): Uint8Array; </s> add ExpoRandom: { getRandomBase64StringAsync: { type: 'function', functionType: 'promise' }, getRandomBase64String: { type: 'function' }, }, </s> remove "unimodulePeerDependencies": { "@unimodules/core": "*" }, </s> add </s> add getRandomBytes(length: number): Uint8Array { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> add getRandomBytes(length) { const array = new Uint8Array(length); // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array); }, </s> remove return window.crypto.getRandomValues(array); </s> add // @ts-ignore return (window.crypto ?? window.msCrypto).getRandomValues(array);
https://github.com/expo/expo/commit/3571d4149c977e8d7997dbe00fe4ea58d731b3db
packages/jest-expo/src/preset/expoModules.js
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> required: false <mask> gradle: <mask> description: 'Restore Gradle cache' <mask> required: false <mask> avd: <mask> description: 'Restore AVD cache' <mask> required: false <mask> avd-api: <mask> description: 'API version used in AVD' <mask> default: '31' <mask> required: false <mask> ndk: <mask> description: 'Restore NDK cache' <mask> required: false <mask> ndk-version: <mask> description: 'NDK version used' </s> [ci] avd api 33 (#22216) # Why our `targetSdkVersion` is now 33, we should update the emulator for 33 as well. # How - update api to 33 - introduce `use-android-emulator` action and remove the emulator from expo-caches action. that would put all emulator settings in a single place. other than that, i noticed that emulator booting from snapshot is not quite stable. it just reduces about two minutes and waste cache disk size. this pr also removes the emulator cache. - based on #22214, we can now build apks on ubuntu runners and then run tests on macos runner. that would save the macos runner limit a little bit. > **Note** google only provides api-33 emulator image with google_apis target and [it's not very stable](https://github.com/ReactiveCircus/android-emulator-runner/discussions/286#discussioncomment-4028889). it sometimes has the SystemUI ANR. i've tried as much as i can to supress the SystemUI ANR error. if the error rate is too high, i will disable the slack notification for test-suite android-test failures. # Test Plan - ci passed - android instrumentation test is also broken on main. will follow up in a separated pr. </s> remove GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m </s> add GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=4096m" </s> remove android: runs-on: macos-12 </s> add android-build: runs-on: ubuntu-20.04 </s> remove avd-hit: description: 'Returns true, if AVD cache is up-to-date' value: steps.avd-cache.outputs.cache-hit </s> add
https://github.com/expo/expo/commit/383b651ef226c582995558564b878b3647a1a736
.github/actions/expo-caches/action.yml
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> value: steps.bare-expo-pods-cache.outputs.cache-hit <mask> native-tests-pods-hit: <mask> description: 'Returns true, if /apps/native-tests/ios pods cache is up-to-date' <mask> value: steps.native-tests-pods-cache.outputs.cache-hit <mask> avd-hit: <mask> description: 'Returns true, if AVD cache is up-to-date' <mask> value: steps.avd-cache.outputs.cache-hit <mask> git-lfs-hit: <mask> description: 'Returns true, if Git LFS cache is up-to-date' <mask> value: steps.git-lfs-cache.outputs.cache-hit <mask> hermes-engine-aar-hit: <mask> description: 'Returns true, if prebuilt hermes-engine AAR cache is up-to-date' </s> [ci] avd api 33 (#22216) # Why our `targetSdkVersion` is now 33, we should update the emulator for 33 as well. # How - update api to 33 - introduce `use-android-emulator` action and remove the emulator from expo-caches action. that would put all emulator settings in a single place. other than that, i noticed that emulator booting from snapshot is not quite stable. it just reduces about two minutes and waste cache disk size. this pr also removes the emulator cache. - based on #22214, we can now build apks on ubuntu runners and then run tests on macos runner. that would save the macos runner limit a little bit. > **Note** google only provides api-33 emulator image with google_apis target and [it's not very stable](https://github.com/ReactiveCircus/android-emulator-runner/discussions/286#discussioncomment-4028889). it sometimes has the SystemUI ANR. i've tried as much as i can to supress the SystemUI ANR error. if the error rate is too high, i will disable the slack notification for test-suite android-test failures. # Test Plan - ci passed - android instrumentation test is also broken on main. will follow up in a separated pr. </s> remove GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m </s> add GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=4096m" </s> remove android: runs-on: macos-12 </s> add android-build: runs-on: ubuntu-20.04 </s> remove avd: description: 'Restore AVD cache' required: false avd-api: description: 'API version used in AVD' default: '31' required: false </s> add
https://github.com/expo/expo/commit/383b651ef226c582995558564b878b3647a1a736
.github/actions/expo-caches/action.yml
keep keep replace replace keep keep replace keep keep keep keep
<mask> author_name: Test Suite Nightly (iOS) <mask> <mask> android: <mask> runs-on: macos-12 <mask> env: <mask> ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64 <mask> GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m <mask> REACT_NATIVE_OVERRIDE_VERSION: 9999.9999.9999 <mask> strategy: <mask> matrix: <mask> api-level: [31] </s> [ci] avd api 33 (#22216) # Why our `targetSdkVersion` is now 33, we should update the emulator for 33 as well. # How - update api to 33 - introduce `use-android-emulator` action and remove the emulator from expo-caches action. that would put all emulator settings in a single place. other than that, i noticed that emulator booting from snapshot is not quite stable. it just reduces about two minutes and waste cache disk size. this pr also removes the emulator cache. - based on #22214, we can now build apks on ubuntu runners and then run tests on macos runner. that would save the macos runner limit a little bit. > **Note** google only provides api-33 emulator image with google_apis target and [it's not very stable](https://github.com/ReactiveCircus/android-emulator-runner/discussions/286#discussioncomment-4028889). it sometimes has the SystemUI ANR. i've tried as much as i can to supress the SystemUI ANR error. if the error rate is too high, i will disable the slack notification for test-suite android-test failures. # Test Plan - ci passed - android instrumentation test is also broken on main. will follow up in a separated pr. </s> remove avd-hit: description: 'Returns true, if AVD cache is up-to-date' value: steps.avd-cache.outputs.cache-hit </s> add </s> remove avd: description: 'Restore AVD cache' required: false avd-api: description: 'API version used in AVD' default: '31' required: false </s> add
https://github.com/expo/expo/commit/383b651ef226c582995558564b878b3647a1a736
.github/workflows/test-suite-nightly.yml
keep replace replace replace replace replace keep replace replace keep keep
<mask> <mask> if (delta.size() != 0) { <mask> if (!valueSet) { <mask> value = delta.get(0); <mask> valueSet = true; <mask> } <mask> <mask> delta.remove(0); <mask> } <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex); </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i); </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove public void enableTouchEvents() { </s> add void enableTouchEvents() { </s> remove public int hitTest(Point point) { </s> add int hitTest(Point point) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep add keep keep keep keep
<mask> mDXIndex = mDXIndices.get(mDXsIndex); <mask> } <mask> <mask> private static void incrementIndices(ArrayList<Integer> indices, int topIndex) { <mask> for (int index = topIndex; index >= 0; index--) { <mask> int xIndex = indices.get(index); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return value; </s> add private static void incrementIndices(ArrayList<Integer> indices, int topIndex) { for (int index = topIndex; index >= 0; index--) { int xIndex = indices.get(index); indices.set(index, xIndex + 1); } </s> remove for (; index >= 0; index--) { ReadableMap font = mFontContext.get(index); </s> add int nextIndex = mXIndex + 1; if (nextIndex < mXs.length) { mDX = 0; mXIndex = nextIndex; String string = mXs[nextIndex]; mX = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); } </s> remove int index = mContextLength - 1; </s> add double nextX(double advance) { incrementIndices(mXIndices, mXsIndex); </s> remove if (delta.size() != 0) { if (!valueSet) { value = delta.get(0); valueSet = true; } </s> add pushIndices(); } </s> remove if (fontFamily == null && font.hasKey("fontFamily")) { fontFamily = font.getString("fontFamily"); } </s> add mX += advance; </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep keep keep keep replace keep keep keep keep keep
<mask> delta.remove(0); <mask> } <mask> } <mask> <mask> return value; <mask> } <mask> <mask> public ReadableMap getGlyphFont() { <mask> String fontFamily = null; <mask> float fontSize = DEFAULT_FONT_SIZE; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (fontFamily == null && font.hasKey("fontFamily")) { fontFamily = font.getString("fontFamily"); } </s> add mX += advance; </s> remove for (; index >= 0; index--) { ReadableMap font = mFontContext.get(index); </s> add int nextIndex = mXIndex + 1; if (nextIndex < mXs.length) { mDX = 0; mXIndex = nextIndex; String string = mXs[nextIndex]; mX = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); } </s> remove if (!fontSizeSet && font.hasKey("fontSize")) { fontSize = (float)font.getDouble("fontSize"); fontSizeSet = true; } </s> add return mX; } </s> remove private void applyTextPropertiesToPaint(Paint paint) { ReadableMap font = getFontFromContext(); </s> add private double getAbsoluteStartOffset(String startOffset, double distance, double fontSize) { return PropHelper.fromRelative(startOffset, distance, 0, mScale, fontSize); } </s> remove delta.remove(0); } </s> add void popContext() { mFontContext.remove(mTop); mXsIndices.remove(mTop); mYsIndices.remove(mTop); mDXsIndices.remove(mTop); mDYsIndices.remove(mTop); mRsIndices.remove(mTop); mTop--; int x = mXsIndex; int y = mYsIndex; int dx = mDXsIndex; int dy = mDYsIndex; int r = mRsIndex; topFont = mFontContext.get(mTop); mXsIndex = mXsIndices.get(mTop); mYsIndex = mYsIndices.get(mTop); mDXsIndex = mDXsIndices.get(mTop); mDYsIndex = mDYsIndices.get(mTop); mRsIndex = mRsIndices.get(mTop); if (x != mXsIndex) { mXsContext.remove(x); mXs = mXsContext.get(mXsIndex); mXIndex = mXIndices.get(mXsIndex); } if (y != mYsIndex) { mYsContext.remove(y); mYs = mYsContext.get(mYsIndex); mYIndex = mYIndices.get(mYsIndex); } if (dx != mDXsIndex) { mDXsContext.remove(dx); mDXs = mDXsContext.get(mDXsIndex); mDXIndex = mDXIndices.get(mDXsIndex); </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep keep keep keep replace keep replace replace
<mask> boolean fontSizeSet = false; <mask> String fontWeight = null; <mask> String fontStyle = null; <mask> <mask> int index = mContextLength - 1; <mask> <mask> for (; index >= 0; index--) { <mask> ReadableMap font = mFontContext.get(index); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (fontFamily == null && font.hasKey("fontFamily")) { fontFamily = font.getString("fontFamily"); } </s> add mX += advance; </s> remove return value; </s> add private static void incrementIndices(ArrayList<Integer> indices, int topIndex) { for (int index = topIndex; index >= 0; index--) { int xIndex = indices.get(index); indices.set(index, xIndex + 1); } </s> remove if (delta.size() != 0) { if (!valueSet) { value = delta.get(0); valueSet = true; } </s> add pushIndices(); } </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } } </s> add if (dy != mDYsIndex) { mDYsContext.remove(dy); mDYs = mDYsContext.get(mDYsIndex); mDYIndex = mDYIndices.get(mDYsIndex); } if (r != mRsIndex) { mRsContext.remove(r); mRs = mRsContext.get(mRsIndex); mRIndex = mRIndices.get(mRsIndex); } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep replace replace replace keep replace replace replace replace keep
<mask> <mask> if (fontFamily == null && font.hasKey("fontFamily")) { <mask> fontFamily = font.getString("fontFamily"); <mask> } <mask> <mask> if (!fontSizeSet && font.hasKey("fontSize")) { <mask> fontSize = (float)font.getDouble("fontSize"); <mask> fontSizeSet = true; <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex); </s> remove for (; index >= 0; index--) { ReadableMap font = mFontContext.get(index); </s> add int nextIndex = mXIndex + 1; if (nextIndex < mXs.length) { mDX = 0; mXIndex = nextIndex; String string = mXs[nextIndex]; mX = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); } </s> remove if (fontFamily != null && fontSizeSet && fontWeight != null && fontStyle != null) { break; } </s> add int nextIndex = mYIndex + 1; if (nextIndex < mYs.length) { mDY = 0; mYIndex = nextIndex; String string = mYs[nextIndex]; mY = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); </s> remove int index = mContextLength - 1; </s> add double nextX(double advance) { incrementIndices(mXIndices, mXsIndex); </s> remove boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); </s> add boolean underlineText = false; boolean strikeThruText = false; TextDecoration decoration = font.textDecoration; if (decoration == TextDecoration.Underline) { underlineText = true; } else if (decoration == TextDecoration.LineThrough) { strikeThruText = true; }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep keep keep keep replace replace replace replace replace replace keep replace replace replace keep keep keep keep
<mask> fontSize = (float)font.getDouble("fontSize"); <mask> fontSizeSet = true; <mask> } <mask> <mask> if (fontWeight == null && font.hasKey("fontWeight")) { <mask> fontWeight = font.getString("fontWeight"); <mask> } <mask> if (fontStyle == null && font.hasKey("fontStyle")) { <mask> fontStyle = font.getString("fontStyle"); <mask> } <mask> <mask> if (fontFamily != null && fontSizeSet && fontWeight != null && fontStyle != null) { <mask> break; <mask> } <mask> } <mask> <mask> WritableMap map = Arguments.createMap(); <mask> map.putString("fontFamily", fontFamily); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (!fontSizeSet && font.hasKey("fontSize")) { fontSize = (float)font.getDouble("fontSize"); fontSizeSet = true; } </s> add return mX; } </s> remove if (fontFamily == null && font.hasKey("fontFamily")) { fontFamily = font.getString("fontFamily"); } </s> add mX += advance; </s> remove int index = mContextLength - 1; </s> add double nextX(double advance) { incrementIndices(mXIndices, mXsIndex); </s> remove boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); </s> add boolean underlineText = false; boolean strikeThruText = false; TextDecoration decoration = font.textDecoration; if (decoration == TextDecoration.Underline) { underlineText = true; } else if (decoration == TextDecoration.LineThrough) { strikeThruText = true; } </s> remove for (; index >= 0; index--) { ReadableMap font = mFontContext.get(index); </s> add int nextIndex = mXIndex + 1; if (nextIndex < mXs.length) { mDX = 0; mXIndex = nextIndex; String string = mXs[nextIndex]; mX = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep replace replace replace replace replace keep replace keep
<mask> <mask> WritableMap map = Arguments.createMap(); <mask> map.putString("fontFamily", fontFamily); <mask> map.putDouble("fontSize", fontSize); <mask> map.putString("fontWeight", fontWeight); <mask> map.putString("fontStyle", fontStyle); <mask> <mask> return map; <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (fontFamily != null && fontSizeSet && fontWeight != null && fontStyle != null) { break; } </s> add int nextIndex = mYIndex + 1; if (nextIndex < mYs.length) { mDY = 0; mYIndex = nextIndex; String string = mYs[nextIndex]; mY = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); </s> remove private ArrayList<Float> getFloatArrayListFromReadableArray(ReadableArray readableArray) { ArrayList<Float> arrayList = new ArrayList<>(); </s> add double nextDeltaY() { incrementIndices(mDYIndices, mDYsIndex); </s> remove private void applyTextPropertiesToPaint(Paint paint) { ReadableMap font = getFontFromContext(); </s> add private double getAbsoluteStartOffset(String startOffset, double distance, double fontSize) { return PropHelper.fromRelative(startOffset, distance, 0, mScale, fontSize); } </s> remove public PathParser(String d, float scale) { </s> add PathParser(String d, float scale) { </s> remove paint.setTypeface(Typeface.create(font.getString(PROP_FONT_FAMILY), fontStyle)); </s> add paint.setTypeface(typeface); paint.setTextSize((float) fontSize); paint.setTextAlign(Paint.Align.LEFT); // Do these have any effect for anyone? Not for me (@msand) at least. paint.setUnderlineText(underlineText); paint.setStrikeThruText(strikeThruText);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> return map; <mask> } <mask> <mask> private ArrayList<Float> getFloatArrayListFromReadableArray(ReadableArray readableArray) { <mask> ArrayList<Float> arrayList = new ArrayList<>(); <mask> <mask> if (readableArray != null) { <mask> for (int i = 0; i < readableArray.size(); i++) { <mask> arrayList.add((float)readableArray.getDouble(i)); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (readableArray != null) { for (int i = 0; i < readableArray.size(); i++) { arrayList.add((float)readableArray.getDouble(i)); } </s> add int nextIndex = mDYIndex + 1; if (nextIndex < mDYs.length) { mDYIndex = nextIndex; String string = mDYs[nextIndex]; double val = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); mDY += val; </s> remove return map; </s> add int nextIndex = mDXIndex + 1; if (nextIndex < mDXs.length) { mDXIndex = nextIndex; String string = mDXs[nextIndex]; double val = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); mDX += val; } return mDX; </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i); </s> add void traverseChildren(VirtualNode.NodeRunnable runner) { for (int i = 0; i < getChildCount(); i++) { ReactShadowNode child = getChildAt(i); if (!(child instanceof VirtualNode)) { continue; } runner.run((VirtualNode) child); } } </s> remove WritableMap map = Arguments.createMap(); map.putString("fontFamily", fontFamily); map.putDouble("fontSize", fontSize); map.putString("fontWeight", fontWeight); map.putString("fontStyle", fontStyle); </s> add return mY; } double nextDeltaX() { incrementIndices(mDXIndices, mDXsIndex); </s> remove protected void traverseChildren(NodeRunnable runner) { </s> add void traverseChildren(NodeRunnable runner) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep keep keep keep replace replace replace replace keep keep replace keep keep keep
<mask> <mask> private ArrayList<Float> getFloatArrayListFromReadableArray(ReadableArray readableArray) { <mask> ArrayList<Float> arrayList = new ArrayList<>(); <mask> <mask> if (readableArray != null) { <mask> for (int i = 0; i < readableArray.size(); i++) { <mask> arrayList.add((float)readableArray.getDouble(i)); <mask> } <mask> } <mask> <mask> return arrayList; <mask> } <mask> <mask> private PointF clonePointF(PointF point) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private ArrayList<Float> getFloatArrayListFromReadableArray(ReadableArray readableArray) { ArrayList<Float> arrayList = new ArrayList<>(); </s> add double nextDeltaY() { incrementIndices(mDYIndices, mDYsIndex); </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i); </s> remove return map; </s> add int nextIndex = mDXIndex + 1; if (nextIndex < mDXs.length) { mDXIndex = nextIndex; String string = mDXs[nextIndex]; double val = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); mDX += val; } return mDX; </s> remove private PointF clonePointF(PointF point) { return new PointF(point.x, point.y); </s> add float getHeight() { return mHeight; </s> add void traverseChildren(VirtualNode.NodeRunnable runner) { for (int i = 0; i < getChildCount(); i++) { ReactShadowNode child = getChildAt(i); if (!(child instanceof VirtualNode)) { continue; } runner.run((VirtualNode) child); } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
keep keep keep keep replace replace keep keep
<mask> <mask> return arrayList; <mask> } <mask> <mask> private PointF clonePointF(PointF point) { <mask> return new PointF(point.x, point.y); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return arrayList; </s> add return mDY; } double nextRotation() { incrementIndices(mRIndices, mRsIndex); mRIndex = Math.min(mRIndex + 1, mRs.length - 1); return mRs[mRIndex]; } float getWidth() { return mWidth; </s> remove public int hitTest(Point point) { </s> add int hitTest(Point point) { </s> remove protected GlyphContext getGlyphContext() { return mGlyphContext; } protected void pushGlyphContext() { getTextRoot().getGlyphContext().pushContext(mFont, mDeltaX, mDeltaY, mPositionX, mPositionY); } protected void popGlyphContext() { getTextRoot().getGlyphContext().popContext(); } protected ReadableMap getFontFromContext() { return getTextRoot().getGlyphContext().getGlyphFont(); } protected PointF getGlyphPointFromContext(float offset, float glyphWidth) { return getTextRoot().getGlyphContext().getNextGlyphPoint(offset, glyphWidth); } private Matrix getAlignMatrix(Path path) { RectF box = new RectF(); path.computeBounds(box, true); float width = box.width(); float x = 0; switch (getComputedTextAnchor()) { case TEXT_ANCHOR_MIDDLE: x = -width / 2; break; case TEXT_ANCHOR_END: x = -width; break; } Matrix matrix = new Matrix(); matrix.setTranslate(x, 0); return matrix; </s> add @Override void pushGlyphContext() { boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode); getTextRootGlyphContext().pushContext(isTextNode, this, mFont, mPositionX, mPositionY, mDeltaX, mDeltaY, mRotate); </s> remove if (readableArray != null) { for (int i = 0; i < readableArray.size(); i++) { arrayList.add((float)readableArray.getDouble(i)); } </s> add int nextIndex = mDYIndex + 1; if (nextIndex < mDYs.length) { mDYIndex = nextIndex; String string = mDYs[nextIndex]; double val = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); mDY += val; </s> remove return mTextRoot; </s> add return mBaselineShift; </s> remove private boolean textPathHasReachedEnd() { return mBezierTransformer.hasReachedEnd(); } private boolean textPathHasReachedStart() { return mBezierTransformer.hasReachedStart(); } </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GlyphContext.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove /** </s> add /* </s> remove /** </s> add /* </s> remove /** </s> add /* </s> remove /** </s> add /* </s> remove /** </s> add /* </s> remove /** </s> add /*
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep add keep keep keep keep keep
<mask> import android.graphics.Path; <mask> import android.graphics.Point; <mask> <mask> import com.facebook.react.bridge.ReadableMap; <mask> import com.facebook.react.uimanager.ReactShadowNode; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import com.facebook.react.bridge.ReadableMap; </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add </s> remove </s> add import com.facebook.react.uimanager.annotations.ReactProp; </s> remove import com.facebook.react.bridge.ReactMethod; </s> add </s> remove import android.graphics.Matrix; </s> add </s> remove import android.graphics.PointF; </s> add import android.graphics.PathMeasure; import android.graphics.Rect;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep add keep keep keep keep keep
<mask> import android.graphics.Path; <mask> import android.graphics.Point; <mask> import android.graphics.RectF; <mask> <mask> import com.facebook.react.uimanager.ReactShadowNode; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> import javax.annotation.Nullable; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import android.graphics.RectF; </s> remove </s> add import com.facebook.react.uimanager.annotations.ReactProp; </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add </s> remove import com.facebook.react.bridge.ReactMethod; </s> add </s> remove import android.graphics.Matrix; </s> add </s> remove import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> import android.graphics.Path; <mask> import android.graphics.Point; <mask> <mask> import com.facebook.react.uimanager.ReactShadowNode; <mask> <mask> <mask> import javax.annotation.Nullable; <mask> <mask> /** <mask> * Shadow node for virtual Group view </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import javax.annotation.Nullable; </s> remove import com.facebook.react.bridge.ReadableArray; </s> add </s> add import com.facebook.react.bridge.ReadableMap; </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import com.facebook.react.bridge.ReadableArray;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual Group view <mask> */ <mask> public class GroupShadowNode extends RenderableShadowNode { <mask> <mask> public void draw(final Canvas canvas, final Paint paint, final float opacity) { <mask> if (opacity > MIN_OPACITY_FOR_DRAW) { <mask> clip(canvas, paint); <mask> drawGroup(canvas, paint, opacity); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add setupGlyphContext(canvas); </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class PathShadowNode extends RenderableShadowNode { </s> add class PathShadowNode extends RenderableShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep add keep keep keep keep keep
<mask> } <mask> <mask> public void draw(final Canvas canvas, final Paint paint, final float opacity) { <mask> if (opacity > MIN_OPACITY_FOR_DRAW) { <mask> clip(canvas, paint); <mask> drawGroup(canvas, paint, opacity); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove public class GroupShadowNode extends RenderableShadowNode { </s> add class GroupShadowNode extends RenderableShadowNode { @Nullable ReadableMap mFont; private GlyphContext mGlyphContext; @ReactProp(name = "font") public void setFont(@Nullable ReadableMap font) { mFont = font; markUpdated(); } void setupGlyphContext(Canvas canvas) { RectF clipBounds = new RectF(canvas.getClipBounds()); mMatrix.mapRect(clipBounds); mGlyphContext = new GlyphContext(mScale, clipBounds.width(), clipBounds.height()); } GlyphContext getGlyphContext() { return mGlyphContext; } @SuppressWarnings("ConstantConditions") GlyphContext getTextRootGlyphContext() { return getTextRoot().getGlyphContext(); } void pushGlyphContext() { getTextRootGlyphContext().pushContext(this, mFont); } void popGlyphContext() { getTextRootGlyphContext().popContext(); } </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add private void bitmapTryRender(Bitmap bitmap, Canvas canvas, Paint paint, float opacity) { try { if (bitmap != null) { doRender(canvas, paint, bitmap, opacity); } } catch (Exception e) { throw new IllegalStateException(e); } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep keep replace keep keep keep replace keep keep keep
<mask> drawGroup(canvas, paint, opacity); <mask> } <mask> } <mask> <mask> protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { <mask> final SvgViewShadowNode svg = getSvgShadowNode(); <mask> final GroupShadowNode self = this; <mask> traverseChildren(new NodeRunnable() { <mask> public boolean run(VirtualNode node) { <mask> if (node instanceof RenderableShadowNode) { <mask> ((RenderableShadowNode)node).mergeProperties(self); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> add setupGlyphContext(canvas); </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove public BezierTransformer getBezierTransformer() { </s> add public Path getPath() {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> if (node.isResponsible()) { <mask> svg.enableTouchEvents(); <mask> } <mask> return true; <mask> } <mask> }); <mask> } <mask> <mask> protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add popGlyphContext(); </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove return true; </s> add </s> add setupGlyphContext(canvas); </s> add private void bitmapTryRender(Bitmap bitmap, Canvas canvas, Paint paint, float opacity) { try { if (bitmap != null) { doRender(canvas, paint, bitmap, opacity); } } catch (Exception e) { throw new IllegalStateException(e); } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep add keep keep keep keep keep keep
<mask> svg.enableTouchEvents(); <mask> } <mask> } <mask> }); <mask> } <mask> <mask> void drawPath(Canvas canvas, Paint paint, float opacity) { <mask> super.draw(canvas, paint, opacity); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove return true; </s> add </s> add setupGlyphContext(canvas); </s> add private void bitmapTryRender(Bitmap bitmap, Canvas canvas, Paint paint, float opacity) { try { if (bitmap != null) { doRender(canvas, paint, bitmap, opacity); } } catch (Exception e) { throw new IllegalStateException(e); } } </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> }); <mask> } <mask> <mask> protected void drawPath(Canvas canvas, Paint paint, float opacity) { <mask> super.draw(canvas, paint, opacity); <mask> } <mask> <mask> @Override <mask> protected Path getPath(final Canvas canvas, final Paint paint) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add popGlyphContext(); </s> remove return true; </s> add </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> add setupGlyphContext(canvas);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep replace keep keep keep keep keep keep keep keep replace keep
<mask> traverseChildren(new NodeRunnable() { <mask> public boolean run(VirtualNode node) { <mask> path.addPath(node.getPath(canvas, paint)); <mask> return true; <mask> } <mask> }); <mask> <mask> traverseChildren(new NodeRunnable() { <mask> public boolean run(VirtualNode node) { <mask> path.addPath(node.getPath(canvas, paint)); <mask> return true; <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove return true; </s> add </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove return true; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return -1; <mask> } <mask> <mask> protected void saveDefinition() { <mask> if (mName != null) { <mask> getSvgShadowNode().defineTemplate(this, mName); <mask> } <mask> <mask> traverseChildren(new NodeRunnable() { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected void saveDefinition() { </s> add void saveDefinition() { </s> remove protected float getCanvasTop() { return getSvgShadowNode().getCanvasBounds().top; </s> add private float getCanvasHeight() { if (canvasHeight != -1) { return canvasHeight; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasHeight = getSvgShadowNode().getCanvasBounds().height(); } else { canvasHeight = root.getGlyphContext().getHeight(); } return canvasHeight; </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove protected interface NodeRunnable { boolean run(VirtualNode node); </s> add interface NodeRunnable { void run(VirtualNode node); </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove private void setupGlyphContext() { mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); } protected void releaseCachedPath() { </s> add void releaseCachedPath() {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep replace keep replace keep keep keep
<mask> } <mask> <mask> traverseChildren(new NodeRunnable() { <mask> public boolean run(VirtualNode node) { <mask> node.saveDefinition(); <mask> return true; <mask> } <mask> }); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return true; </s> add </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove return true; </s> add </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
keep keep keep replace keep keep keep replace keep keep keep
<mask> @Override <mask> public void resetProperties() { <mask> traverseChildren(new NodeRunnable() { <mask> public boolean run(VirtualNode node) { <mask> if (node instanceof RenderableShadowNode) { <mask> ((RenderableShadowNode)node).resetProperties(); <mask> } <mask> return true; <mask> } <mask> }); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return true; </s> add </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove return true; </s> add </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/GroupShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> import android.graphics.Canvas; <mask> import android.graphics.Matrix; <mask> import android.graphics.Paint; <mask> import android.graphics.Path; <mask> import android.graphics.Rect; <mask> import android.graphics.RectF; <mask> import android.graphics.Region; <mask> import android.net.Uri; <mask> <mask> import com.facebook.common.executors.UiThreadImmediateExecutorService; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove import android.graphics.PointF; </s> add import android.graphics.PathMeasure; import android.graphics.Rect; </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add </s> remove import android.graphics.Matrix; </s> add </s> remove import javax.annotation.Nullable; </s> add </s> remove import android.annotation.TargetApi; </s> add import android.content.res.AssetManager; </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep add keep keep keep keep keep
<mask> import com.facebook.react.common.ReactConstants; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> import java.util.concurrent.atomic.AtomicBoolean; <mask> <mask> import javax.annotation.Nonnull; <mask> import javax.annotation.Nullable; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import com.facebook.react.common.ReactConstants; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import javax.annotation.Nullable; </s> add import android.graphics.Matrix; import com.facebook.common.logging.FLog; </s> add import com.facebook.react.bridge.ReadableMap; </s> remove </s> add import com.facebook.react.uimanager.annotations.ReactProp;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep add keep keep keep keep
<mask> import javax.annotation.Nullable; <mask> <mask> /** <mask> * Shadow node for virtual Image view <mask> */ <mask> class ImageShadowNode extends RenderableShadowNode { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_Y; import static android.graphics.PathMeasure.POSITION_MATRIX_FLAG; import static android.graphics.PathMeasure.TANGENT_MATRIX_FLAG; </s> remove public class PathShadowNode extends RenderableShadowNode { </s> add class PathShadowNode extends RenderableShadowNode { </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual Image view <mask> */ <mask> public class ImageShadowNode extends RenderableShadowNode { <mask> <mask> private String mX; <mask> private String mY; <mask> private String mW; <mask> private String mH; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode { </s> add import com.facebook.react.bridge.ReadableArray; </s> remove public class LinearGradientShadowNode extends DefinitionShadowNode { </s> add class LinearGradientShadowNode extends DefinitionShadowNode { </s> remove public class RadialGradientShadowNode extends DefinitionShadowNode { </s> add class RadialGradientShadowNode extends DefinitionShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep replace keep keep replace keep keep keep keep
<mask> private Uri mUri; <mask> private float mImageRatio; <mask> private String mAlign; <mask> private int mMeetOrSlice; <mask> private AtomicBoolean mLoading = new AtomicBoolean(false); <mask> <mask> @ReactProp(name = "x") <mask> public void setX(String x) { <mask> mX = x; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> add private TextPathMethod mMethod = TextPathMethod.align; private TextPathSpacing mSpacing = TextPathSpacing.exact; </s> remove private static final String PROP_FONT_FAMILY = "fontFamily"; private static final String PROP_FONT_SIZE = "fontSize"; private static final String PROP_FONT_STYLE = "fontStyle"; private static final String PROP_FONT_WEIGHT = "fontWeight"; </s> add private Path mCache; @Nullable String mContent; private TextPathShadowNode textPath;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep replace keep replace keep keep keep keep
<mask> } <mask> <mask> if (src.hasKey("width") && src.hasKey("height")) { <mask> mImageRatio = (float)src.getInt("width") / (float)src.getInt("height"); <mask> } else { <mask> mImageRatio = 0f; <mask> } <mask> mUri = Uri.parse(uriString); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add if (mUri.getScheme() == null) { mUri = ResourceDrawableIdHelper.getInstance().getResourceDrawableUri(getThemedContext(), uriString); } </s> remove boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); </s> add boolean underlineText = false; boolean strikeThruText = false; TextDecoration decoration = font.textDecoration; if (decoration == TextDecoration.Underline) { underlineText = true; } else if (decoration == TextDecoration.LineThrough) { strikeThruText = true; } </s> remove if (!fontSizeSet && font.hasKey("fontSize")) { fontSize = (float)font.getDouble("fontSize"); fontSizeSet = true; } </s> add return mX; } </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep add keep keep keep keep keep
<mask> } <mask> mUri = Uri.parse(uriString); <mask> } <mask> } <mask> <mask> <mask> @ReactProp(name = "align") </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove mImageRatio = 0f; </s> add mImageWidth = 0; mImageHeight = 0; </s> remove mImageRatio = (float)src.getInt("width") / (float)src.getInt("height"); </s> add mImageWidth = src.getInt("width"); mImageHeight = src.getInt("height"); </s> remove @ReactProp(name = "responsible", defaultBoolean = false) </s> add @ReactProp(name = "responsible") </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> final ImageRequest request = ImageRequestBuilder.newBuilderWithSource(mUri).build(); <mask> if (Fresco.getImagePipeline().isInBitmapMemoryCache(request)) { <mask> tryRender(request, canvas, paint, opacity * mOpacity); <mask> } else { <mask> loadBitmap(request); <mask> } <mask> } <mask> } <mask> <mask> @Override </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove SvgViewShadowNode shadowNode = getSvgShadowNode(); shadowNode.markUpdated(); </s> add bitmapTryRender(bitmap, canvas, paint, opacity * mOpacity); </s> remove symbol.drawSymbol(canvas, paint, opacity, relativeOnWidth(mWidth), relativeOnHeight(mHeight)); </s> add symbol.drawSymbol(canvas, paint, opacity, (float) relativeOnWidth(mWidth), (float) relativeOnHeight(mHeight)); </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add </s> add setupGlyphContext(canvas);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep replace keep keep keep replace keep keep keep keep
<mask> protected Path getPath(Canvas canvas, Paint paint) { <mask> Path path = new Path(); <mask> path.addRect(new RectF(getRect()), Path.Direction.CW); <mask> return path; <mask> } <mask> <mask> private void loadBitmap(ImageRequest request) { <mask> final DataSource<CloseableReference<CloseableImage>> dataSource <mask> = Fresco.getImagePipeline().fetchDecodedImage(request, getThemedContext()); <mask> <mask> dataSource.subscribe(new BaseBitmapDataSubscriber() { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove float x1 = relativeOnWidth(mX1); float y1 = relativeOnHeight(mY1); float x2 = relativeOnWidth(mX2); float y2 = relativeOnHeight(mY2); </s> add double x1 = relativeOnWidth(mX1); double y1 = relativeOnHeight(mY1); double x2 = relativeOnWidth(mX2); double y2 = relativeOnHeight(mY2); </s> remove return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); </s> add return path.getPath(); </s> remove canvas.drawBitmap(bitmap, null, renderRect, alphaPaint); </s> add canvas.drawBitmap(bitmap, null, vbRect, alphaPaint); </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep keep replace replace keep keep keep keep keep
<mask> dataSource.subscribe(new BaseBitmapDataSubscriber() { <mask> @Override <mask> public void onNewResultImpl(Bitmap bitmap) { <mask> mLoading.set(false); <mask> SvgViewShadowNode shadowNode = getSvgShadowNode(); <mask> shadowNode.markUpdated(); <mask> } <mask> <mask> @Override <mask> public void onFailureImpl(DataSource dataSource) { <mask> // No cleanup required here. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private void loadBitmap(ImageRequest request) { </s> add private void loadBitmap(ImageRequest request, final Canvas canvas, final Paint paint, final float opacity) { </s> remove public VirtualNode() { </s> add VirtualNode() { </s> remove public BezierTransformer getBezierTransformer() { </s> add public Path getPath() { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep replace replace replace replace replace keep replace keep keep keep keep
<mask> } <mask> <mask> @Nonnull <mask> private Rect getRect() { <mask> float x = relativeOnWidth(mX); <mask> float y = relativeOnHeight(mY); <mask> float w = relativeOnWidth(mW); <mask> float h = relativeOnHeight(mH); <mask> <mask> return new Rect((int) x, (int) y, (int) (x + w), (int) (y + h)); <mask> } <mask> <mask> private void doRender(Canvas canvas, Paint paint, Bitmap bitmap, float opacity) { <mask> // apply viewBox transform on Image render. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); float rx = relativeOnWidth(mRx); float ry = relativeOnHeight(mRy); </s> add double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); double rx = relativeOnWidth(mRx); double ry = relativeOnHeight(mRy); </s> remove path.addRect(x, y, x + w, y + h, Path.Direction.CW); </s> add path.addRect((float) x, (float) y, (float) (x + w), (float) (y + h), Path.Direction.CW); </s> remove path.addRoundRect(new RectF(x, y, x + w, y + h), rx, ry, Path.Direction.CW); </s> add path.addRoundRect(new RectF((float) x, (float) y, (float) (x + w), (float) (y + h)), (float) rx, (float) ry, Path.Direction.CW); </s> remove public String toDataURL() { </s> add String toDataURL() {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep replace replace replace keep keep keep keep
<mask> } <mask> <mask> private void doRender(Canvas canvas, Paint paint, Bitmap bitmap, float opacity) { <mask> // apply viewBox transform on Image render. <mask> Rect rect = getRect(); <mask> float rectWidth = (float)rect.width(); <mask> float rectHeight = (float)rect.height(); <mask> float rectX = (float)rect.left; <mask> float rectY = (float)rect.top; <mask> float rectRatio = rectWidth / rectHeight; <mask> RectF renderRect; <mask> <mask> if (mImageRatio == 0f || mImageRatio == rectRatio) { <mask> renderRect = new RectF(rect); <mask> } else if (mImageRatio < rectRatio) { <mask> renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); <mask> } else { <mask> renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); <mask> } <mask> <mask> RectF vbRect = new RectF(0, 0, renderRect.width() / mScale, renderRect.height() / mScale); <mask> RectF eRect = new RectF(getCanvasLeft(), getCanvasTop(), rectWidth / mScale + getCanvasLeft(), rectHeight / mScale + getCanvasTop()); <mask> Matrix transform = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); <mask> <mask> transform.mapRect(renderRect); <mask> Matrix translation = new Matrix(); <mask> translation.postTranslate(rectX, rectY); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); } </s> remove Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); </s> add Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice); </s> remove public void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { </s> add void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { </s> remove return new Rect((int) x, (int) y, (int) (x + w), (int) (y + h)); </s> add return new RectF((float)x, (float)y, (float)(x + w), (float)(y + h)); </s> remove private Rect getRect() { float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); </s> add private RectF getRect() { double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); if (w == 0) { w = mImageWidth * mScale; } if (h == 0) { h = mImageHeight * mScale; }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> RectF vbRect = new RectF(0, 0, renderRect.width() / mScale, renderRect.height() / mScale); <mask> RectF eRect = new RectF(getCanvasLeft(), getCanvasTop(), rectWidth / mScale + getCanvasLeft(), rectHeight / mScale + getCanvasTop()); <mask> Matrix transform = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); <mask> <mask> transform.mapRect(renderRect); <mask> Matrix translation = new Matrix(); <mask> translation.postTranslate(rectX, rectY); <mask> translation.mapRect(renderRect); <mask> <mask> Path clip = new Path(); <mask> <mask> Path clipPath = getClipPath(canvas, paint); <mask> Path path = getPath(canvas, paint); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove RectF vbRect = new RectF(0, 0, renderRect.width() / mScale, renderRect.height() / mScale); RectF eRect = new RectF(getCanvasLeft(), getCanvasTop(), rectWidth / mScale + getCanvasLeft(), rectHeight / mScale + getCanvasTop()); Matrix transform = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); </s> add RectF renderRect = getRect(); RectF vbRect = new RectF(0, 0, mImageWidth, mImageHeight); Matrix transform = ViewBox.getTransform(vbRect, renderRect, mAlign, mMeetOrSlice); transform.mapRect(vbRect); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); </s> add Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice); </s> remove public void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { </s> add void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { </s> remove applyTextPropertiesToPaint(paint); getLinePath(mContent + " ", paint, path); mCache = path; </s> add mCache = getLinePath(mContent, paint, canvas); </s> remove Path path = new Path(); </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> Paint alphaPaint = new Paint(); <mask> alphaPaint.setAlpha((int) (opacity * 255)); <mask> canvas.drawBitmap(bitmap, null, renderRect, alphaPaint); <mask> } <mask> <mask> private void tryRender(ImageRequest request, Canvas canvas, Paint paint, float opacity) { <mask> final DataSource<CloseableReference<CloseableImage>> dataSource <mask> = Fresco.getImagePipeline().fetchImageFromBitmapCache(request, getThemedContext()); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private void loadBitmap(ImageRequest request) { </s> add private void loadBitmap(ImageRequest request, final Canvas canvas, final Paint paint, final float opacity) { </s> add setupGlyphContext(canvas); </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove path.addRect(new RectF(getRect()), Path.Direction.CW); </s> add path.addRect(getRect(), Path.Direction.CW); </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
keep keep keep add keep
<mask> } finally { <mask> dataSource.close(); <mask> } <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (!runner.run((VirtualNode) child)) { break; } </s> add runner.run((VirtualNode) child); </s> remove private boolean textPathHasReachedEnd() { return mBezierTransformer.hasReachedEnd(); } private boolean textPathHasReachedStart() { return mBezierTransformer.hasReachedStart(); } </s> add </s> remove return true; </s> add </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove return arrayList; </s> add return mDY; } double nextRotation() { incrementIndices(mRIndices, mRsIndex); mRIndex = Math.min(mRIndex + 1, mRs.length - 1); return mRs[mRIndex]; } float getWidth() { return mWidth; </s> remove protected float getCanvasHeight() { return getSvgShadowNode().getCanvasBounds().height(); } </s> add private float getCanvasWidth() { if (canvasWidth != -1) { return canvasWidth; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasWidth = getSvgShadowNode().getCanvasBounds().width(); } else { canvasWidth = root.getGlyphContext().getWidth(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ImageShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LineShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual Line view <mask> */ <mask> public class LineShadowNode extends RenderableShadowNode { <mask> <mask> private String mX1; <mask> private String mY1; <mask> private String mX2; <mask> private String mY2; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class LinearGradientShadowNode extends DefinitionShadowNode { </s> add class LinearGradientShadowNode extends DefinitionShadowNode { </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> remove public class RadialGradientShadowNode extends DefinitionShadowNode { </s> add class RadialGradientShadowNode extends DefinitionShadowNode { </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LineShadowNode.java
keep replace replace replace replace keep replace replace keep
<mask> Path path = new Path(); <mask> float x1 = relativeOnWidth(mX1); <mask> float y1 = relativeOnHeight(mY1); <mask> float x2 = relativeOnWidth(mX2); <mask> float y2 = relativeOnHeight(mY2); <mask> <mask> path.moveTo(x1, y1); <mask> path.lineTo(x2, y2); <mask> return path; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } } </s> remove float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); float rx = relativeOnWidth(mRx); float ry = relativeOnHeight(mRy); </s> add double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); double rx = relativeOnWidth(mRx); double ry = relativeOnHeight(mRy); </s> remove applyTextPropertiesToPaint(paint); getLinePath(mContent + " ", paint, path); mCache = path; </s> add mCache = getLinePath(mContent, paint, canvas); </s> remove path.addRect(new RectF(getRect()), Path.Direction.CW); </s> add path.addRect(getRect(), Path.Direction.CW); </s> remove Path path = new Path(); </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LineShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
keep keep keep add keep keep keep keep
<mask> <mask> <mask> package versioned.host.exp.exponent.modules.api.components.svg; <mask> <mask> import com.facebook.react.bridge.Arguments; <mask> import com.facebook.react.bridge.ReadableArray; <mask> import com.facebook.react.bridge.WritableArray; <mask> import com.facebook.react.common.ReactConstants; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import android.graphics.Matrix; import com.facebook.common.logging.FLog; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import com.facebook.react.common.ReactConstants; </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add </s> remove import android.graphics.Color; </s> add </s> remove import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
keep add keep keep keep keep keep
<mask> import com.facebook.react.bridge.ReadableArray; <mask> import com.facebook.react.bridge.WritableArray; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> import javax.annotation.Nullable; <mask> <mask> /** </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import android.graphics.Matrix; import com.facebook.common.logging.FLog; </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add </s> add import javax.annotation.Nullable; </s> add import android.graphics.Matrix; import com.facebook.common.logging.FLog; </s> remove import com.facebook.react.bridge.ReadableArray; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
keep keep keep add keep keep keep keep
<mask> import com.facebook.react.bridge.WritableArray; <mask> import com.facebook.react.common.ReactConstants; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> /** <mask> * Shadow node for virtual LinearGradient definition view <mask> */ <mask> class LinearGradientShadowNode extends DefinitionShadowNode { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> remove public class LinearGradientShadowNode extends DefinitionShadowNode { </s> add class LinearGradientShadowNode extends DefinitionShadowNode { </s> add import com.facebook.react.bridge.ReadableArray; </s> add import javax.annotation.Nullable; </s> remove import com.facebook.react.bridge.ReadableArray; </s> add </s> add import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_Y; import static android.graphics.PathMeasure.POSITION_MATRIX_FLAG; import static android.graphics.PathMeasure.TANGENT_MATRIX_FLAG;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual LinearGradient definition view <mask> */ <mask> public class LinearGradientShadowNode extends DefinitionShadowNode { <mask> <mask> private String mX1; <mask> private String mY1; <mask> private String mX2; <mask> private String mY2; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode { </s> remove public class RadialGradientShadowNode extends DefinitionShadowNode { </s> add class RadialGradientShadowNode extends DefinitionShadowNode { </s> add import javax.annotation.Nullable; </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
keep add keep keep keep keep keep keep
<mask> private Brush.BrushUnits mGradientUnits; <mask> <mask> @ReactProp(name = "x1") <mask> public void setX1(String x1) { <mask> mX1 = x1; <mask> markUpdated(); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null; </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) { </s> remove @ReactProp(name = "responsible", defaultBoolean = false) </s> add @ReactProp(name = "responsible") </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
keep keep keep add keep keep keep keep keep keep
<mask> points.pushString(mY2); <mask> <mask> Brush brush = new Brush(Brush.BrushType.LINEAR_GRADIENT, points, mGradientUnits); <mask> brush.setGradientColors(mGradient); <mask> <mask> SvgViewShadowNode svg = getSvgShadowNode(); <mask> if (mGradientUnits == Brush.BrushUnits.USER_SPACE_ON_USE) { <mask> brush.setUserSpaceBoundingBox(svg.getCanvasBounds()); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add if (mMatrix != null) { brush.setGradientTransform(mMatrix); } </s> remove public BezierTransformer getBezierTransformer() { </s> add public Path getPath() { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove SvgViewShadowNode shadowNode = getSvgShadowNode(); shadowNode.markUpdated(); </s> add bitmapTryRender(bitmap, canvas, paint, opacity * mOpacity); </s> remove String text = mContent; if (text == null) { </s> add if (mContent == null) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/LinearGradientShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PathShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> import android.graphics.Canvas; <mask> import android.graphics.Paint; <mask> import android.graphics.Path; <mask> <mask> import com.facebook.react.bridge.ReadableArray; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> /** <mask> * Shadow node for virtual Path view <mask> */ </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove </s> add import com.facebook.react.uimanager.annotations.ReactProp; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import javax.annotation.Nullable; </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.bridge.ReadableArray; </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PathShadowNode.java
keep keep replace keep keep replace keep
<mask> * Shadow node for virtual Path view <mask> */ <mask> public class PathShadowNode extends RenderableShadowNode { <mask> <mask> private Path mPath; <mask> private PropHelper.PathParser mD; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode { </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> add import com.facebook.react.bridge.ReadableArray;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PathShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> private PropHelper.PathParser mD; <mask> <mask> @ReactProp(name = "d") <mask> public void setD(String d) { <mask> mD = new PropHelper.PathParser(d, mScale); <mask> mPath = mD.getPath(); <mask> markUpdated(); <mask> } <mask> <mask> @Override </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private PropHelper.PathParser mD; </s> add </s> remove public class PathShadowNode extends RenderableShadowNode { </s> add class PathShadowNode extends RenderableShadowNode { </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) { </s> remove @ReactProp(name = "responsible", defaultBoolean = false) </s> add @ReactProp(name = "responsible") </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PathShadowNode.java
keep keep keep keep replace replace keep keep
<mask> protected Path getPath(Canvas canvas, Paint paint) { <mask> return mPath; <mask> } <mask> <mask> public ReadableArray getBezierCurves() { <mask> return mD.getBezierCurves(); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); </s> add return path.getPath(); </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove protected Path getGroupPath(Canvas canvas, Paint paint) { </s> add Path getGroupPath(Canvas canvas, Paint paint) { </s> remove path.addRect(new RectF(getRect()), Path.Direction.CW); </s> add path.addRect(getRect(), Path.Direction.CW); </s> remove protected void clip(Canvas canvas, Paint paint) { </s> add void clip(Canvas canvas, Paint paint) { </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PathShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep replace keep keep replace replace replace replace replace replace replace
<mask> package versioned.host.exp.exponent.modules.api.components.svg; <mask> <mask> import android.graphics.Color; <mask> import android.graphics.Path; <mask> import android.graphics.RectF; <mask> import android.graphics.Paint; <mask> import android.graphics.RadialGradient; <mask> import android.graphics.LinearGradient; <mask> import android.graphics.Shader; <mask> import android.graphics.Matrix; <mask> <mask> import javax.annotation.Nullable; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove import javax.annotation.Nullable; </s> add </s> remove import android.annotation.TargetApi; </s> add import android.content.res.AssetManager; </s> remove import android.graphics.Rect; </s> add </s> remove import android.graphics.Matrix; </s> add </s> remove import android.graphics.PointF; </s> add import android.graphics.PathMeasure; import android.graphics.Rect;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep replace replace replace replace keep keep keep
<mask> class PropHelper { <mask> <mask> /** <mask> * Converts {@link ReadableArray} to an array of {@code float}. Returns newly created array. <mask> * <mask> * @return a {@code float[]} if converted successfully, or {@code null} if {@param value} was <mask> * {@code null}. <mask> */ <mask> <mask> static <mask> @Nullable <mask> float[] toFloatArray(@Nullable ReadableArray value) { <mask> if (value != null) { <mask> float[] result = new float[value.size()]; <mask> toFloatArray(value, result); <mask> return result; <mask> } <mask> return null; <mask> } <mask> <mask> /** <mask> * Converts given {@link ReadableArray} to an array of {@code float}. Writes result to the array <mask> * passed in {@param into}. This method will write to the output array up to the number of items <mask> * from the input array. If the input array is longer than output the remaining part of the input <mask> * will not be converted. <mask> * <mask> * @param value input array <mask> * @param into output array </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove * @param into output array * @return number of items copied from input to the output array </s> add * @param sRawMatrix output matrix * @param mScale current resolution scaling * @return size of input array </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> remove // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> add // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> remove * Converts percentage string into actual based on a relative number </s> add * Converts length string into px / user units * in the current user coordinate system </s> remove protected void restoreCanvas(Canvas canvas, int count) { </s> add void restoreCanvas(Canvas canvas, int count) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep replace replace keep replace replace replace replace replace keep
<mask> * will not be converted. <mask> * <mask> * @param value input array <mask> * @param into output array <mask> * @return number of items copied from input to the output array <mask> */ <mask> <mask> static int toFloatArray(ReadableArray value, float[] into) { <mask> int length = value.size() > into.length ? into.length : value.size(); <mask> for (int i = 0; i < length; i++) { <mask> into[i] = (float) value.getDouble(i); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return value.size(); </s> add </s> remove * Converts given {@link ReadableArray} to an array of {@code float}. Writes result to the array * passed in {@param into}. This method will write to the output array up to the number of items * from the input array. If the input array is longer than output the remaining part of the input * will not be converted. </s> add * Converts given {@link ReadableArray} to a matrix data array, {@code float[6]}. * Writes result to the array passed in {@param into}. * This method will write exactly six items to the output array from the input array. * * If the input array has a different size, then only the size is returned; * Does not check output array size. Ensure space for at least six elements. </s> remove /** * Converts {@link ReadableArray} to an array of {@code float}. Returns newly created array. * * @return a {@code float[]} if converted successfully, or {@code null} if {@param value} was * {@code null}. */ static @Nullable float[] toFloatArray(@Nullable ReadableArray value) { if (value != null) { float[] result = new float[value.size()]; toFloatArray(value, result); return result; } return null; } </s> add private static final int inputMatrixDataSize = 6; </s> remove * @param percentage percentage string * @param relative relative number * @param offset offset number * @return actual float based on relative number </s> add * @param length length string * @param relative relative size for percentages * @param offset offset for all units * @param scale scaling parameter * @param fontSize current font size * @return value in the current user coordinate system </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep keep replace keep keep keep keep keep
<mask> int length = value.size() > into.length ? into.length : value.size(); <mask> for (int i = 0; i < length; i++) { <mask> into[i] = (float) value.getDouble(i); <mask> } <mask> return value.size(); <mask> <mask> } <mask> <mask> static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> remove * @param into output array * @return number of items copied from input to the output array </s> add * @param sRawMatrix output matrix * @param mScale current resolution scaling * @return size of input array </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i); </s> remove static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); </s> add static private final Pattern percentageRegExp = Pattern.compile("^(-?\\d+(?:\\.\\d+)?)%$"); </s> remove private ArrayList<Float> getFloatArrayListFromReadableArray(ReadableArray readableArray) { ArrayList<Float> arrayList = new ArrayList<>(); </s> add double nextDeltaY() { incrementIndices(mDYIndices, mDYsIndex); </s> add void traverseChildren(VirtualNode.NodeRunnable runner) { for (int i = 0; i < getChildCount(); i++) { ReactShadowNode child = getChildAt(i); if (!(child instanceof VirtualNode)) { continue; } runner.run((VirtualNode) child); } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep add keep keep keep keep keep
<mask> if (fromSize != inputMatrixDataSize) { <mask> return fromSize; <mask> } <mask> <mask> } <mask> <mask> static private final Pattern percentageRegExp = Pattern.compile("^(-?\\d+(?:\\.\\d+)?)%$"); <mask> <mask> /** </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); </s> add static private final Pattern percentageRegExp = Pattern.compile("^(-?\\d+(?:\\.\\d+)?)%$"); </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> remove static private Pattern PATH_REG_EXP = Pattern.compile("[a-df-z]|[\\-+]?(?:[\\d.]e[\\-+]?|[^\\s\\-+,a-z])+", Pattern.CASE_INSENSITIVE); static private Pattern DECIMAL_REG_EXP = Pattern.compile("(\\.\\d+)(?=\\-?\\.)"); </s> add static private final Pattern PATH_REG_EXP = Pattern.compile("[a-df-z]|[\\-+]?(?:[\\d.]e[\\-+]?|[^\\s\\-+,a-z])+", Pattern.CASE_INSENSITIVE); static private final Pattern DECIMAL_REG_EXP = Pattern.compile("(\\.\\d+)(?=-?\\.)"); </s> remove return value.size(); </s> add </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i); </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep keep replace keep keep keep keep keep
<mask> return value.size(); <mask> <mask> } <mask> <mask> static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); <mask> <mask> /** <mask> * Converts percentage string into actual based on a relative number <mask> * <mask> * @param percentage percentage string </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove * Converts percentage string into actual based on a relative number </s> add * Converts length string into px / user units * in the current user coordinate system </s> remove * @param percentage percentage string * @param relative relative number * @param offset offset number * @return actual float based on relative number </s> add * @param length length string * @param relative relative size for percentages * @param offset offset for all units * @param scale scaling parameter * @param fontSize current font size * @return value in the current user coordinate system </s> remove return value.size(); </s> add </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> add sRawMatrix[0] = (float) value.getDouble(0); sRawMatrix[1] = (float) value.getDouble(2); sRawMatrix[2] = (float) value.getDouble(4) * mScale; sRawMatrix[3] = (float) value.getDouble(1); sRawMatrix[4] = (float) value.getDouble(3); sRawMatrix[5] = (float) value.getDouble(5) * mScale; return inputMatrixDataSize; </s> remove * @param into output array * @return number of items copied from input to the output array </s> add * @param sRawMatrix output matrix * @param mScale current resolution scaling * @return size of input array
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep replace keep replace replace replace replace
<mask> static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); <mask> <mask> /** <mask> * Converts percentage string into actual based on a relative number <mask> * <mask> * @param percentage percentage string <mask> * @param relative relative number <mask> * @param offset offset number <mask> * @return actual float based on relative number </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); </s> add static private final Pattern percentageRegExp = Pattern.compile("^(-?\\d+(?:\\.\\d+)?)%$"); </s> remove * @param into output array * @return number of items copied from input to the output array </s> add * @param sRawMatrix output matrix * @param mScale current resolution scaling * @return size of input array </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> remove * Converts given {@link ReadableArray} to an array of {@code float}. Writes result to the array * passed in {@param into}. This method will write to the output array up to the number of items * from the input array. If the input array is longer than output the remaining part of the input * will not be converted. </s> add * Converts given {@link ReadableArray} to a matrix data array, {@code float[6]}. * Writes result to the array passed in {@param into}. * This method will write exactly six items to the output array from the input array. * * If the input array has a different size, then only the size is returned; * Does not check output array size. Ensure space for at least six elements. </s> remove /** * Converts {@link ReadableArray} to an array of {@code float}. Returns newly created array. * * @return a {@code float[]} if converted successfully, or {@code null} if {@param value} was * {@code null}. */ static @Nullable float[] toFloatArray(@Nullable ReadableArray value) { if (value != null) { float[] result = new float[value.size()]; toFloatArray(value, result); return result; } return null; } </s> add private static final int inputMatrixDataSize = 6;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep keep replace keep keep keep keep keep
<mask> Matcher matched = percentageRegExp.matcher(percentage); <mask> if (matched.matches()) { <mask> return Float.valueOf(matched.group(1)) / 100 * relative + offset; <mask> } else { <mask> return Float.valueOf(percentage) * scale + offset; <mask> } <mask> } <mask> <mask> /** <mask> * Matches if the `string` is percentage-like. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove * @param percentage percentage string * @param relative relative number * @param offset offset number * @return actual float based on relative number </s> add * @param length length string * @param relative relative size for percentages * @param offset offset for all units * @param scale scaling parameter * @param fontSize current font size * @return value in the current user coordinate system </s> remove path.addRoundRect(new RectF(x, y, x + w, y + h), rx, ry, Path.Direction.CW); </s> add path.addRoundRect(new RectF((float) x, (float) y, (float) (x + w), (float) (y + h)), (float) rx, (float) ry, Path.Direction.CW); </s> remove path.addRect(x, y, x + w, y + h, Path.Direction.CW); </s> add path.addRect((float) x, (float) y, (float) (x + w), (float) (y + h), Path.Direction.CW); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> add // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> remove matrix.setTranslate(glyphPoint.x, glyphPoint.y); </s> add mid.setTranslate((float) startPoint, (float) (y + dy + baselineShift));
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep replace replace keep keep keep replace keep keep keep keep
<mask> static class PathParser { <mask> static private Pattern PATH_REG_EXP = Pattern.compile("[a-df-z]|[\\-+]?(?:[\\d.]e[\\-+]?|[^\\s\\-+,a-z])+", Pattern.CASE_INSENSITIVE); <mask> static private Pattern DECIMAL_REG_EXP = Pattern.compile("(\\.\\d+)(?=\\-?\\.)"); <mask> <mask> private Matcher mMatcher; <mask> private Path mPath; <mask> private String mString; <mask> private float mPenX = 0f; <mask> private float mPenY = 0f; <mask> private float mPenDownX; <mask> private float mPenDownY; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private BezierTransformer mBezierTransformer; private Path mCache; private @Nullable String mContent; </s> add private static final String FONTS = "fonts/"; private static final String OTF = ".otf"; private static final String TTF = ".ttf"; </s> remove private static final float[] sMatrixData = new float[9]; private static final float[] sRawMatrix = new float[9]; protected float mOpacity = 1f; protected Matrix mMatrix = new Matrix(); </s> add static final float MIN_OPACITY_FOR_DRAW = 0.01f; private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; float mOpacity = 1f; Matrix mMatrix = new Matrix(); </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName; </s> remove private static final String PROP_FONT_FAMILY = "fontFamily"; private static final String PROP_FONT_SIZE = "fontSize"; private static final String PROP_FONT_STYLE = "fontStyle"; private static final String PROP_FONT_WEIGHT = "fontWeight"; </s> add private Path mCache; @Nullable String mContent; private TextPathShadowNode textPath; </s> remove static private Pattern percentageRegExp = Pattern.compile("^(\\-?\\d+(?:\\.\\d+)?)%$"); </s> add static private final Pattern percentageRegExp = Pattern.compile("^(-?\\d+(?:\\.\\d+)?)%$");
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
keep keep keep replace keep keep keep keep replace replace replace replace replace replace replace keep keep keep
<mask> private WritableArray mBezierCurves; <mask> private WritableMap mLastStartPoint; <mask> <mask> public PathParser(String d, float scale) { <mask> mScale = scale; <mask> mString = d; <mask> } <mask> <mask> public ReadableArray getBezierCurves() { <mask> if (mBezierCurves == null) { <mask> getPath(); <mask> } <mask> return mBezierCurves; <mask> } <mask> <mask> private void executeCommand(String command) { <mask> switch (command) { <mask> // moveTo command </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected float getCanvasTop() { return getSvgShadowNode().getCanvasBounds().top; </s> add private float getCanvasHeight() { if (canvasHeight != -1) { return canvasHeight; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasHeight = getSvgShadowNode().getCanvasBounds().height(); } else { canvasHeight = root.getGlyphContext().getHeight(); } return canvasHeight; </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove protected float getCanvasHeight() { return getSvgShadowNode().getCanvasBounds().height(); } </s> add private float getCanvasWidth() { if (canvasWidth != -1) { return canvasWidth; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasWidth = getSvgShadowNode().getCanvasBounds().width(); } else { canvasWidth = root.getGlyphContext().getWidth(); } </s> remove protected void drawGroup(Canvas canvas, Paint paint, float opacity) { pushGlyphContext(); super.drawGroup(canvas, paint, opacity); popGlyphContext(); } private int getTextAnchor() { return mTextAnchor; } private int getComputedTextAnchor() { int anchor = mTextAnchor; ReactShadowNode shadowNode = this; while (shadowNode.getChildCount() > 0 && anchor == TEXT_ANCHOR_AUTO) { shadowNode = shadowNode.getChildAt(0); if (shadowNode instanceof TextShadowNode) { anchor = ((TextShadowNode) shadowNode).getTextAnchor(); } else { break; </s> add AlignmentBaseline getAlignmentBaseline() { if (mAlignmentBaseline == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final AlignmentBaseline baseline = node.mAlignmentBaseline; if (baseline != null) { mAlignmentBaseline = baseline; return baseline; } } parent = parent.getParent();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/PropHelper.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RadialGradientShadowNode.java