Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import StyleSheet, {
type ColorValue,
type ViewStyleProp,
} from '../../StyleSheet/StyleSheet';
import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
import Platform from '../../Utilities/Platform';
import useWindowDimensions from '../../Utilities/useWindowDimensions';
import View from '../View/View';
import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
import * as React from 'react';

Expand Down Expand Up @@ -86,6 +89,8 @@ type Props = $ReadOnly<{|
|}>;

const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
const {width} = useWindowDimensions();

if (Platform.OS === 'ios') {
if (React.Children.count(props.children) === 0) {
return null;
Expand All @@ -96,7 +101,9 @@ const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
style={[props.style, styles.container]}
nativeID={props.nativeID}
backgroundColor={props.backgroundColor}>
{props.children}
<SafeAreaView style={[styles.safeAreaView, {width}]}>
{props.children}
</SafeAreaView>
</RCTInputAccessoryViewNativeComponent>
);
} else {
Expand All @@ -109,6 +116,9 @@ const styles = StyleSheet.create({
container: {
position: 'absolute',
},
safeAreaView: {
flex: 1,
},
});

export default InputAccessoryView;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ exports[`<InputAccessoryView /> should render as <RCTInputAccessoryView> when mo
]
}
>
<View />
<RCTSafeAreaView
style={
Array [
Object {
"flex": 1,
},
Object {
"width": 750,
},
]
}
>
<View />
</RCTSafeAreaView>
</RCTInputAccessoryView>
`;

Expand All @@ -28,7 +41,20 @@ exports[`<InputAccessoryView /> should render as <RCTInputAccessoryView> when no
]
}
>
<View />
<RCTSafeAreaView
style={
Array [
Object {
"flex": 1,
},
Object {
"width": 750,
},
]
}
>
<View />
</RCTSafeAreaView>
</RCTInputAccessoryView>
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ - (instancetype)init

[_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor].active = YES;
[_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES;
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor].active = YES;
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor].active = YES;
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor].active = YES;
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor].active = YES;
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ - (instancetype)init
[NSLayoutConstraint activateConstraints:@[
[_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor],
[_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor],
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor],
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor]
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor]
]];
}
return self;
Expand Down