Skip to content

Instantly share code, notes, and snippets.

@JaiParakh
Created January 31, 2021 05:39
Show Gist options
  • Save JaiParakh/469bd6b980da0f61f5d0100a8fe2d38e to your computer and use it in GitHub Desktop.
Save JaiParakh/469bd6b980da0f61f5d0100a8fe2d38e to your computer and use it in GitHub Desktop.
import React, { createRef } from "react";
import { StyleSheet, Text, View, Button } from 'react-native';
import ActionSheet from "react-native-actions-sheet";
const actionSheetRef = createRef();
// This Menu component is fully customizable. Add whatever you want!!
const Menu = () => (
<View style={styles.drawerContent} >
<Text>Hello There</Text>
<Text>General Kenobi</Text>
</View>
)
export default function App() {
return (
<View style={styles.container}>
<Button onPress={() => {
actionSheetRef.current?.setModalVisible();
}} title="Toggle Actionsheet" />
<ActionSheet ref={actionSheetRef} containerStyle={{borderTopLeftRadius: 25, borderTopRightRadius: 25,borderBottomLeftRadius: 0, borderBottomRightRadius: 0}}>
<Menu />
</ActionSheet>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
drawerContent: {
padding: 10,
paddingHorizontal: 10,
minHeight: 100
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment