Last active
November 14, 2024 06:31
-
-
Save hirbod/03d487f40b4c091d2c56ebfb17dba7ed to your computer and use it in GitHub Desktop.
React Native LeanView and LeanText component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { type ComponentType, createElement, forwardRef } from 'react' | |
import type { TextProps } from 'react-native' | |
// uncomment for NativeWind support | |
//import { cssInterop } from 'nativewind' | |
const LeanText = forwardRef((props, ref) => { | |
return createElement('RCTText', { ...props, ref }) | |
}) as ComponentType<TextProps> | |
LeanText.displayName = 'RCTText' | |
/* uncomment this if you use NativeWind | |
cssInterop(LeanText, { | |
className: { | |
target: 'style', | |
}, | |
}) | |
*/ | |
export { LeanText } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { type ComponentType, createElement, forwardRef } from 'react' | |
import type { ViewProps } from 'react-native' | |
// uncomment for NativeWind support | |
//import { cssInterop } from 'nativewind' | |
const LeanView = forwardRef((props, ref) => { | |
return createElement('RCTView', { ...props, ref }) | |
}) as ComponentType<ViewProps> | |
LeanView.displayName = 'RCTView' | |
/* uncomment this if you use NativeWind | |
cssInterop(LeanView, { | |
className: { | |
target: 'style', | |
}, | |
}) | |
*/ | |
export { LeanView } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment