Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Theming does not work with containerStyle etc. props #14

Open
anshgupta1234 opened this issue Jun 7, 2019 · 5 comments
Open

Theming does not work with containerStyle etc. props #14

anshgupta1234 opened this issue Jun 7, 2019 · 5 comments

Comments

@anshgupta1234
Copy link

I am using a Card component from React Native Elements. In order to style the component, it requires one to use containerStyle. That does not work with react-native-theming. Everything that uses "style" works fine

<ThemedCard containerStyle={styles.cardContainer} image={require('../../assets/images/notecards.jpg')} imageStyle={{overflow: 'hidden', borderTopRightRadius: 15, borderTopLeftRadius: 15}} borderRadius={15}> <Theme.Text style={styles.titleText}>{text}</Theme.Text> <ThemedAppText text="Last Edited: 5 Days Ago" style={styles.lastEdited} /> <ThemedAppText text="Last Viewed: Today" style={styles.lastViewed}/> </ThemedCard>

cardContainer: { backgroundColor: '@mainColor', borderRadius: 15, height: 200, width: 150, margin: 20, flex: 1, flexDirection: 'row', justifyContent: 'center', elevation: 2, shadowColor: 'rgba(0, 0, 0, 1)', shadowOpacity: 1, shadowRadius: 1, borderColor: '@mainColor' },

export const ThemedCard = createThemedComponent(Card);

@dapicester
Copy link

As written in the docs you need to do:

export const ThemedCard = createThemedComponent(Card, ['containerStyle']);

@atifaziz1
Copy link

Hi @dapicester!

I am also using checkbox from react-native-element like this,

import { CheckBox } from 'react-native-elements';
import { createThemedComponent } from 'react-native-theming';
const ThemedCheckBox = createThemedComponent(CheckBox, ['textStyle']);

<ThemedCheckBox
      title={'abc'}
      textStyle={styles.textStyle}
      size={24}
      containerStyle={styles.containerStyle}
/>

But it's not working..textStyle is not implementing ..

@blazk0
Copy link
Contributor

blazk0 commented Jun 4, 2020

Hey, @syaau
This implementation works only for one style props
like color: '@FFFFFF'
but for an style object it doesn't work

@smsmdida
Copy link

smsmdida commented Jun 9, 2020

@syaau PR #31 created to fix this issue

@dapicester
Copy link

@syaau if you release a new version this can be closed too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants