Skip to content
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

negative value of property transform doesn't work on some android 7.0 devices. #14462

Closed
Feng999 opened this issue Jun 12, 2017 · 6 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Feng999
Copy link
Contributor

Feng999 commented Jun 12, 2017

RN version: "0.41.2"
devices:
FRD-AL10(honor 8) EMUI:5.0 android: 7.0
MHA-AL00(Mate9) EMUI:5.0 android:7.0

On some android device mentioned before , negative value of transform(e.g.. scaleX scaleY ) doesn't work. i found this problem when i'm using the package of react-native-invertible-scroll-view. It write like this:

let styles = StyleSheet.create({
  verticallyInverted: {
    flex: 1,
    transform: [
      { scaleY: -1 },
    ],
  },
  horizontallyInverted: {
    flex: 1,
    transform: [
      { scaleX: -1 },
    ],
  },
});

but when i use scaleY which is deprecated directly, like this:

let styles = StyleSheet.create({
  verticallyInverted: Platform.select({
    ios: {transform: [{ scaleY: -1 }]},
    android: {scaleY: -1},
  }),
  horizontallyInverted: Platform.select({
    ios: {transform: [{ scaleX: -1 }]},
    android: {scaleX: -1},
  }),
});

it worked!
Guess there is some thing wrong when get property from transform in native code, Any ideas how does this fix?

@yury
Copy link

yury commented Jun 14, 2017

Confirm at RN 0.43.2 Huawei OS7.0 P10. VTR-L09/VTR-L29

Doesn't work with transform, works with deprecated.

@ptomasroos
Copy link
Contributor

This is a real case reported by various user by us as well.

@janicduplessis
Copy link
Contributor

Looks like this could be a potential fix #14560

@Feng999
Copy link
Contributor Author

Feng999 commented Jun 20, 2017

@janicduplessis add{"perspective": 1} is a better way to fix this if it works. i will try it latter.

@yury
Copy link

yury commented Jul 3, 2017

No, {"perspective": 1} doesn't help :(

facebook-github-bot pushed a commit that referenced this issue Aug 7, 2017
Summary:
This is the better fix for the same issue as mentioned in PR #14560

Certain rotateX, rotateY, scaleX and scaleY animations do not work correctly on some phones in Android 7.0.0, causing issues such as #14462 and #13522.

The issue can be fixed on JS side by setting an additional transform for perspective, eg. `{perspective: 1}` which triggers a `setCameraDistance` call in native code.

The fix in this PR always sets the camera distance on transforms, even when no perspective transform was specified. The default camera distance is set before the scale multiplication, to make sure that the value is appropriate for the phones density. The value calculates to an Android 'default' camera distance of 1280 * scale multiplier; https://developer.android.com/reference/android/view/View.html#setCameraDistance(float)

If a perspective transform is specified, this value will be used correctly still.

This fix was tested on the RNTester. Before the fix, on some devices, the FlatList example, with inverted turned on, will not display the list.

Devices that have been confirmed to have this issue:
FRD-AL10(honor 8) EMUI:5.0 android: 7.0
MHA-AL00(Mate9) EMUI:5.0 android:7.0
Huawei P10 VTR-L09, running Android 7.0

After the fix, the inverted FlatList displays correctly.
Closes #14646

Differential Revision: D5492009

Pulled By: shergin

fbshipit-source-id: d4da3b090a7e65df3b84e48ea32c964f4f8f7c88
@hramos hramos added the Icebox label Sep 21, 2017
@hramos
Copy link
Contributor

hramos commented Sep 21, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos closed this as completed Sep 21, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Sep 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants