• Stars
    star
    177
  • Rank 209,471 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

react-native-swiftui

This project is to research what we can do to take advantage of using SwiftUI as a replacement for UIKit being the iOS native framework used by React Native to render user interfaces. Especially, it would make it possible to use React Native on other Apple platforms such as macOS, watchOS, tvOS and iOS widgets.

Reimplemented React Native components

View

  • Applying layout metrics calculated by Yoga from provided position-related styles
  • Other styles
    • backgroundColor
    • color
    • opacity
    • borderLeft (borderLeftWidth and borderLeftColor)

Text

  • Styles excluding these inherited from View
    • fontSize
    • fontWeight
    • fontStyle (only italic so far)
    • textAlign (no justify support)
  • Props
    • numberOfLines prop
    • ellipsizeMode prop
      • head
      • center
      • tail
      • clip (no such equivalent in SwiftUI, but it can be implemented the other way)

Button

  • React Native's button heavily depends on Touchables relying on responder events that might be tricky to reimplement, so we have our own Button component instead.
  • Events
    • onPress
    • onActiveStateChange

TextInput

  • Styles inherited from View
  • Props
    • placeholder
    • value
    • partially multiline, read more below
  • Events
    • onChange
    • onFocus
    • onBlur
    • onEndEditing
  • SwiftUI's TextField doesn't provide much functionalities yet. Under the hood it still uses UITextField from UIKit so hopefully it will be improved soon. So far it isn't yet possible to:
    • Focus/blur on demand
    • Change tappable area β€” the default area is very narrow and doesn't include given padding
    • Get cursor position
    • Read text selection
    • For multiline input we can use TextEditor however it doesn't meet our requirements even more as it doesn't support any events and placeholder text.

Switch

  • Props
    • value
    • partially trackColor (only false state is supported by SwiftUI yet)
  • Events
    • onChange

ScrollView

  • A lot of properties known from UIScrollView are missing in SwiftUI, so we have our own ScrollView component.
  • There is no convenient way to get onScroll event other than just adding drag gesture.
  • Scroll to specified point within the view is not provided yet. However, as it let us scroll to a subview with specified ID, we can omit this limitation by rendering empty points filling the entire axis with an ID being its (X,Y) position which is how scrollTo command is implemented.
  • Props
    • axes that takes vertical/horizontal/both as an argument.
    • showsIndicators β€” as opposed to UIScrollView, for 2-directional scroll views, we cannot specify different arguments for specific axis.
  • Commands
    • scrollTo(options: { y: number, animated: boolean }) β€” works only for vertical scrolls, as it would be a significant performance hit in the current implementation to support both axes.

Image

  • Implemented only for network assets.
  • Only source property is supported. Accepts the same value types as Image from React Native.

Graphical Effects

Animation

Animates changes to all animatable values within this view (including its subviews).

  • Props
    • type (easeIn, easeOut, easeInOut, linear)
    • duration (in seconds)

Shadow

Adds a shadow with given radius, offsetX, offsetY, opacity and color to children views.

Mask

Masks children views using the alpha channel of the views provided by shape prop.

Shapes

SVG-like shape components. Shapes are not managed by Yoga which means they have their own layouting mechanism (configurable with alignment, offsetX and offsetY props) that makes them positioned absolutely to the parent view. As opposed to SVG, our shapes can contain children.

Common shape props: fill, alignment, offsetX, offsetY, stroke, strokeWidth, strokeLineCap, strokeLineJoin, strokeDashes, strokeDashPhase.

Rect

Additional props: width, height

Circle

Additional props: radius

More Repositories

1

reanimated-2-playground

Playground app – fresh React Native project with preinstalled Reanimated v2
Java
186
star
2

react-native-url-router

A new way to create navigation in react-native
TypeScript
132
star
3

stack-beautifier

Tool for decrypting stack traces coming from the minified JS code.
JavaScript
111
star
4

react-native-turbo-demo

React Native Turbo - an open source library that can bring your turbo-enabled web application into the React Native world.
Kotlin
89
star
5

react-native-resource-saving-container

View container that saves resources (bitmaps, camera) by detaching native views when they are not visible
JavaScript
80
star
6

expo-maps

Swift
80
star
7

drawings-and-animations-workshop

TypeScript
64
star
8

gradient-shared-transitions-example

JavaScript
44
star
9

elixir-caldav-client

CalDAV client in the Elixir language
Elixir
40
star
10

react-native-hour-format

Get hour format from OS settings.
Java
29
star
11

reanimated-bottom-sheet-video

JavaScript
21
star
12

web3-account

Adapter application for consuming web3 messages from ie. wallets, and passing them on to starknet
TypeScript
20
star
13

react-native-docker-android

Docker image for building React Native apps for Android in clear environment
Dockerfile
18
star
14

react-native-labs

Directory with experimental React Native modules and features
Java
16
star
15

detox-your-graphql

Example app for E2E testing with Detox and Apollo GraphQL Server
JavaScript
13
star
16

react-native-memory-leak-example

Example app that demonstrates how resources could be leaked in React Native apps
JavaScript
11
star
17

appjs-2023-workshop-reanimated

TypeScript
11
star
18

tinymceMathjax

MathJax plugin for tinyMCE v4
HTML
10
star
19

elixir-janus

Bindings for Janus Gateway for the Elixir language
Elixir
10
star
20

elixir-ibm-speech-to-text

Elixir client library for IBM Cloud Speech to Text service
Elixir
8
star
21

appjs-2023-workshop-expo-modules

TypeScript
6
star
22

poke-workshops

Workshops for teaching React Native and Expo
JavaScript
6
star
23

scarb-eject

Create cairo_project.toml for a given Scarb package.
Rust
5
star
24

starknet-android-demo

Kotlin
5
star
25

EIP712-cairo-article

Cairo
4
star
26

elixir-gcloud-speech-grpc

Elixir client for Google Cloud Speech-to-Text API using gRPC
Elixir
4
star
27

intro-to-blockchain

Python
4
star
28

protostar-tutorial

Cairo
4
star
29

elixir-janus-transport-ws

Elixir
4
star
30

elixir-janus-plugin-videoroom

Bindings for Janus Gateway for the Elixir language - videoroom plugin API
Elixir
4
star
31

appjs-2022-workshops-start

Everything you need to know about Fabric and JSI
Java
4
star
32

reanimated-parallax

JavaScript
4
star
33

react-native-android-jsc-debugging

Proof of concept for connecting remote debugger to RN's JSC running on Android
Ruby
3
star
34

appjs-2023-workshop-optimization-start

TypeScript
3
star
35

crypto-cpp-py

Python packaged crypto-cpp
Python
3
star
36

workshops-crypto

Python
2
star
37

expo-workshops-agh-2018

Code from SoftwareMansion workshops for AGH UST 2018
JavaScript
2
star
38

starknet-workshops-ethwarsaw

Cairo
2
star
39

expo-workshops

JavaScript
2
star
40

poseidon-py

Poseidon hash Python library
Python
2
star
41

elixir-sftp-toolkit

SFTP Toolkit library for Elixir
Elixir
2
star
42

reanimated-beta-docs

New Reanimated Documentation
JavaScript
1
star
43

elixir-guerilla

Elixir
1
star
44

eslint-config-swmansion

SoftwareMansion's eslint config
JavaScript
1
star
45

rnos-library-matrix-tester

Run E2E tests of SWM libraries on different versions of React Native and across various configurations.
TypeScript
1
star
46

protostar-workshop-2023

1
star
47

dobra-noc-recorder

Elixir
1
star
48

janus_experiments

Experiments with Janus API
Python
1
star
49

babel-plugin-animated-block

Babel plugin to simplify RN animated expression
Objective-C
1
star
50

reanimated-legacy-docs

Legacy Reanimated Documentation
JavaScript
1
star
51

pokedex

πŸ“• PokΓ©dex πŸ“• in React Native with use of GraphQL πŸ“ DIY workshop πŸ› 
JavaScript
1
star
52

grafana-backup-s3

Tool for backing up & restoring Grafana dashboards and data sources and uploading them to S3 bucket.
Python
1
star