Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

940 B
Raw Blame
import { createContext } from 'react'

// Hold below-reader growth during scrolling because corrective writes stop iOS flings; notify only growing rows.
export type MobileNativeChatGrowthHold = {
  held: () => boolean
  subscribe: (onChange: () => void) => () => void
}

export function createMobileNativeChatGrowthHold(): MobileNativeChatGrowthHold & {
  set: (held: boolean) => void
} {
  let held = false
  const listeners = new Set<() => void>()
  return {
    held: () => held,
    subscribe: (onChange) => {
      listeners.add(onChange)
      return () => listeners.delete(onChange)
    },
    set: (next) => {
      if (next !== held) {
        held = next
        listeners.forEach((onChange) => onChange())
      }
    }
  }
}

const NEVER_HELD: MobileNativeChatGrowthHold = { held: () => false, subscribe: () => () => {} }

export const MobileNativeChatGrowthHoldContext =
  createContext<MobileNativeChatGrowthHold>(NEVER_HELD)