$ npm install netceteragroup/react-native-twitterkit --save
$ react-native link react-native-twitterkit
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-twitterkit
and addRNTwitterkit.xcodeproj
- In XCode, in the project navigator, select your project, and select the target. Add
libRNTwitterkit.a
to your project'sBuild Phases
➜Link Binary With Libraries
- See https://fabric.io/kits/ios/twitterkit/install and https://docs.fabric.io/apple/twitter/advanced-setup.html for more details on how to integrate the initialization
- Run your project (
Cmd+R
)
- Append the following lines to
android/settings.gradle
:include ':react-native-twitterkit' project(':react-native-twitterkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twitterkit/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-twitterkit')
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.netcetera.reactnative.twitterkit.RNTwitterKitPackage;
to the imports at the top of the file - Add
new RNTwitterKitPackage()
to the list returned by thegetPackages()
method - You will need Consumer key, and consumer secret, from an already registered app on Twitter
- In
android/app/src/main/java/[...]/MainApplication.java
in theonCreate
method, you need to initialize the TwitterKit module by adding the following linesTwitterAuthConfig 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} />
);
}