mitosis icon indicating copy to clipboard operation
mitosis copied to clipboard

Missing broader Android support.

Open skylerreimer opened this issue 4 months ago • 0 comments

I am interested in helping provide a feature!

Yes

Which generators are impacted?

  • [X] All
  • [ ] Angular
  • [ ] HTML
  • [ ] Qwik
  • [ ] React
  • [ ] React-Native
  • [ ] Solid
  • [ ] Stencil
  • [ ] Svelte
  • [ ] Vue
  • [ ] Web components

What problem does this feature solve?

Hey from Amazon's Meridian team,

We have a design system that supports web, compose, and swiftui. I am the team's only android engineer. We get a lot of feature requests and asks for some of the multiplatform frameworks. I was interested in experimenting and seeing if I could generate a react native/flutter/kmp library from our existing compose library.

We are also in the process of spinning down our views/xml library in favor of compose, but it would be cool if maybe mitosis could help us keep it around. The existing interop api would require us to maintain a whole mapping of compose -> views and that's about the same effort as just keeping views around. A less painful (maybe AI powered) way of keeping views around would be appreciated. We have some crusty codebases here that are maintained by engineers with little interest in migration to compose.

What does the proposed API look like?

A react example like so:

import { useStore } from '@builder.io/mitosis';

export default function Greet() {
  const state = useStore({
    name: 'hey steve',
  });

  return (
    <div>
      <input
        value={state.name}
        onChange={(event) => (state.name = event.target.value)}
        placeholder="Your name"
      />
      <div>Hello, {state.name}!</div>
    </div>
  );
}

could become

@Composable
fun greet() {
  val state by remember { mutableStateOf("hey steve") }
  
  Column {
    TextField(value = state, onValueChange = { state = it }, label = "Your Name")
    Text("Hello, ${state.value}")
  }
}

As far as inputs I would like the targets prop of MitosisConfig to have at least Compose if not ComposeMultiplatform, Flutter, AndroidViews.

Additional Information

I'd be sorta interested in doing some of this implementation if it would save me some time helping my design system's users use multiplatform frameworks more easily.

skylerreimer avatar Oct 16 '24 13:10 skylerreimer