Skip to content
Merged
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
2 changes: 1 addition & 1 deletion demo/src/screens/componentScreens/ButtonsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class ButtonsScreen extends DemoScreen {
return (
<View useSafeArea>
{!!snippet && <SnippetBlock snippet={snippet} onClose={() => this.hideSnippet()}/>}
<ScrollView>
<ScrollView showsVerticalScrollIndicator={false}>
<View centerH>
<Text style={styles.title}>Buttons</Text>

Expand Down
15 changes: 15 additions & 0 deletions src/components/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ export default class Button extends PureBaseComponent {
}
}

componentDidMount() {
Constants.addDimensionsEventListener(this.onOrientationChanged);
}

componentWillUnmount() {
Constants.removeDimensionsEventListener(this.onOrientationChanged);
}

onOrientationChanged = () => {
if (Constants.isTablet && this.props.fullWidth) {
// only to trigger re-render
this.setState({isLandscape: Constants.isLandscape});
}
};

// This method will be called more than once in case of layout change!
onLayout = event => {
const height = event.nativeEvent.layout.height;
Expand Down