Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, {useEffect, useRef, useState} from 'react';
- import {View, Text, TouchableOpacity, StyleSheet} from 'react-native';
- import ActionSheet from 'react-native-actionsheet';
- const InvalidVersionAlert: React.FC = props => {
- const refActionSheet = useRef<ActionSheet>(null);
- useEffect(() => {
- console.log('===================>Comes in version Alert');
- showActionSheet();
- }, []);
- const showActionSheet = () => {
- if (refActionSheet.current) {
- refActionSheet.current.show();
- }
- };
- return (
- <View>
- <Text onPress={showActionSheet}>"Open ActionSheet"</Text>
- <ActionSheet
- ref={refActionSheet}
- title={'Which one do you like ?'}
- options={['Apple', 'Banana', 'cancel']}
- cancelButtonIndex={2}
- destructiveButtonIndex={1}
- onPress={index => {
- /* do something */
- }}
- />
- </View>
- );
- };
- export default InvalidVersionAlert;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement