mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-23 20:10:49 +08:00
feat: if cardStyle has flexed specified, set the same value on P… (#206)
* feat: if cardStyle has flexed specified, set the same value on PointerEventsView * Stop producing empty object if no override is needed * Change produced false to undefined * Update cardStyle to handle arrays * Update code to use StyleSheet.flatten * Use better styling * Update snapshots
This commit is contained in:
@@ -146,6 +146,7 @@ Array [
|
||||
"flex": 1,
|
||||
"overflow": "hidden",
|
||||
},
|
||||
null,
|
||||
Object {
|
||||
"backgroundColor": "#eee",
|
||||
},
|
||||
@@ -297,6 +298,7 @@ Array [
|
||||
"flex": 1,
|
||||
"overflow": "hidden",
|
||||
},
|
||||
null,
|
||||
Object {
|
||||
"backgroundColor": "#eee",
|
||||
},
|
||||
|
||||
@@ -146,6 +146,7 @@ Array [
|
||||
"flex": 1,
|
||||
"overflow": "hidden",
|
||||
},
|
||||
null,
|
||||
Object {
|
||||
"backgroundColor": "#eee",
|
||||
},
|
||||
@@ -464,6 +465,7 @@ Array [
|
||||
"flex": 1,
|
||||
"overflow": "hidden",
|
||||
},
|
||||
null,
|
||||
Object {
|
||||
"backgroundColor": "#eee",
|
||||
},
|
||||
|
||||
@@ -638,6 +638,14 @@ export default class Card extends React.Component<Props> {
|
||||
: this.handleGestureEventHorizontal
|
||||
: undefined;
|
||||
|
||||
let overrideFlex = null;
|
||||
if (cardStyle) {
|
||||
const style = StyleSheet.flatten(cardStyle) as ViewStyle;
|
||||
if (style.hasOwnProperty('flex')) {
|
||||
overrideFlex = { flex: style.flex };
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<StackGestureContext.Provider value={this.gestureRef}>
|
||||
<View pointerEvents="box-none" {...rest}>
|
||||
@@ -681,6 +689,7 @@ export default class Card extends React.Component<Props> {
|
||||
progress={this.props.current}
|
||||
style={[
|
||||
styles.content,
|
||||
overrideFlex,
|
||||
transparent ? styles.transparent : styles.opaque,
|
||||
contentStyle,
|
||||
]}
|
||||
|
||||
Reference in New Issue
Block a user