Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Which is good way when create style file? #23

@tomzaku

Description

@tomzaku

1st:
Though this way is good cuz that using type props of view.

import { ViewStyle } from 'react-native'

const preview: ViewStyle = {
    flex: 1,
    justifyContent: 'flex-end',
    alignItems: 'center',
}
export default {
 preview
}

2nd: common one

import { StyleSheet } from "react-native";
const styles: any = StyleSheet.create({
	container: {
		flex: 1,
                justifyContent: 'flex-end',
                alignItems: 'center',
	},
}
export default styles

3rd:
Using function to import theme for style

const styles = ({applicationStyle, font, metric, color}) => ({
	container: {
		flex: 1,
                justifyContent: 'flex-end',
                alignItems: 'center',
                color: color.ba
	},
})
export default styles

So could you guys tell me the props and cons of each way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions