# Check if at least one file name is provided
if ($args.Count -eq 0) {
    Write-Host "Please provide at least one filename."
    exit
}

# Loop through each file name passed as an argument
foreach ($file in $args) {
    # Extract filename without extension for the component name
    $filename = [System.IO.Path]::GetFileNameWithoutExtension($file)

    # Define the content to be written to the file
    $content = @"
import { View, Text } from 'react-native'
import React from 'react'

const $filename = () => {
  return (
    <View>
      <Text>$filename</Text>
    </View>
  )
}

export default $filename
"@

    # Create the file and write the content
    $filePath = ".\$file"
    Set-Content -Path $filePath -Value $content
    Write-Host "$file created with component $filename"
}