Open faorte opened 9 months ago
@faorte Thanks for reporting this. We'll have a look.
Hi @surajahmed , any update on this. Facing the same issue. Thanks
@anup-a We're working on it. Please eject the components and try replacing ScrollView with View for Actionsheet content and wrap it with KeyboardAvoidingView for now. Please follow https://gluestack.io/ui/docs/home/theme-configuration/customizing-theme/eject-library
Is there any estimate of when we can expect this to be fixed? We are also experiencing this issue.
We're working on it. Hope to push the fix in the coming release. Thanks for your patience.
@surajahmed
The problem apparently is with the Overlay.
It is possible to modify Actionsheet.tsx to listen to the Keyboard keyboardDidShow event and thus add a marginBottom: 200 when opening the keyboard.
File path: node_modules/@gluestack-ui/actionsheet/src/Actionsheet.tsx
An example, how to implement the solution:
const [isKeyboardVisible, setKeyboardVisible] = useState(false);
useEffect(() => {
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
setKeyboardVisible(true);
});
const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
setKeyboardVisible(false);
});
return () => {
keyboardDidHideListener.remove();
keyboardDidShowListener.remove();
};
}, []);
return (
<Overlay
isOpen={visible}
onRequestClose={handleClose}
isKeyboardDismissable={isKeyboardDismissable}
useRNModal={useRNModal}
// @ts-ignore
style={{
...overlayStyle,
...(Platform.OS === 'ios' && { marginBottom: isKeyboardVisible ? 200 : undefined }),
}}
>
<ActionsheetContext.Provider value={contextValue}>
<StyledActionsheet
ref={ref}
style={[StyleSheet.absoluteFill]}
{...(props as T)}
>
{children}
</StyledActionsheet>
</ActionsheetContext.Provider>
</Overlay>
);
This worked for me. It's not the best solution, but it works!
Sorry for my english.
Description
Trying your example for keyboardAvoidingView when you are using ActionSheet but it does not work on ios
CodeSandbox/Snack link
No response
Steps to reproduce
`function App() { const [showActionsheet, setShowActionsheet] = React.useState(false) const handleClose = () => setShowActionsheet(!showActionsheet) return ( <>