Skip to content

Commit

Permalink
(InputAccessoryView) display UnimplementedView on Android
Browse files Browse the repository at this point in the history
It prevents a crash when using InputAccessoryView on Android without specifying `Platform.OS === 'ios'`
  • Loading branch information
hduprat committed Jun 21, 2022
1 parent f97c6a5 commit 91d6c7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Libraries/Components/TextInput/InputAccessoryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import StyleSheet, {
} from '../../StyleSheet/StyleSheet';

import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
import UnimplementedView from '../UnimplementedViews/UnimplementedView';

/**
* Note: iOS only
Expand Down Expand Up @@ -90,6 +91,11 @@ class InputAccessoryView extends React.Component<Props> {
render(): React.Node {
if (Platform.OS !== 'ios') {
console.warn('<InputAccessoryView> is only supported on iOS.');
return (
<UnimplementedView style={this.props.style}>
{this.props.children}
</UnimplementedView>
);
}

if (React.Children.count(this.props.children) === 0) {
Expand Down

0 comments on commit 91d6c7d

Please sign in to comment.