Skip to content

Commit

Permalink
chore: Add Platform.OS check to AnimatedStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldonadel committed Nov 8, 2022
1 parent c45bf58 commit 92af6c4
Show file tree
Hide file tree
Showing 5 changed files with 626 additions and 138 deletions.
55 changes: 2 additions & 53 deletions Libraries/Animated/__tests__/Animated-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ describe('Animated tests', () => {
style: [
{
backgroundColor: 'red',
opacity: anim,
shadowOffset: {
width: anim,
height: anim,
},
transform: [
{translate: [translateAnim, translateAnim]},
{translateX: translateAnim},
{scale: anim},
],
},
{
opacity: 0,
transform: [{translate: [100, 100]}, {translateX: 100}, {scale: 0}],
shadowOffset: {
Expand All @@ -101,18 +89,6 @@ describe('Animated tests', () => {
style: [
{
backgroundColor: 'red',
opacity: anim,
shadowOffset: {
width: anim,
height: anim,
},
transform: [
{translate: [translateAnim, translateAnim]},
{translateX: translateAnim},
{scale: anim},
],
},
{
opacity: 0.5,
transform: [
{translate: [150, 150]},
Expand Down Expand Up @@ -205,15 +181,15 @@ describe('Animated tests', () => {
<Animated.View style={{opacity}} />,
);

expect(testRenderer.toJSON().props.style[1].opacity).toEqual(0);
expect(testRenderer.toJSON().props.style[0].opacity).toEqual(0);

Animated.timing(opacity, {
toValue: 1,
duration: 0,
useNativeDriver: false,
}).start();

expect(testRenderer.toJSON().props.style[1].opacity).toEqual(1);
expect(testRenderer.toJSON().props.style[0].opacity).toEqual(1);
});

it('warns if `useNativeDriver` is missing', () => {
Expand Down Expand Up @@ -857,12 +833,6 @@ describe('Animated tests', () => {

expect(node.__getValue()).toEqual({
style: [
{
top: vecLayout.top,
left: vecLayout.left,
opacity,
transform: vec.getTranslateTransform(),
},
{
opacity: 0.2,
transform: [{translateX: 0}, {translateY: 0}],
Expand All @@ -882,12 +852,6 @@ describe('Animated tests', () => {

expect(node.__getValue()).toEqual({
style: [
{
top: vecLayout.top,
left: vecLayout.left,
opacity,
transform: vec.getTranslateTransform(),
},
{
opacity: 0.8,
transform: [{translateX: 42}, {translateY: 1492}],
Expand Down Expand Up @@ -988,13 +952,6 @@ describe('Animated tests', () => {
expect(listener).toBeCalledWith({value: 137});
expect(view.__getValue()).toEqual({
style: [
{
transform: [
{
translateX: value4,
},
],
},
{
transform: [
{
Expand Down Expand Up @@ -1091,10 +1048,6 @@ describe('Animated tests', () => {

expect(node.__getValue()).toEqual({
style: [
{
backgroundColor: color,
transform: [{scale}],
},
{
backgroundColor: 'rgba(255, 0, 0, 1)',
transform: [{scale: 2}],
Expand All @@ -1109,10 +1062,6 @@ describe('Animated tests', () => {
expect(callback.mock.calls.length).toBe(4);
expect(node.__getValue()).toEqual({
style: [
{
backgroundColor: color,
transform: [{scale}],
},
{
backgroundColor: 'rgba(11, 22, 33, 0.5)',
transform: [{scale: 1.5}],
Expand Down
Loading

0 comments on commit 92af6c4

Please sign in to comment.