// withHooks
// noPage

import { LibStyle } from 'esoftplay/cache/lib/style/import';
import React from 'react';
import { Linking, Pressable, View } from 'react-native';
import RenderHtml from 'react-native-render-html';


export interface EventStepProps {
  text: string
}
export default function m(props: EventStepProps): any {
  const urls = props.text.match(/(https?:\/\/[^\s]+)/g)
  let VIEW: any = View
  if (urls && urls.length > 0) {
    VIEW = Pressable
  }
  return (
    <VIEW
      onPress={() => { if (urls && urls.length > 0) Linking.openURL(urls[0]) }}
      style={{ flexDirection: 'row', marginLeft: 15, paddingRight: 25, paddingBottom: 10 }}>
      <View style={{ marginRight: 15, marginTop: 3, borderRadius: 15, width: 14, height: 14, backgroundColor: "#f5e71e", borderStyle: "solid", borderWidth: 2, borderColor: "#70472b" }} />
      <View style={{ flex: 1 }} >
        <RenderHtml contentWidth={LibStyle.width} source={{ html: props?.text?.trim?.() }} />
      </View>
    </VIEW>
  )
}