weechatRN

Weechat relay client for iOS using websockets https://github.com/mhoran/weechatRN
git clone http://git.hanabi.in/repos/weechatRN.git
Log | Files | Refs | README | LICENSE

parse-text-args.ts (938B)


      1 import { TextStyle } from 'react-native';
      2 import { ParseShape } from 'react-native-parsed-text';
      3 
      4 export const getParseArgs = (
      5   style: TextStyle,
      6   onPress: (type: string, text: string) => void,
      7   onLongPress: (type: string, text: string) => void
      8 ): ParseShape[] => {
      9   const baseObj = {
     10     style
     11   };
     12 
     13   return [
     14     {
     15       ...baseObj,
     16       onPress: (arg) => onPress('url', arg),
     17       onLongPress: (arg) => onLongPress('url', arg),
     18       type: 'url'
     19     },
     20     {
     21       ...baseObj,
     22       onPress: (arg) => onPress('channel', arg),
     23       onLongPress: (arg) => onLongPress('channel', arg),
     24       pattern: /#(\w+)/
     25     },
     26     {
     27       ...baseObj,
     28       onPress: (arg) => onPress('phone', arg),
     29       onLongPress: (arg) => onLongPress('phone', arg),
     30       type: 'phone'
     31     },
     32     {
     33       ...baseObj,
     34       onPress: (arg) => onPress('email', arg),
     35       onLongPress: (arg) => onLongPress('email', arg),
     36       type: 'email'
     37     }
     38   ];
     39 };