NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

connectStyle with empty defaultStyle parameter

Open Xvie opened this issue 8 years ago • 3 comments

react-native, react and native-base version

"native-base": "2.3.3", "react": "^16.1.1", "react-native": "^0.50.4",

Expected behaviour

Specifying {} to connectStyle as 2nd (defaultStyles) parameter should allow to style nested custom component in getTheme function.

Actual behaviour

If {} is passed to connectStyle component won't be recognized, styleName of component in getTheme will be ignored.

Steps to reproduce (code snippet or screenshot)

Create custom component e.g.

class Hello extends PureComponent {
    render() {
        return (
            <View>
                <Text>Hello</Text>
            </View>
        );
    }
}

export default connectStyle('Test.Hello', {})(Hello);

let's say that this component is children of NativeBase.Form so counting with that i should be able to add styles to

'NativeBase.Form': {
            'Test.Hello': {
                'NativeBase.ViewNB': {
                    backgroundColor: 'red'
                }
            },
            ...formTheme(),
        },

but if u are passing {}/StyleSheet.create({})/false as second argument to connectStyle hoc it won't work. But in case u'll send there for example { a: {} } so export looks like this export default connectStyle('Test.Hello', {a : {}})(Hello); it will work.

PS If u are not nesting component in style definition it works so if u have directly in getTheme first level key Test.Hello with its styles definition it works.

Screenshot of emulator/device

screen shot 2018-01-12 at 11 31 23

vs

screen shot 2018-01-12 at 11 37 09

Is the bug present in both ios and android or in any one of them?

yes

Any other additional info which would help us debug the issue quicker.

I think i provided all the necessary steps to reproduce a bug.

Xvie avatar Jan 12 '18 10:01 Xvie

Hi @Xvie , can you provide minimal code reproduction for the same? And let us know if the issue still persists.

hanykumar avatar Aug 20 '20 08:08 hanykumar

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 21 '20 13:12 stale[bot]

Closing this for now. Let us know if you are still facing this issue

shivrajkumar avatar Dec 28 '20 11:12 shivrajkumar