mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix for InterpolatorType crash
Summary: We're currently getting a redbox in Turkish when we try to convert the string 'easeInEaseOut' to an InterpolatorType. This is because I use toLowerCase() to compare the string without setting a locale; in Turkish, the capital letter 'I' doesn't convert to 'i' when you lowercase it, but rather to 'ı' (http://www.i18nguy.com/unicode/turkish-i18n.html). Passing in a locale param to `toLowerCase()` fixes it. Also updating the test. Differential Revision: D10315474 fbshipit-source-id: 54be3ff1d3f91cb2ec765ff705ac364b976b8c6f
This commit is contained in:
committed by
Facebook Github Bot
parent
a82f6e164b
commit
01a1004808
+7
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.uimanager.layoutanimation;
|
||||
|
||||
import com.facebook.react.uimanager.layoutanimation.InterpolatorType;
|
||||
import java.util.Locale;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -32,6 +33,12 @@ public class InterpolatorTypeTest {
|
||||
assertThat(InterpolatorType.fromString("easeineaseout")).isEqualTo(InterpolatorType.EASE_IN_EASE_OUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocales() {
|
||||
Locale.setDefault(Locale.forLanguageTag("tr-TR"));
|
||||
assertThat(InterpolatorType.fromString("easeInEaseOut")).isEqualTo(InterpolatorType.EASE_IN_EASE_OUT);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testInvalidInterpolatorTypes() throws IllegalArgumentException {
|
||||
InterpolatorType.fromString("ease_in_ease_out");
|
||||
|
||||
Reference in New Issue
Block a user