Skip to content

Instantly share code, notes, and snippets.

@RoRoGadget
Created June 5, 2019 15:46
Show Gist options
  • Save RoRoGadget/64c93007972521fa49664a908b3dbb20 to your computer and use it in GitHub Desktop.
Save RoRoGadget/64c93007972521fa49664a908b3dbb20 to your computer and use it in GitHub Desktop.
SwiftUI4RN
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View } from 'react-native';
const styles = StyleSheet.create({
bigBlue: {
color: 'blue',
fontWeight: 'bold',
fontSize: 30,
},
red: {
color: 'red',
},
});
export default class LotsOfStyles extends Component {
render() {
return (
<View>
<Text style={styles.red}>just red</Text>
<Text style={styles.bigBlue}>just bigBlue</Text>
<Text style={[styles.bigBlue, styles.red]}>bigBlue, then red</Text>
<Text style={[styles.red, styles.bigBlue]}>red, then bigBlue</Text>
</View>
);
}
}
// skip this line if using Create React Native App
AppRegistry.registerComponent('AwesomeProject', () => LotsOfStyles);
import UIKit
import SwiftUI
import PlaygroundSupport
// https://facebook.github.io/react-native/docs/style
struct LotsOfStyles: View {
var body: some View {
Group {
Text("just red").color(Color.red)
Text("just bigBlue")
.color(Color.blue)
.fontWeight(Font.Weight.bold)
.font(Font.system(size: 30))
Text("bigBlue, then red")
.color(Color.blue)
.fontWeight(Font.Weight.bold)
.font(Font.system(size: 30))
.color(Color.red)
Text("red, then bigBlue")
.color(Color.red)
.color(Color.blue)
.fontWeight(Font.Weight.bold)
.font(Font.system(size: 30))
}
}
}
PlaygroundPage.current.liveView = UIHostingController(rootView: LotsOfStyles())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment