Smart Arabic/RTL text renderer for React Native using WebView: auto height, proper justification, line clamp, and skeleton loading.
npm install react-native-arabic-autoheight-textBeautiful Arabic & RTL text inside WebView โ Auto Height + Proper Typography


![platforms]()
![TypeScript Friendly]()
A tiny, drop-in React Native component for Arabic / RTL text rendering with:
* ๐ Auto height inside WebView (no scrolling)
* ๐ Perfect RTL direction + proper justification
* โ๏ธ Line clamping using CSS (-webkit-line-clamp)
* ๐จ Converts TextStyle โ WebView CSS
* ๐ฆด Built-in / custom Skeleton loader
* ๐ Adaptive skeleton for dark mode
* ๐ Supports fixed or dynamic layout with accuracy
Designed for:
News, corporate content, About screens, product descriptions, long Arabic articlesโฆ
---
---
``bash`
yarn add react-native-arabic-autoheight-text react-native-webview react-native-skeleton-placeholderOR
npm install react-native-arabic-autoheight-text react-native-webview react-native-skeleton-placeholder
iOS
`bash`
cd ios && pod install
---
`tsx`
textStyle={{ fontSize: 18, color: '#333' }}
/>
---
`tsx`
numberOfLines={3}
textStyle={{ fontSize: 16 }}
/>
---
`tsx`
textStyle={{ fontSize: 16 }}
renderSkeleton={() => (
)}
/>
---
> Skeleton auto-matches horizontal text padding
> โ perfect alignment during loading
`tsx`
textStyle={{ fontSize: 16, marginHorizontal: 20 }}
/>
๐ก Skeleton width = full width โ horizontal text margins
`tsx`
textStyle={{ marginHorizontal: 20 }}
matchTextHorizontalPadding={false}
/>
---
`tsx`
textStyle={{ fontSize: 16 }}
webviewProps={{ showsVerticalScrollIndicator: false }}
/>
---
| Prop | Type | Default | Description |
| ---------------------------- | ------------------------------------------------ | -------------- | ------------------------------------------ |
| text | string | โ | Arabic text content |textStyle
| | StyleProp | โ | Converted to CSS inside WebView |numberOfLines
| | number | undefined | Max visible lines using CSS clamp |isDark
| | boolean | false | Changes skeleton theme |fontFamily
| | string | from textStyle | Override web font |renderSkeleton
| | () => React.ReactNode | default | Custom skeleton UI |skeletonHeight
| | number | 100 | Height during loading |skeletonProps
| | Record | {} | Props forwarded to Skeleton |webviewProps
| | WebViewProps | {} | Forwarded to WebView |containerStyle
| | StyleProp | {} | Outer wrapper styling |matchTextHorizontalPadding
| | boolean | true | Copy textโs horizontal padding to skeleton |
---
Extracted CSS from last-defined textStyle value:
* color, backgroundColorfontSize
* , fontWeight, lineHeight, fontFamilytextAlign
* , RTL alignment enhancementsmarginStart
* Margins: , marginEnd, marginHorizontal, marginVertical
* WebView auto background transparency while loading
> ๐ก marginStart + marginEnd recommended for RTL UI
---
React Native still suffers with:
โ Justified Arabic glyph shaping
โ Broken connections in RTL
โ Poor multi-line rendering
โ No CSS multi-line clamp
This component fixes all of the above โ๏ธ
---
| Issue | Fix |
| ------------------------------ | ------------------------------------------- |
| Skeleton too skinny | remove matchTextHorizontalPadding={false}` |
| Wrong first height | Font loader will update automatically |
| Background shows while loading | WebView background auto-hidden |
---
๐น Mixed LTR/RTL detection
๐น โRead moreโ collapsed text
๐น Full custom CSS styles
๐น Accessibility enhancements
PRs welcome โจ
---
Built with โค๏ธ by Ahmed Hegazy
๐ง ahmedmhegazy.eg@gmail.com
๐ GitHub: @ahmedhegazydev
---
MIT โ Free for commercial & open-source use