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

Transform::rotate on Android: "Value for value cannot be cast from String to Double" #23219

Closed
itinance opened this issue Jan 30, 2019 · 10 comments
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@itinance
Copy link
Contributor

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.2
      CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
      Memory: 381.37 MB / 16.00 GB
      Shell: 5.0.2 - /usr/local/bin/bash
    Binaries:
      Node: 10.11.0 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.5.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.0, 28.0.3
        System Images: android-27 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.2 => 16.5.2
      react-native: 0.57.3 => 0.57.3
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

The following code works well on iOS, but not on Android:

const s = StyleSheet.create({
    curvedLineLeft: {
      transform: [{ rotate: '90deg' }, { scale: 1.6 }],
      position: 'absolute',
      left: -(width / 35),
      top: 31 + 91
    },
// ....

It produces "Value for value cannot be cast from String to Double"

Even if i pass a double for rotate like `rotate: 3.14196/4` it complains that it needs a string and not a double.
@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.58 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@jeronnex2
Copy link

jeronnex2 commented Feb 3, 2019

having the same problem.

this is my line of code

<TouchableOpacity style={{position:'absolute', right:40, top: 80, transform: [{rotate: '90deg'}] }}>



it is displaying but when you touch the icon, it'll display the error value for value cannot be cast from string to double.

@pbfrias17
Copy link

same issue. "react": "16.6.1", "react-native": "0.57.7"

@iRayan7
Copy link

iRayan7 commented Feb 4, 2019

Same here. "react": "16.6.1", "react-native": "0.57.7"
Was using transform: [{ rotateY: '180deg' }] to flip an icon and that caused the error, had to use transform: [{ scaleX: -1 }] instead to fix it.

@svegan
Copy link

svegan commented Feb 12, 2019

In this issue fix with changingTouchableOpacity to TouchableHighlight has helped me.

@rohanx96
Copy link

Facing the same issue on React Native 0.57.5
Applying rotation transform to TouchableOpacity causes this error to show when clicked.
TouchableHighlight works though.

@MoKhajavi75
Copy link

I can confirm it's still an issue in "react-native": "0.57.8"

@birendra-90
Copy link

I can confirm it's still an issue in "react-native": "0.58.0"

@stale
Copy link

stale bot commented Aug 2, 2019

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.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 2, 2019
@stale
Copy link

stale bot commented Aug 9, 2019

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.

@stale stale bot closed this as completed Aug 9, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

10 participants