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

Latest release delete precomputeStyle module? #3760

Closed
jarvys opened this issue Oct 29, 2015 · 11 comments
Closed

Latest release delete precomputeStyle module? #3760

jarvys opened this issue Oct 29, 2015 · 11 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jarvys
Copy link

jarvys commented Oct 29, 2015

redbox report 'unknown module precomputeStyle'

@pickhardt
Copy link

+1 is there a replacement for precomputeStyle?

This used to work, but now doesn't:

var precomputeStyle = require('precomputeStyle');

screen shot 2015-10-28 at 9 28 36 pm

@jarvys jarvys changed the title latest realease delete precomputeStyle module? Latest release delete precomputeStyle module? Oct 29, 2015
@corymsmith
Copy link

Wondering the same thing over here

@corymsmith
Copy link

Looks like this commit by @sebmarkbage 6244fd0#diff-459f28dd7480110d5d268af6f1204452

It was a private module so technically we shouldn't have been using it :) Is there a good alternative to use in native modules?

@pickhardt
Copy link

Yeah, I know it was private, but people were using it (even though technically maybe we shouldn't have) It was useful. Is there an alternative?

Maybe it should get made into a public class method of StyleSheet, like StyleSheet.precomputeStyle

@sebmarkbage
Copy link
Contributor

Why and how were you using it exactly?

It may product a result that may not be idempotent (in the mathematical sense). I.e. there may not be a public API that you can pass it to because it would be computed again.

@pickhardt
Copy link

Here's an example that was using it:

ptomasroos/react-native-scrollable-tab-view@c111d77#diff-c7ac8c6ffd293d4101dad4033eedd5f7

(The function setAnimationValue uses it.)

@shishircc
Copy link

I am facing same problem :) . I am also using react-native-scrollable-tab-view

@sebmarkbage
Copy link
Contributor

I think that was an invalid use of precomputeStyle. Perhaps due to a misunderstanding of the setNativeProps API. @brentvatne Could you clarify why it was needed since it was already doing that here?

var style = precomputeStyle(flattenStyle(nativeProps.style));

And is still doing it. What breaks if you just remove the call?

@ghost
Copy link

ghost commented Nov 7, 2015

It also broke this popular scroll refresher component syrusakbary/react-native-refresher#14

@urquilla
Copy link

urquilla commented Dec 3, 2015

+1

@brentvatne
Copy link
Collaborator

Sorry I just saw this -- I believe the reason why I did this is very silly, you guessed it @sebmarkbage.

I didn't realize at the time that I should have used the style key for style props: setNativeProps({style: {transform: [...etc]}}).

This is probably because setNativeProps let me get away with directly passing in style properties like setNativeProps({left: 5}) for everything except transform. Of course now it is obvious to me why -- setNativeProps ran precomputeStyle on the style object passed in, which then precomputed the transform matrix. 😛

So yeah, precomputeStyle isn't needed anymore.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 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

8 participants