Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ export default [
},

rules: {
'observation/no-function-without-logging': 'error',
'observation/no-function-without-logging': [
'error',
{
ignoreList: ['createStyles'],
},
],

'react-native/no-unused-styles': 'off',
'react-native/no-unused-styles': 'error',
'react-native/no-inline-styles': 'off',

'prettier/prettier': 'error',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observation.org/react-native-components",
"version": "1.79.0",
"version": "1.80.0",
"main": "src/index.ts",
"exports": {
".": "./src/index.ts",
Expand Down
7 changes: 5 additions & 2 deletions src/components/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const BottomSheet = ({ title, text, buttons = [], style, testID, children }: Pro

export default BottomSheet

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
container: {
...shadow.normal.ios,
borderTopWidth: 1 / 3,
Expand All @@ -87,3 +87,6 @@ const createStyles = (theme: Theme) =>
marginHorizontal: theme.margin.half,
},
})

return styles
}
9 changes: 6 additions & 3 deletions src/components/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ const Chip = ({ text, textStyle, containerStyle, onPress, disabled }: Props) =>
)
}

const createStyles = (theme: Theme) =>
StyleSheet.create({
export default Chip

const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
chipTextContainer: {
flexDirection: 'row',
justifyContent: 'center',
Expand All @@ -60,4 +62,5 @@ const createStyles = (theme: Theme) =>
},
})

export default Chip
return styles
}
7 changes: 5 additions & 2 deletions src/components/ContentImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const ContentImage = ({ src, alt }: Props) => {

export default ContentImage

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
outerContainer: {
margin: -theme.margin.common,
marginBottom: -theme.margin.half,
Expand Down Expand Up @@ -97,3 +97,6 @@ const createStyles = (theme: Theme) =>
color: theme.color.text.system.subtler,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/Disclose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const Disclose = ({ text, onPress, textStyle, containerStyle }: Props) => {

export default Disclose

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
containerStyle: {
flexDirection: 'row',
alignItems: 'center',
Expand All @@ -39,3 +39,6 @@ const createStyles = (theme: Theme) =>
backgroundColor: theme.color.background.system.surfaceBase,
},
})

return styles
}
9 changes: 6 additions & 3 deletions src/components/IconText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ const IconText = ({ icon, text, style, onPress, singleLineText = false }: Props)
)
}

const createStyles = (theme: Theme) =>
StyleSheet.create({
export default IconText

const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
containerStyle: {
flexDirection: 'row',
},
Expand All @@ -49,4 +51,5 @@ const createStyles = (theme: Theme) =>
},
})

export default IconText
return styles
}
5 changes: 3 additions & 2 deletions src/components/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ const InputField = ({

export default InputField

// eslint-disable-next-line observation/no-function-without-logging
const createStyles = (theme: Theme) => {
const inputStyles = createInputStyles(theme)

return StyleSheet.create({
const styles = StyleSheet.create({
containerStyle: {
flexDirection: 'column',
},
Expand All @@ -136,4 +135,6 @@ const createStyles = (theme: Theme) => {
color: theme.color.text.system.subtle,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/InputPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const InputPanel = ({

export default InputPanel

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'space-between',
Expand All @@ -89,3 +89,6 @@ const createStyles = (theme: Theme) =>
marginLeft: theme.margin.half,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/ItemSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const ItemSeparator = ({ style, orientation = 'horizontal' }: Props) => {

export default ItemSeparator

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
horizontalSeparator: {
borderBottomWidth: 1,
borderBottomColor: theme.color.background.system.surfaceRaised,
Expand All @@ -29,3 +29,6 @@ const createStyles = (theme: Theme) =>
borderRightColor: theme.color.background.system.surfaceRaised,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/LargeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ const LargeButton = ({
export default LargeButton
export type { LargeButtonProps }

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
container: {
...rounded.normal,
margin: theme.margin.common,
Expand All @@ -109,3 +109,6 @@ const createStyles = (theme: Theme) =>
paddingRight: theme.margin.half,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ const Lightbox = ({

export default Lightbox

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
lightboxFooterContainer: {
...layout.absoluteBottom,
backgroundColor: theme.overlay.black50,
Expand Down Expand Up @@ -216,3 +216,6 @@ const createStyles = (theme: Theme) =>
alignItems: 'center',
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const ListItem = ({ icon, onPress, label, subLabel, extraSubLabel, selected = fa

export default ListItem

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
containerStyle: {
flexDirection: 'row',
alignItems: 'center',
Expand All @@ -86,3 +86,6 @@ const createStyles = (theme: Theme) =>
color: theme.color.text.system.subtler,
},
})

return styles
}
13 changes: 8 additions & 5 deletions src/components/NotificationPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ const NotificationPopup = ({ visible, title, message, leftButton, rightButton, o
)
}

const createStyles = (theme: Theme) =>
StyleSheet.create({
export default NotificationPopup

export type { NotificationPopupProps, NotificationPopupStaticProps }

const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
mainContainer: {
backgroundColor: theme.color.background.system.surfaceBase,
margin: theme.margin.common,
Expand Down Expand Up @@ -89,6 +93,5 @@ const createStyles = (theme: Theme) =>
},
})

export default NotificationPopup

export type { NotificationPopupProps, NotificationPopupStaticProps }
return styles
}
7 changes: 5 additions & 2 deletions src/components/PageIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const PageIndicator = ({ currentPage, numberOfPages }: Props) => {

export default PageIndicator

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
containerStyle: {
flexDirection: 'row',
alignSelf: 'center',
Expand All @@ -88,3 +88,6 @@ const createStyles = (theme: Theme) =>
backgroundColor: theme.color.background.system.surfaceBase,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const Panel = ({ children, topShadow = true, containerStyle, panelStyle }: Props

export default Panel

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
panelContainer: {
marginTop: theme.margin.quarter,
...shadow.small.ios,
Expand All @@ -37,3 +37,6 @@ const createStyles = (theme: Theme) =>
borderColor: theme.color.border.system.subtle,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const Popup = ({ children, visible }: Props) => {

export default Popup

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
modalBackground: {
flex: 1,
alignItems: 'stretch',
Expand All @@ -43,3 +43,6 @@ const createStyles = (theme: Theme) =>
backgroundColor: 'transparent',
},
})

return styles
}
9 changes: 6 additions & 3 deletions src/components/ProgressBarList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ const ProgressBarList = ({ progressBars, separator }: Props) => {
const barHeight = 16
const borderRadius = barHeight / 2

const createStyles = (theme: Theme) =>
StyleSheet.create({
export default ProgressBarList

const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
mainContainer: {
width: '100%',
flexDirection: 'row',
Expand Down Expand Up @@ -165,4 +167,5 @@ const createStyles = (theme: Theme) =>
},
})

export default ProgressBarList
return styles
}
7 changes: 5 additions & 2 deletions src/components/SectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const SectionHeader = ({ title, containerStyle }: Props) => {

export default SectionHeader

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
header: {
paddingHorizontal: theme.margin.common,
marginTop: theme.margin.common,
Expand All @@ -33,3 +33,6 @@ const createStyles = (theme: Theme) =>
color: theme.color.text.system.subtler,
},
})

return styles
}
7 changes: 5 additions & 2 deletions src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export default Tooltip

export type { TooltipProps }

const createStyles = (theme: Theme) =>
StyleSheet.create({
const createStyles = (theme: Theme) => {
const styles = StyleSheet.create({
tooltipContainer: {
borderBottomLeftRadius: 16,
borderBottomRightRadius: 16,
Expand All @@ -106,3 +106,6 @@ const createStyles = (theme: Theme) =>
justifyContent: 'center',
},
})

return styles
}
Loading