This example is extremely basic but hopefully still useful.
You run it by cloning the main repo, and running yarn example:install
then yarn example:start
, and finally yarn example:android
or yarn example:ios
The example currently validates these things:
- the module should successfully integrate with current react-native: install and run, android and ios
- the module should successfully open the login screen when the login button is tapped
- the module should successfully open the share dialog when the share link is tapped
- The Facebook App ID in use for the example is not configured, and it is problematic to configure one for the internet at large. Replace the App ID in
ios/RNFBSDKExample/Info.plist
andandroid/src/main/res/values/strings.xml
with your App ID - It does not demonstrate anything else, contributions welcome
- First, note that it is automatically constructed. The only file that is preserved when
refresh-example.sh
is run isApp.js
- Make all UI changes in
App.js
- Make all config changes (
Info.plist
or.java
/.m
file changes via sed edits inrefresh-example.sh
. No, that's not the easiest thing to do. But unless you commit to maintaining the project and updating the example app yourself for a few years, it is still the most efficient way)
If you are making changes to the core module and using the example for testing, you must understand the example references the module code via a github reference.
The example will contain stale files unless you clear the lockfiles/modules, copy in the module code and reinstall. There are three commands which are useful for development that help you manage this. You may run all of these from the main directory:
yarn example:clean
- this removes node_modules and the yarn and pod lockfilesyarn example:install
- this just runsyarn
andpod install
for youyarn example:devcopy
- this runsyarn prepare
to build the core module, then copies the modules files in to the example
A typical workflow will involve you making changes in the core src / android / ios folders, then running yarn example:devcopy
and - if you changed something in package.json or the podspec then yarn example:install
repeatedly, while perhaps rebuilding the the native code in RNFBSDKExample
as if it were a normal project (that is, yarn android
or yarn ios
to see the fresh native changes)