Skip to content

Commit

Permalink
fix: android crash when rendering a ScrollView component
Browse files Browse the repository at this point in the history
  • Loading branch information
luizbaldi committed Dec 22, 2020
1 parent b08115d commit c6b7e87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,13 @@ const Button = ({
accessibilityLabel={accessibilityLabel}
>
<View pointerEvents='none'>
<Text disabled={!isFlat && disabled} secondary={isFlat && disabled}>
{children}
</Text>
{typeof children === 'string' ? (
<Text disabled={!isFlat && disabled} secondary={isFlat && disabled}>
{children}
</Text>
) : (
children
)}
</View>
</TouchableHighlight>
</View>
Expand Down Expand Up @@ -174,11 +178,11 @@ const Borders = ({
style,
]}
>
{outer && (
{Array.isArray(outer) && (
<View style={[borderStyles.position, ...outer]}>
{inner && inner.length > 0 && (
{Array.isArray(inner) && inner.length > 0 && (
<View style={[borderStyles.position, ...inner]}>
{focus && !active && (
{Array.isArray(focus) && !active && (
<View
style={[
borderStyles.position,
Expand Down
4 changes: 2 additions & 2 deletions src/ScrollView/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ const ScrollView = ({
);
};

export default ScrollView;

const styles = StyleSheet.create({
wrapper: {
display: 'flex',
Expand Down Expand Up @@ -214,3 +212,5 @@ const styles = StyleSheet.create({
width: '100%',
},
});

export default ScrollView;

0 comments on commit c6b7e87

Please sign in to comment.