$ npm install netceteragroup/react-native-twitterkit --save
$ react-native link react-native-twitterkit
Libraries
➜ Add Files to [your project's name]
node_modules
➜ react-native-twitterkit
and add RNTwitterkit.xcodeproj
libRNTwitterkit.a
to your project's Build Phases
➜ Link Binary With Libraries
Cmd+R
)android/settings.gradle
:
include ':react-native-twitterkit'
project(':react-native-twitterkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twitterkit/android')
android/app/build.gradle
:
compile project(':react-native-twitterkit')
android/app/src/main/java/[...]/MainApplication.java
import com.netcetera.reactnative.twitterkit.RNTwitterKitPackage;
to the imports at the top of the filenew RNTwitterKitPackage()
to the list returned by the getPackages()
methodandroid/app/src/main/java/[...]/MainApplication.java
in the onCreate
method, you need to initialize the TwitterKit module by adding the following lines
TwitterAuthConfig authConfig = new TwitterAuthConfig(CONSUMER_KEY, CONSUMER_SECRET);
final Fabric fabricOpts = new Fabric.Builder(getApplicationContext())
.kits(new Twitter(authConfig) /* maybe some other frameworks from Twitter such as Crashlytics */)
.build();
Fabric.with(fabricOpts);
import {TweetView} from 'react-native-twitterkit';
function Section({tweetid}) {
return (
<TweetView {...tweetid} />
);
}