Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, {useEffect, useState} from 'react';
- import {View, Text, TouchableOpacity} from 'react-native';
- import ActionSheet from 'react-native-actionsheet';
- const InvalidVersionAlert = () => {
- const [actionSheetRef, setActionSheetRef] = useState<any>(null);
- const [selected, setSelected] = useState<string>('Select an option');
- useEffect(() => {
- console.log('===================>Comes in version Alert');
- showActionSheet();
- }, []);
- const showActionSheet = () => {
- actionSheetRef.show();
- };
- console.log('===================>Comes in version Alert');
- const handlePress = (index: number) => {
- const options = ['Option 1', 'Option 2', 'Option 3'];
- setSelected(options[index]);
- };
- return (
- <View>
- <ActionSheet
- ref={o => setActionSheetRef(o)}
- title={'Select an option'}
- options={['Option 1', 'Option 2', 'Option 3', 'Cancel']}
- cancelButtonIndex={3}
- onPress={handlePress}
- />
- </View>
- );
- };
- export default InvalidVersionAlert;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement