File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Text as RNText , type TextProps } from 'react-native' ;
22import { copyComponentProperties } from '../../utils' ;
3+ import { useStyled } from '../../web/useStyled' ;
34
4- export const Text = copyComponentProperties ( RNText , ( props : TextProps ) => {
5- return < RNText { ...props } /> ;
6- } ) ;
5+ export const Text = copyComponentProperties (
6+ RNText ,
7+ ( { className, style, ...props } : TextProps ) => {
8+ const nextStyle = useStyled ( className , style ) ;
9+ return < RNText { ...props } style = { nextStyle } /> ;
10+ }
11+ ) ;
Original file line number Diff line number Diff line change 11import { View as RNView , type ViewProps } from 'react-native' ;
2- import { copyComponentProperties , getDeepKeys } from '../utils' ;
3- import { useStyled } from '../native/useStyled' ;
2+ import { copyComponentProperties , getDeepKeys } from '../../ utils' ;
3+ import { useStyled } from '../../ native/useStyled' ;
44import { useId } from 'react' ;
5- import { useRef } from '../native/useRef' ;
6- import { StyleRegistry } from '../specs/StyleRegistry' ;
5+ import { useRef } from '../../ native/useRef' ;
6+ import { StyleRegistry } from '../../ specs/StyleRegistry' ;
77
88export const View = copyComponentProperties ( RNView , ( props : ViewProps ) => {
99 const componentId = useId ( ) ;
Original file line number Diff line number Diff line change 1+ import { View as RNView , type ViewProps } from 'react-native' ;
2+ import { copyComponentProperties } from '../../utils' ;
3+ import { useStyled } from '../../web/useStyled' ;
4+
5+ export const View = copyComponentProperties (
6+ RNView ,
7+ ( { className, style, ...props } : ViewProps ) => {
8+ const nextStyle = useStyled ( className , style ) ;
9+ return < RNView { ...props } style = { nextStyle } /> ;
10+ }
11+ ) ;
Original file line number Diff line number Diff line change 1- import { View } from '.. /View.native ' ;
2- export * from '.. /View.native ' ;
1+ import { View } from './View' ;
2+ export * from './View' ;
33
44export default View ;
Original file line number Diff line number Diff line change 1+ import { useMemo } from 'react' ;
2+
3+ export function useStyled ( className ?: string , style ?: any ) : any {
4+ return useMemo ( ( ) => {
5+ if ( className && style ) {
6+ return [ { $$css : true , className } , style ] ;
7+ } else if ( className ) {
8+ return { $$css : true , className } ;
9+ } else if ( style ) {
10+ return style ;
11+ } else {
12+ return undefined ;
13+ }
14+ } , [ className , style ] ) ;
15+ }
You can’t perform that action at this time.
0 commit comments