mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-11 15:46:25 +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:
@@ -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