-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image Component cannot update transform props #23808
Comments
Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety? 👉 Click here if you want to take another look at the Bug Report issue template. |
It's supposed to work on my android 9 device - Xiamo Mi Mix 2S. Is it still an issue @halftrue? Can you provide a device on which it can be reproduced? Thanks in advance 😃 |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
🐛 Bug Report
Image Component has two way to set transform properties.
when you use the first way to set transform, it will fail to setState to update transform props.
while the second works well.
After read source code, I found that in react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js
line 3537
in Situation1: shouldUpdate is false. Situation2 : it is true.
Situation 1
<Image ...someotherprops transform={[{rotate: '180deg'}]}>
the
attributeConfig.diff
is Matric Differwhich in this case will return false.
Situation 2
<Image style={{ transform: [{rotate: '180deg'}] }}>
the
attributeConfig.process
has a value of processTransform, which result in below code will excute instead:(bold below)In my sight, it is caused by the different value of
attributeConfig
which retrieves fromattributeConfig = validAttributes[propKey];
I checked the
propKey
, both transform, but they have a different value.I don't know much about RN, so I can't trace any more about this question.
Expected Behavior
setState should trigger update correctly.
To Reproduce
Just place transform in the top level and try to update it. (only one transform should be set due to the matric diff).
Code Example
I made a small demo.
In this demo, only the second one cannot transform.
DEMO
Environment
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 713.85 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.10.1 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1
npmGlobalPackages:
create-react-native-app: 2.0.2
The text was updated successfully, but these errors were encountered: