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

All default rules lost? #41

Open
ghost opened this issue May 12, 2018 · 1 comment
Open

All default rules lost? #41

ghost opened this issue May 12, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented May 12, 2018

<StyleProvider style={theme}> <Screen> <NavigationBar styleName="inline" leftComponent={ <Button onPress={() => this.props.navigation.navigate("DrawerOpen")}> <Icon name="sidebar"/> </Button> } centerComponent={ <Title> {this.renderDate()} </Title> } rightComponent={ <Button onPress={() => this.setState({isTimelineOpen: true})}> <Icon name="history"/> </Button> } /> </Screen> </StyleProvider>

theme is an empty object, all default rules from shoutem ui seems to have lost. Any help?

@danalloway
Copy link

danalloway commented Mar 6, 2020

@teddyteh here is what we're doing in an app we're currently building
it's pseudo code but I hope it helps get the general idea across

import { StyleProvider } from '@shoutem/theme'
import { getTheme, defaultThemeVariables } from '@shoutem/ui'

const customThemeVariables = {
    ...defaultThemeVariables,

    // override existing default theme variables
    primaryButtonBackgroundColor: 'red',
    secondaryButtonBackgroundColor: 'blue',

    // add new theme variables
    errorBlockColor: 'purple',
}

const customTheme = {
    // import the existing default theme definition
    ...getTheme(customThemeVariables),

    // add new theme definitions
    'customApp.ui.ErrorBlock': {
        backgroundColor: customThemeVariables.errorBlockColor,
    },
}

function App() {
    return (
        <StyleProvider style={customTheme}>
            <CustomApp />
        </StyleProvider>
    )
}

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

1 participant