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

Question: how do I apply a style to an individual Scene? #2924

Closed
blah1234 opened this issue Mar 8, 2018 · 3 comments
Closed

Question: how do I apply a style to an individual Scene? #2924

blah1234 opened this issue Mar 8, 2018 · 3 comments

Comments

@blah1234
Copy link

blah1234 commented Mar 8, 2018

Version

  • react-native-router-flux v4.0.0-beta.28
  • react-native v0.53.0

Is there a way to add a style to individual Scenes in v4.0.0? In v3.X, "sceneStyle" was a property on Scene, but in v4.0.0 "sceneStyle" has moved to Router, which applies a style to ALL Scenes.

There are instances where we want to apply a single style for 90% of our Scenes, but a different style to the other 10% of Scenes.

So, anything like "sceneStyle" as a property on Scene in v4.0.0?

@ChristianTucker
Copy link

ChristianTucker commented Mar 9, 2018

This isn't an answer to your question, but why can't you just apply the "sceneStyle" to the top-level-component for the Scene? This is what I have always done.

import theme from 'application/theme';
const styles = { };

export default () => (
    <View style={[theme.selected().scene, styles]}>
        ...
    </View>
);

This still applies the style to the scene you want to apply it to, plus you can reference the style and use it for a more globalized styling solution this way, (i.e: <Text style={{ color: theme.selected().darkColor }} />)

@blah1234
Copy link
Author

blah1234 commented Mar 9, 2018

@ChristianTucker , yes, your example is what I ended up doing now with the removal of the "sceneStyle" property on the Scene element.

Previously in v3.X, it was just nice in terms of visibility (especially in multi-person teams) to apply the style in a single file to all the Scenes in the Scene tree definition for the Router, rather than applying the style to each component for the Scene over multiple files.

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

You may still try to apply different sceneStyle to individual component.

@aksonov aksonov closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants