I have a very simple ViewController written in Swift with its UI built in Storyboard. It simply changes the text of a label when someone presses a button.
class ViewController: UIViewController { @IBOutlet weak var label: UILabel! @IBAction func changeText() { switch label.text! { case "Old Text": label.text = "New Text" case "New Text": label.text = "Old Text" default: break } }}
I want to use React Native for my project but only to handle the UI components, not the app logic itself. How would I go about this? I have laid out the button and the text with react.
var Button = require('react-native-button');class TestProject extends Component { render() { return (<View style={styles.container}><Button style={styles.button}>Change Text</Button><Text style={styles.text}> Text to be changed</Text></View> ); }}const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, text: { fontSize: 20, textAlign: 'center', margin: 10, }, button: { borderWidth: 1, borderColor: 'blue' },});
More broadly speaking, if what I want is possible, is it still feasible to use this approach for more powerful and robust applications?