Advertisement
Badal_hs_shah

invalid version alert .

Jan 16th, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {useEffect, useRef, useState} from 'react';
  2. import {View, Text, TouchableOpacity, StyleSheet} from 'react-native';
  3. import ActionSheet from 'react-native-actionsheet';
  4.  
  5. const InvalidVersionAlert: React.FC = props => {
  6.   const refActionSheet = useRef<ActionSheet>(null);
  7.  
  8.   useEffect(() => {
  9.     console.log('===================>Comes in version Alert');
  10.     showActionSheet();
  11.   }, []);
  12.  
  13.   const showActionSheet = () => {
  14.     if (refActionSheet.current) {
  15.       refActionSheet.current.show();
  16.     }
  17.   };
  18.  
  19.   return (
  20.     <View>
  21.       <Text onPress={showActionSheet}>"Open ActionSheet"</Text>
  22.       <ActionSheet
  23.         ref={refActionSheet}
  24.         title={'Which one do you like ?'}
  25.         options={['Apple', 'Banana', 'cancel']}
  26.         cancelButtonIndex={2}
  27.         destructiveButtonIndex={1}
  28.         onPress={index => {
  29.           /* do something */
  30.         }}
  31.       />
  32.     </View>
  33.   );
  34. };
  35.  
  36. export default InvalidVersionAlert;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement