Using view in react native that was created in swift
This commit is contained in:
parent
464d82cfd3
commit
97fb795866
7 changed files with 100 additions and 2 deletions
11
App.tsx
11
App.tsx
|
@ -2,7 +2,15 @@ import { NewAppScreen } from '@react-native/new-app-screen'
|
|||
import { useEffect, useState } from 'react'
|
||||
import { StatusBar, Text, StyleSheet, useColorScheme, View } from 'react-native'
|
||||
import { NativeEventEmitter, NativeModules } from 'react-native'
|
||||
const { Emitter } = NativeModules;
|
||||
|
||||
const { Emitter } = NativeModules
|
||||
|
||||
import { requireNativeComponent } from 'react-native'
|
||||
import type { StyleProp, ViewStyle } from 'react-native'
|
||||
type CustomButtonProps = {
|
||||
style?: StyleProp<ViewStyle>
|
||||
}
|
||||
const CustomButton = requireNativeComponent<CustomButtonProps>('CustomButton')
|
||||
|
||||
export default function App() {
|
||||
const isDarkMode = useColorScheme() === 'dark'
|
||||
|
@ -25,6 +33,7 @@ export default function App() {
|
|||
<View style={styles.container}>
|
||||
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
||||
<Text>{message ?? 'Waiting for message...'}</Text>
|
||||
<CustomButton style={{ width: 200, height: 200 }} />
|
||||
<NewAppScreen templateFileName="App.tsx" />
|
||||
</View>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue