Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak committed Jan 31, 2020
1 parent e897e67 commit edfc88c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
21 changes: 12 additions & 9 deletions packages/block-editor/src/components/inserter/menu.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,30 @@ export class InserterMenu extends Component {
keyboardShouldPersistTaps="always"
numColumns={ this.state.numberOfColumns }
data={ this.props.items }
ItemSeparatorComponent={ () =>
<View style={ styles.rowSeparator } />
}
ItemSeparatorComponent={ () => <View style={ styles.rowSeparator } /> }
keyExtractor={ ( item ) => item.name }
renderItem={ ( { item } ) =>
renderItem={ ( { item } ) => (
<TouchableHighlight
style={ styles.touchableArea }
underlayColor="transparent"
activeOpacity={ .5 }
activeOpacity={ 0.5 }
accessibilityLabel={ item.title }
onPress={ () => this.props.onSelect( item ) }>
<View style={ [ styles.modalItem, { flex: 1, justifyContent: 'flex-start', maxWidth: modalItemMaxWidth } ] }>
onPress={ () => this.props.onSelect( item ) }
>
<View style={ [ styles.modalItem, { flex: 1, maxWidth: modalItemMaxWidth } ] }>
<View style={ modalIconWrapperStyle }>
<View style={ modalIconStyle }>
<Icon icon={ item.icon.src } fill={ modalIconStyle.fill } size={ modalIconStyle.width } />
<Icon
icon={ item.icon.src }
fill={ modalIconStyle.fill }
size={ modalIconStyle.width }
/>
</View>
</View>
<Text style={ modalItemLabelStyle }>{ item.title }</Text>
</View>
</TouchableHighlight>
}
) }
/>
</TouchableHighlight>
</BottomSheet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

.modalItem {
flex-direction: column;
justify-content: center;
justify-content: flex-start;
align-items: center;
padding-left: 8;
padding-right: 8;
Expand Down
15 changes: 8 additions & 7 deletions packages/components/src/mobile/bottom-sheet/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BottomSheet extends Component {
};

SafeArea.getSafeAreaInsetsForRootView().then( this.onSafeAreaInsetsUpdate );
Dimensions.addEventListener('change', this.onSetMaxHeight)
Dimensions.addEventListener( 'change', this.onSetMaxHeight );
}

componentDidMount() {
Expand Down Expand Up @@ -87,13 +87,12 @@ class BottomSheet extends Component {
}

onSetMaxHeight() {
const { height } = Dimensions.get('window');
const { height } = Dimensions.get( 'window' );
const { safeAreaBottomInset } = this.state;

this.setState({ maxHeight: height / 2 - safeAreaBottomInset })
this.setState( { maxHeight: height / 2 - safeAreaBottomInset } );
}


render() {
const {
title = '',
Expand All @@ -109,15 +108,17 @@ class BottomSheet extends Component {

const panResponder = PanResponder.create( {
onMoveShouldSetPanResponder: ( evt, gestureState ) => {
// Temporarily disable 'swiping-to-close' option on Android
// 'swiping-to-close' option is temporarily and partially disabled
// on Android ( swipe / drag is still available in the top most area - near drag indicator)
if ( Platform.OS === 'ios' ) {
// Activates swipe down over child Touchables if the swipe is long enough.
// With this we can adjust sensibility on the swipe vs tap gestures.
if ( gestureState.dy > 3 && ! this.state.bounces ) {
gestureState.dy = 0;
return true;
}
} return false;
}
return false;
},
} );

Expand Down Expand Up @@ -172,7 +173,7 @@ class BottomSheet extends Component {
styles.content,
hideHeader && styles.emptyHeader,
{ paddingBottom: this.state.safeAreaBottomInset },
contentStyle
contentStyle,
] }
>
{ this.props.children }
Expand Down

0 comments on commit edfc88c

Please sign in to comment.