Skip to content

idanlevi1/react-native-twitter-preview

npm version npm downloads npm license

react-native-twitter-preview

React Native library for previewing embedded Twitter/X tweets using their URL. The library provides a customizable preview of a tweet's author, text, and media content, allowing developers to match the preview's appearance to their app's design.

Installation

npm install react-native-twitter-preview

or

yarn add react-native-twitter-preview

You need react-native-webview in your project

npm install react-native-webview

or

yarn add react-native-webview

Usage

import { TwitterPreviewView } from 'react-native-twitter-preview';

// ...

<TwitterPreview
  url={'https://twitter.com/elonmusk/status/1636162726140493825'}
  backgroundColor={'#272A35'}
/>


Props

Name Description Type Required? Default
url Tweet url string V
style Tweet container style object (style)
backgroundColor Background color behind the tweet string '#FFF'
onPressTweet Called when a tweet is pressed Function Opens the tweet in the browser

Changelog

1.0.3

  • Fixed oembed API fetch header (AcceptsAccept) that caused tweet loading to fail
  • Added error handling for failed oembed requests
  • Fixed video playback — changed pointerEvents from none to auto so embedded videos and interactive content work properly

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Author

Made by Idanlevi1

About

React Native library for previewing embedded Twitter tweets using their URL. The library provides a customizable preview of a tweet's author, text, and media content, allowing developers to match the preview's appearance to their app's design.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors