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

Theme is not applied when using native-base-web with native-base-shoutem-theme #17

Open
flipflopapp opened this issue Mar 28, 2019 · 2 comments

Comments

@flipflopapp
Copy link

flipflopapp commented Mar 28, 2019

I am using native-base-web with native-base-shoutem-theme ; but the custom theme changes are not applied to the DOM.

More details

I have customised the theme and have used console to see that it is loaded properly, when I do below at init.

import { Theme } from 'native-base-shoutem-theme';
import getThemeStyle from '../theme/components';

export default function setDefaultThemeStyle() {
  const theme = getThemeStyle();
  Theme.setDefaultThemeStyle(theme);
}

I have wrapped my code in a Style Provider.

import { StyleProvider } from 'native-base-shoutem-theme';
import getTheme from '../theme/components';
import variables from '../theme/variables/platform';
<StyleProvider style={getTheme(variables)}>
        <>
              {this.props.children}
        </>
</StyleProvider>

So I suspect that there is some fix which is needed in react-native-web.

Can I provide any more information or can you suggest me more ways to debug?

@flipflopapp flipflopapp changed the title Themes not applied when using native-base-web with native-base-shoutem-theme Theme is not applied when using native-base-web with native-base-shoutem-theme Mar 28, 2019
@flipflopapp
Copy link
Author

flipflopapp commented Mar 30, 2019

By comparing native-base and native-base-web, I see that the support for native-base-shoutem-theme is missing. For instance, in file native-base/src/button.js; the following code is added to support shoutem-theme.

import { connectStyle } from "native-base-shoutem-theme";
...
// and at the end...
const StyledButton = connectStyle(
  "NativeBase.Button",
  {},
  mapPropsToStyleNames
)(Button);
export { StyledButton as Button };

The component file Components/Widgets/Button.js in 'native-base-web' is missing this connector.

I am trying to add this.

@flipflopapp
Copy link
Author

I have created a PR with above changes - #18

  • see the top two commits
  • i have tested them to work

I request anyone who wants to use native-base-web with themes to try them out aswell.

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