Convert Figma logo to code with AI

apache logoincubator-weex

Apache Weex (Incubating)

13,753
1,816
13,753
248

Top Related Projects

18,267

A framework for building Mobile cross-platform UI

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.

A framework for building native applications using React

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

A framework for building native Windows apps with React.

Quick Overview

Apache Weex is an open-source cross-platform mobile development framework that allows developers to build native-like mobile applications using web technologies such as JavaScript, CSS, and HTML. It aims to provide a seamless development experience across iOS, Android, and web platforms, enabling developers to write once and run on multiple platforms.

Pros

  • Cross-platform development: Write code once and deploy on iOS, Android, and web platforms
  • Native performance: Renders components using native UI elements, resulting in near-native performance
  • Familiar web technologies: Utilizes JavaScript, CSS, and HTML, making it accessible to web developers
  • Extensive component library: Provides a rich set of pre-built UI components and modules

Cons

  • Learning curve: Requires understanding of both web and mobile development concepts
  • Limited ecosystem: Smaller community and fewer third-party plugins compared to React Native or Flutter
  • Maintenance concerns: The project has faced some challenges in recent years, with slower development and community support
  • Platform-specific features: Some advanced platform-specific features may require native code implementation

Code Examples

  1. Creating a simple "Hello World" component:
<template>
  <div>
    <text>Hello World!</text>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld'
}
</script>

<style scoped>
.wrapper {
  justify-content: center;
  align-items: center;
}
.text {
  font-size: 50px;
  font-weight: bold;
  color: #41B883;
}
</style>
  1. Handling user input with a button:
<template>
  <div>
    <text>{{ message }}</text>
    <wxc-button text="Click me!" @wxcButtonClicked="onButtonClick"></wxc-button>
  </div>
</template>

<script>
import { WxcButton } from 'weex-ui'

export default {
  components: { WxcButton },
  data() {
    return {
      message: 'Welcome to Weex!'
    }
  },
  methods: {
    onButtonClick() {
      this.message = 'Button clicked!'
    }
  }
}
</script>
  1. Making an API request:
<template>
  <div>
    <text v-if="loading">Loading...</text>
    <text v-else>{{ data }}</text>
  </div>
</template>

<script>
const stream = weex.requireModule('stream')

export default {
  data() {
    return {
      loading: true,
      data: null
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      stream.fetch({
        method: 'GET',
        url: 'https://api.example.com/data',
        type: 'json'
      }, (response) => {
        this.loading = false
        this.data = response.data
      })
    }
  }
}
</script>

Getting Started

  1. Install the Weex CLI:

    npm install -g weex-toolkit
    
  2. Create a new Weex project:

    weex create my-project
    
  3. Navigate to the project directory and install dependencies:

    cd my-project
    npm install
    
  4. Run the project:

    npm start
    
  5. Open the Weex playground app on your mobile device and scan the QR code displayed in the terminal to view your app.

Competitor Comparisons

18,267

A framework for building Mobile cross-platform UI

Pros of Weex

  • More active development and frequent updates
  • Larger community and ecosystem support
  • Better documentation and examples for developers

Cons of Weex

  • Less focus on Apache Software Foundation governance
  • Potential for divergence from the incubator version
  • May have more proprietary features specific to Alibaba's needs

Code Comparison

incubator-weex:

const modal = weex.requireModule('modal')
modal.alert({
  message: 'This is an alert',
  okTitle: 'OK'
})

Weex:

const modal = weex.requireModule('modal')
modal.alert({
  message: 'This is an alert',
  okTitle: 'OK',
  callback: () => console.log('Alert closed')
})

The main difference in this example is the addition of a callback function in the Weex version, which provides more flexibility for handling user interactions.

Summary

While both repositories aim to develop the Weex framework, the Alibaba-maintained version (Weex) tends to be more actively developed and has a larger community. However, the Apache incubator version (incubator-weex) may adhere more strictly to open-source principles and Apache governance. Developers should consider their specific needs and preferences when choosing between the two repositories.

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.

Pros of NativeScript

  • More mature and stable project with a larger community and ecosystem
  • Supports both Angular and Vue.js frameworks, offering more flexibility
  • Better documentation and learning resources available

Cons of NativeScript

  • Steeper learning curve, especially for developers new to mobile development
  • Larger app size compared to Weex due to the inclusion of the entire runtime

Code Comparison

NativeScript (XML):

<Page>
  <StackLayout>
    <Label text="Hello, NativeScript!" />
    <Button text="Click me" tap="onButtonTap" />
  </StackLayout>
</Page>

Weex (Vue.js):

<template>
  <div>
    <text>Hello, Weex!</text>
    <wxc-button text="Click me" @wxcButtonClicked="onButtonTap"></wxc-button>
  </div>
</template>

Both frameworks allow developers to create native mobile applications using web technologies. NativeScript uses a custom XML-based markup language for defining UI, while Weex leverages Vue.js components. NativeScript provides a more native-like development experience, whereas Weex focuses on web-like development patterns.

NativeScript offers a wider range of supported platforms and better performance for complex applications. However, Weex has a gentler learning curve for web developers and potentially smaller app sizes for simpler applications.

A framework for building native applications using React

Pros of React Native

  • Larger community and ecosystem, with more third-party libraries and resources
  • Better performance for complex UI interactions and animations
  • More mature and stable, with longer development history

Cons of React Native

  • Steeper learning curve, especially for developers new to React
  • Larger app size due to bundled JavaScript runtime
  • More frequent updates and potential breaking changes

Code Comparison

React Native:

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const App = () => (
  <View style={styles.container}>
    <Text>Hello, React Native!</Text>
  </View>
);

Weex:

<template>
  <div class="container">
    <text>Hello, Weex!</text>
  </div>
</template>

<style scoped>
.container { /* styles */ }
</style>

React Native uses JSX syntax and React components, while Weex uses a Vue-like template structure. React Native relies on StyleSheet for styling, whereas Weex uses scoped CSS-like styles. Both frameworks aim to provide a native-like experience, but their approach and syntax differ significantly.

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

Pros of Ionic Framework

  • Larger and more active community, with more frequent updates and contributions
  • Extensive documentation and learning resources available
  • Supports multiple frameworks (Angular, React, Vue) for greater flexibility

Cons of Ionic Framework

  • Larger bundle size and potentially slower performance compared to native apps
  • Steeper learning curve for developers new to web technologies
  • May require additional plugins for accessing certain native device features

Code Comparison

Weex (Vue.js component):

<template>
  <div>
    <text>{{ message }}</text>
  </div>
</template>

<script>
export default {
  data() {
    return {
      message: 'Hello, Weex!'
    }
  }
}
</script>

Ionic Framework (Angular component):

import { Component } from '@angular/core';

@Component({
  selector: 'app-home',
  template: '<ion-content><h1>{{ message }}</h1></ion-content>'
})
export class HomePage {
  message = 'Hello, Ionic!';
}

Both frameworks allow for component-based development, but Ionic Framework provides more built-in UI components and integrates closely with popular web frameworks. Weex focuses on native rendering and performance, while Ionic emphasizes cross-platform compatibility and web standards.

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Pros of Flutter

  • More active development and larger community support
  • Extensive documentation and learning resources
  • Better performance for complex UI animations

Cons of Flutter

  • Larger app size due to bundled runtime
  • Steeper learning curve for developers new to Dart
  • Limited access to native platform features without plugins

Code Comparison

Flutter (Dart):

import 'package:flutter/material.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Flutter App')),
        body: Center(child: Text('Hello, World!')),
      ),
    );
  }
}

Weex (Vue.js):

<template>
  <div>
    <text>Hello, World!</text>
  </div>
</template>

<script>
export default {
  name: 'App'
}
</script>

Flutter uses Dart and a widget-based approach for building UIs, while Weex leverages Vue.js and web technologies. Flutter's code tends to be more verbose but offers more control over UI elements. Weex's syntax is simpler and familiar to web developers, but may have limitations in complex UI scenarios.

A framework for building native Windows apps with React.

Pros of React Native Windows

  • Specifically designed for Windows platforms, offering better integration with Windows-specific features
  • Larger and more active community, resulting in more frequent updates and better support
  • Backed by Microsoft, ensuring long-term support and development

Cons of React Native Windows

  • Limited to Windows platforms, reducing cross-platform compatibility compared to Weex
  • Steeper learning curve for developers not familiar with Windows development
  • Potentially larger app size due to Windows-specific dependencies

Code Comparison

React Native Windows:

import { NativeModules } from 'react-native-windows';

const { WindowsModule } = NativeModules;
WindowsModule.showNativeDialog('Hello from Windows!');

Weex:

const modal = weex.requireModule('modal');
modal.alert({
  message: 'Hello from Weex!',
  okTitle: 'OK'
});

Both frameworks allow for native module integration, but React Native Windows provides more Windows-specific functionality, while Weex focuses on cross-platform compatibility.

React Native Windows is ideal for developers targeting Windows platforms exclusively, offering deep integration with Windows features. Weex, on the other hand, provides a more versatile solution for cross-platform development, including mobile and web platforms. The choice between the two depends on the specific project requirements and target platforms.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Weex

A framework for building Mobile cross-platform UI.

Build Status

Join Us

Join us through mailing list.

Convenience Distribution

Since 0.28.0, Weex would publish two convince binary in each release for Android, please read the documentation about the detail.

Please take the above link seriously, otherwise you would be able to use the latest version of Weex.

platformstatus
Androidsdk Download Or sdk_legacy Download
iOSPod version Carthage compatible
Mobile Webnpm version

Support Android 4.1 (API 16), iOS 9.0+ and WebKit 534.30+.

FYI: The mobile web render is not supported by Apache Weex officially

For Windows

First of all, compiling or building Weex from Windows is not supported officially.

You could install Git for Windows and run all the following commands in git-bash.

Good Luck.

Meet Weex

  • Install Weex Playground to see examples we already written.
  • If you want to write a demo, install weex-cli in Node.js 8.0+ and
  • Run weex init to generate & start a simple project in an empty folder.
  • Follow the instructions in the project README.
  • Enjoy it.

Use Weex

Android

You should install android environment before building.

You can either build Weex from IDE (Android Studio) or command line.

Build From Android Studio

  1. Open android directory in Android Studio.
  2. Run git submodule update --init --remote in android directory if this is the first time you try to run Weex.

Build From Command Line

Please read How To Build for detail.

iOS

You should install iOS environment before building.

You can either build Weex from IDE (XCode) or command line.

Build From XCode

  • Run playground

    • cd ios/playground
    • pod install
    • Open WeexDemo.xcworkspace in Xcode
    • Click (Run button) or use default shortcut cmd + r in Xcode
    • If you want to run the demo on your device, don't need to modify CURRENT_IP manually. In DemoDefine.h(you can search this file by Xcode default shortcut cmd + shift + o), modify CURRENT_IP to your local IP
  • integrate to your application

    • CocoaPods

      Add the following line to your Podfile:

      pod 'WeexSDK'
    

    run pod install

    • Carthage

      Add the following line to your Cartfile:

      github "apache/incubator-weex"
    

    Run carthage update, and you should now have the latest version of WeexSDK in your Carthage folder.

Build From Command Line

Please read How To Build for detail.

Mobile Web

Vue Render for Apache Weex is a third party plugin, and not developed nor maintained by Apache Weex.

see Vue Render for Apache Weex.

Third part plugin

There is a third party plugin provides for debugging purpose.

You can also view this page for all third party plugin.

Weex Community

Contributing

See Weex Contributing Guide for more information.

NPM DownloadsLast 30 Days